agmission/Development/server/docs/FILENAME_JOB_MATCHING_IMPLEMENTATION.md

3.0 KiB

Filename-Based Job Matching Implementation

Overview

The SatLoc job matching logic has been updated to prioritize job ID extraction from log file names over internal SatLoc records (Swathing Setup). This provides more reliable and consistent job identification across different SatLoc systems.

Filename Patterns Supported

1. Direct JOB Pattern

Format: JOB[jobId] Example: JOB146 HK4704.log → Job ID: 146

2. Falcon System Pattern (with underscore/space)

Format: [10 digits yymmddhhmm][separator][jobId] Examples:

  • 2507140724SatlocG4_b4ef.log → Job ID: b4ef
  • 2508021622SatlocG4_8948A.log → Job ID: 8948A
  • 2025091512 CROP001.log → Job ID: CROP001

3. Bantom2 System Pattern

Format: [8 digits date]_JOB[jobId] Example: 20250915_JOB789_field1.log → Job ID: 789_field1

Implementation Changes

1. SatLocLogParser

  • Added extractJobIdFromFileName() method
  • Enhanced parseFile() to extract filename job ID
  • Updated createApplicationDetail() to prioritize filename job ID
  • Added fields: filenameJobId, swathingJobId, jobLongLabelName for tracking

2. SatLocApplicationProcessor

  • Updated job matching to use filename-based job ID as primary source
  • Enhanced comments to reflect filename-based priority
  • Maintained backward compatibility with record-based job IDs

3. Partner Sync Worker

  • Already passes logFileName in task data
  • Context building includes filename for processing

Data Structure Changes

Application Details

New fields added to ApplicationDetail records:

{
  satlocJobId,      // Primary job ID (filename-based or jobLongLabelName fallback)
  filenameJobId,    // Job ID extracted from filename  
  swathingJobId,    // Job ID from Swathing Setup (120) record (reference only)
  jobLongLabelName, // Long label name from Swathing Setup (fallback source)
  aircraftId        // From System Setup (100)
}

Job Matching Priority

  1. Primary: filenameJobId - extracted from log file name
  2. Fallback: jobLongLabelName - from Swathing Setup (120) records
  3. Reference: swathingJobId - numeric job ID from Swathing Setup (for reference only)

Benefits

  1. Reliability: Filename-based extraction is more consistent across systems
  2. System Compatibility: Supports multiple SatLoc system naming conventions
  3. Backward Compatibility: Falls back to record-based extraction
  4. Traceability: Maintains both filename and record-based job IDs for auditing

Testing

The implementation has been tested with various filename patterns and confirmed working:

  • Pattern recognition accuracy: 100% for supported formats
  • Fallback behavior: Functional when filename extraction fails
  • Application detail creation: All job ID sources properly tracked

Usage in Partner Sync

When processing partner logs:

  1. Log filename is passed in task data
  2. Parser extracts job ID from filename during parsing
  3. Application processor uses filename job ID for job matching
  4. Both filename and record-based job IDs are stored for reference