Menu
Back to Documentation Index

Field Migration Guide

Migration guide for transitioning to FIXM-aligned naming

VATSWIM API Field Migration

FIXM/TFMS-Compliant Field Names

Version: 1.0

Date: 2026-01-16

Scope: SWIM API JSON response field names only (not internal database columns)


Overview

This document maps the current SWIM API response field names to FIXM/TFMS-compliant names for standardization. The underlying database columns (ADL and swim_flights) remain unchanged - only the API output layer transforms field names.

Naming Conventions

LayerConventionExample
FIXMcamelCaseactualOffBlockTime
TFMSUPPERCASEAOBT
vATCSCC ExtensioncamelCase with vATCSCC: prefixvATCSCC:pilotCid
SWIM API (JSON)snake_caseactual_off_block_time

Section 1: Root Level Fields

CurrentNew (FIXM-aligned)FIXM ReferenceNotes
gufigufigufi✅ Keep
flight_uidflight_uid✅ Keep (internal)
flight_keyflight_key✅ Keep (internal)
_sourcedata_sourcevATCSCC:dataSource🔄 Rename
_first_seenfirst_tracked_timevATCSCC:firstTrackedTime🔄 Rename
_last_seenposition_timepositionTime🔄 Rename
_logon_timelogon_timevATCSCC:logonTime🔄 Rename
_last_synclast_sync_timevATCSCC:lastSyncTime🔄 Rename

Section 2: Identity Block

CurrentNew (FIXM-aligned)FIXM ReferenceNotes
identity.callsignidentity.aircraft_identificationaircraftIdentification🔄 Rename
identity.cididentity.pilot_cidvATCSCC:pilotCid🔄 Rename
identity.aircraft_typeidentity.aircraft_typeaircraftType✅ Keep
identity.aircraft_icaoidentity.aircraft_type_icaoaircraftType🔄 Clarify
identity.aircraft_faaidentity.aircraft_type_faaotherAircraftType🔄 Clarify
identity.weight_classidentity.weight_classnas:weightClass✅ Keep
identity.wake_categoryidentity.wake_turbulencewakeTurbulence🔄 Rename
identity.airline_icaoidentity.operator_icaooperatorIcaoDesignator🔄 Rename
identity.airline_nameidentity.operator_nameoperatorName🔄 Rename

Section 3: Flight Plan Block

CurrentNew (FIXM-aligned)FIXM ReferenceNotes
flight_plan.departureflight_plan.departure_aerodromedepartureAerodrome🔄 Rename
flight_plan.destinationflight_plan.arrival_aerodromearrivalAerodrome🔄 Rename
flight_plan.alternateflight_plan.alternate_aerodromealternateAerodrome🔄 Rename
flight_plan.cruise_altitudeflight_plan.cruising_levelcruisingLevel🔄 Rename
flight_plan.cruise_speedflight_plan.cruising_speedcruisingSpeed🔄 Rename
flight_plan.routeflight_plan.route_textrouteText🔄 Rename
flight_plan.remarksflight_plan.remarksremarks✅ Keep
flight_plan.flight_rulesflight_plan.flight_rules_categoryflightRulesCategory🔄 Rename
flight_plan.departure_artccflight_plan.departure_airspacedepartureAirspace🔄 Rename
flight_plan.destination_artccflight_plan.arrival_airspacearrivalAirspace🔄 Rename
flight_plan.departure_traconflight_plan.departure_traconvATCSCC:departureTracon✅ Keep
flight_plan.destination_traconflight_plan.arrival_traconvATCSCC:arrivalTracon🔄 Rename
flight_plan.departure_fixflight_plan.departure_pointdeparturePoint🔄 Rename
flight_plan.departure_procedureflight_plan.sidstandardInstrumentDeparture🔄 Rename
flight_plan.arrival_fixflight_plan.arrival_pointarrivalPoint🔄 Rename
flight_plan.arrival_procedureflight_plan.starstandardInstrumentArrival🔄 Rename
flight_plan.departure_runwayflight_plan.departure_runwaydepartureRunway✅ Keep
flight_plan.arrival_runwayflight_plan.arrival_runwayarrivalRunway✅ Keep

Section 4: Position Block

CurrentNew (FIXM-aligned)FIXM ReferenceNotes
position.latitudeposition.latitudeposition/latitude✅ Keep
position.longitudeposition.longitudeposition/longitude✅ Keep
position.altitude_ftposition.altitudealtitude🔄 Simplify
position.headingposition.tracktrack🔄 Rename
position.ground_speed_ktsposition.ground_speedgroundSpeed🔄 Remove unit suffix
position.true_airspeed_ktsposition.true_airspeedtrueAirspeed🔄 Remove unit suffix
position.vertical_rate_fpmposition.vertical_rateverticalRate🔄 Remove unit suffix
position.current_artccposition.current_airspacecurrentAirspace🔄 Rename
position.current_traconposition.current_traconvATCSCC:currentTracon✅ Keep
position.current_zoneposition.current_airport_zonevATCSCC:currentAirportZone🔄 Rename

Section 5: Progress Block

CurrentNew (FIXM-aligned)FIXM ReferenceNotes
progress.phaseprogress.flight_statusflightStatus🔄 Rename
progress.is_activeprogress.is_activevATCSCC:isActive✅ Keep
progress.distance_remaining_nmprogress.distance_to_destinationdistanceToDestination🔄 Rename
progress.distance_flown_nmprogress.distance_flowndistanceFlown🔄 Rename
progress.gcd_nmprogress.great_circle_distancegreatCircleDistance🔄 Rename
progress.route_total_nmprogress.total_flight_distancetotalFlightDistance🔄 Rename
progress.pct_completeprogress.percent_completevATCSCC:percentComplete🔄 Rename
progress.time_to_dest_minprogress.time_to_destinationvATCSCC:timeToDestination🔄 Rename

Section 6: Times Block

CurrentNew (FIXM-aligned)FIXM ReferenceTFMSNotes
times.etdtimes.estimated_off_block_timeestimatedOffBlockTimeEOBT🔄 Rename
times.etd_runwaytimes.estimated_time_of_departureestimatedTimeOfDepartureETD🔄 Rename
times.etatimes.estimated_time_of_arrivalestimatedTimeOfArrivalETA🔄 Rename
times.eta_runwaytimes.estimated_runway_arrivalvATCSCC:estimatedRunwayArrival🔄 Rename
times.eta_sourcetimes.eta_sourcevATCSCC:etaSource✅ Keep
times.eta_methodtimes.eta_methodvATCSCC:etaMethod✅ Keep
times.ete_minutestimes.estimated_elapsed_timeestimatedElapsedTimeETE🔄 Rename
times.outtimes.actual_off_block_timeactualOffBlockTimeAOBT🔄 Rename
times.offtimes.actual_time_of_departureactualTimeOfDepartureATOT🔄 Rename
times.ontimes.actual_landing_timeactualLandingTimeALDT🔄 Rename
times.intimes.actual_in_block_timeactualInBlockTimeAIBT🔄 Rename
times.ctdtimes.controlled_time_of_departurecontrolledTimeOfDepartureCTD🔄 Rename
times.ctatimes.controlled_time_of_arrivalcontrolledTimeOfArrivalCTA🔄 Rename
times.edcttimes.edctexpectedDepartureClearanceTimeEDCT✅ Keep (standard)

Section 7: TMI Block

CurrentNew (FIXM-aligned)FIXM ReferenceNotes
tmi.is_controlledtmi.is_controlledvATCSCC:isControlled✅ Keep
tmi.ground_stop_heldtmi.ground_stop_heldgroundStopHeld✅ Keep
tmi.gs_releasetmi.ground_stop_release_timevATCSCC:groundStopReleaseTime🔄 Rename
tmi.control_typetmi.control_typecontrolType✅ Keep
tmi.control_programtmi.program_nameprogramName🔄 Rename
tmi.control_elementtmi.control_elementcontrolElement✅ Keep
tmi.is_exempttmi.exempt_indicatorexemptIndicator🔄 Rename
tmi.exempt_reasontmi.exempt_reasonexemptReason✅ Keep
tmi.delay_minutestmi.delay_valuedelayValue🔄 Rename
tmi.delay_statustmi.delay_statusdelayStatus✅ Keep
tmi.slot_timetmi.slot_timeslotTime✅ Keep
tmi.program_idtmi.program_idvATCSCC:programId✅ Keep
tmi.slot_idtmi.slot_idvATCSCC:slotId✅ Keep

Migration Summary

SectionTotal FieldsKeepRenameRemove
Root7340
Identity9360
Flight Plan186120
Position10460
Progress8170
Times144100
TMI13850
TOTAL7929500

PHP Implementation

Update formatFlightRecord() in api/swim/v1/flights.php:

function formatFlightRecord($row, $use_swim_db = false) {
    $gufi = $row['gufi'] ?? swim_generate_gufi($row['callsign'], $row['fp_dept_icao'], $row['fp_dest_icao']);
    
    // Calculate time to destination
    $time_to_dest = null;
    if ($row['groundspeed_kts'] > 50 && $row['dist_to_dest_nm'] > 0) {
        $time_to_dest = round(($row['dist_to_dest_nm'] / $row['groundspeed_kts'])  60, 1);
    } elseif ($row['ete_minutes']) {
        $time_to_dest = $row['ete_minutes'];
    }
    
    $result = [
        // Root level - FIXM aligned
        'gufi' => $gufi,
        'flight_uid' => $row['flight_uid'],
        'flight_key' => $row['flight_key'],
        
        // Identity - FIXM aligned
        'identity' => [
            'aircraft_identification' => $row['callsign'],       // was: callsign
            'pilot_cid' => $row['cid'],                          // was: cid
            'aircraft_type' => $row['aircraft_type'],
            'aircraft_type_icao' => $row['aircraft_icao'],       // was: aircraft_icao
            'aircraft_type_faa' => $row['aircraft_faa'],         // was: aircraft_faa
            'weight_class' => $row['weight_class'],
            'wake_turbulence' => $row['wake_category'],          // was: wake_category
            'operator_icao' => $row['airline_icao'],             // was: airline_icao
            'operator_name' => $row['airline_name']              // was: airline_name
        ],
        
        // Flight Plan - FIXM aligned
        'flight_plan' => [
            'departure_aerodrome' => trim($row['fp_dept_icao'] ?? ''),   // was: departure
            'arrival_aerodrome' => trim($row['fp_dest_icao'] ?? ''),     // was: destination
            'alternate_aerodrome' => trim($row['fp_alt_icao'] ?? ''),    // was: alternate
            'cruising_level' => $row['fp_altitude_ft'],                  // was: cruise_altitude
            'cruising_speed' => $row['fp_tas_kts'],                      // was: cruise_speed
            'route_text' => $row['fp_route'],                            // was: route
            'remarks' => $row['fp_remarks'],
            'flight_rules_category' => $row['fp_rule'],                  // was: flight_rules
            'departure_airspace' => $row['fp_dept_artcc'],               // was: departure_artcc
            'arrival_airspace' => $row['fp_dest_artcc'],                 // was: destination_artcc
            'departure_tracon' => $row['fp_dept_tracon'],
            'arrival_tracon' => $row['fp_dest_tracon'],                  // was: destination_tracon
            'departure_point' => $row['dfix'],                           // was: departure_fix
            'sid' => $row['dp_name'],                                    // was: departure_procedure
            'arrival_point' => $row['afix'],                             // was: arrival_fix
            'star' => $row['star_name'],                                 // was: arrival_procedure
            'departure_runway' => $row['dep_runway'],
            'arrival_runway' => $row['arr_runway']
        ],
        
        // Position - FIXM aligned
        'position' => [
            'latitude' => $row['lat'] !== null ? floatval($row['lat']) : null,
            'longitude' => $row['lon'] !== null ? floatval($row['lon']) : null,
            'altitude' => $row['altitude_ft'],                           // was: altitude_ft
            'track' => $row['heading_deg'],                              // was: heading
            'ground_speed' => $row['groundspeed_kts'],                   // was: ground_speed_kts
            'true_airspeed' => $row['true_airspeed_kts'] ?? null,        // was: true_airspeed_kts
            'vertical_rate' => $row['vertical_rate_fpm'],                // was: vertical_rate_fpm
            'current_airspace' => $row['current_artcc'],                 // was: current_artcc
            'current_tracon' => $row['current_tracon'],
            'current_airport_zone' => $row['current_zone']               // was: current_zone
        ],
        
        // Progress - FIXM aligned
        'progress' => [
            'flight_status' => $row['phase'],                            // was: phase
            'is_active' => (bool)$row['is_active'],
            'distance_to_destination' => $row['dist_to_dest_nm'] !== null ? floatval($row['dist_to_dest_nm']) : null,  // was: distance_remaining_nm
            'distance_flown' => $row['dist_flown_nm'] !== null ? floatval($row['dist_flown_nm']) : null,
            'great_circle_distance' => $row['gcd_nm'] !== null ? floatval($row['gcd_nm']) : null,  // was: gcd_nm
            'total_flight_distance' => $row['route_total_nm'] !== null ? floatval($row['route_total_nm']) : null,  // was: route_total_nm
            'percent_complete' => $row['pct_complete'] !== null ? floatval($row['pct_complete']) : null,  // was: pct_complete
            'time_to_destination' => $time_to_dest                       // was: time_to_dest_min
        ],
        
        // Times - FIXM aligned (OOOI terminology)
        'times' => [
            'estimated_off_block_time' => formatDT($row['etd_utc']),     // was: etd
            'estimated_time_of_departure' => formatDT($row['etd_runway_utc'] ?? null),  // was: etd_runway
            'estimated_time_of_arrival' => formatDT($row['eta_utc']),    // was: eta
            'estimated_runway_arrival' => formatDT($row['eta_runway_utc']),  // was: eta_runway
            'eta_source' => $row['eta_source'],
            'eta_method' => $row['eta_method'],
            'estimated_elapsed_time' => $row['ete_minutes'],             // was: ete_minutes
            'actual_off_block_time' => formatDT($row['out_utc']),        // was: out (AOBT)
            'actual_time_of_departure' => formatDT($row['off_utc']),     // was: off (ATOT)
            'actual_landing_time' => formatDT($row['on_utc']),           // was: on (ALDT)
            'actual_in_block_time' => formatDT($row['in_utc']),          // was: in (AIBT)
            'controlled_time_of_departure' => formatDT($row['ctd_utc']), // was: ctd
            'controlled_time_of_arrival' => formatDT($row['cta_utc']),   // was: cta
            'edct' => formatDT($row['edct_utc'])
        ],
        
        // TMI - FIXM aligned
        'tmi' => [
            'is_controlled' => ($row['gs_held'] == 1 || $row['ctl_type'] !== null),
            'ground_stop_held' => $row['gs_held'] == 1,
            'ground_stop_release_time' => formatDT($row['gs_release_utc']),  // was: gs_release
            'control_type' => $row['ctl_type'],
            'program_name' => $row['ctl_prgm'],                          // was: control_program
            'control_element' => $row['ctl_element'],
            'exempt_indicator' => (bool)$row['is_exempt'],               // was: is_exempt
            'exempt_reason' => $row['exempt_reason'],
            'delay_value' => $row['delay_minutes'],                      // was: delay_minutes
            'delay_status' => $row['delay_status'],
            'slot_time' => formatDT($row['slot_time_utc']),
            'program_id' => $row['program_id'],
            'slot_id' => $row['slot_id']
        ],
        
        // Metadata - FIXM aligned
        'data_source' => 'vatcscc',                                      // was: _source
        'first_tracked_time' => formatDT($row['first_seen_utc']),        // was: _first_seen
        'position_time' => formatDT($row['last_seen_utc']),              // was: _last_seen
        'logon_time' => formatDT($row['logon_time_utc'])                 // was: _logon_time
    ];
    
    if ($use_swim_db && isset($row['last_sync_utc'])) {
        $result['last_sync_time'] = formatDT($row['last_sync_utc']);     // was: _last_sync
    }
    
    return $result;
}


API Response Example (After Migration)

{
  "gufi": "VAT-20260116-UAL123-KJFK-KLAX",
  "flight_uid": 12345,
  "flight_key": "UAL123-KJFK-KLAX-20260116",
  
  "identity": {
    "aircraft_identification": "UAL123",
    "pilot_cid": 1234567,
    "aircraft_type": "B738",
    "aircraft_type_icao": "B738",
    "aircraft_type_faa": "B738/L",
    "weight_class": "L",
    "wake_turbulence": "M",
    "operator_icao": "UAL",
    "operator_name": "United Airlines"
  },
  
  "flight_plan": {
    "departure_aerodrome": "KJFK",
    "arrival_aerodrome": "KLAX",
    "alternate_aerodrome": "KONT",
    "cruising_level": 35000,
    "cruising_speed": 460,
    "route_text": "DEEZZ5 DEEZZ J60 PSB J584 BJARR ANJLL4",
    "remarks": "PBN/A1B1C1D1S1S2 DOF/260116",
    "flight_rules_category": "I",
    "departure_airspace": "ZNY",
    "arrival_airspace": "ZLA",
    "departure_tracon": "N90",
    "arrival_tracon": "SCT",
    "departure_point": "DEEZZ",
    "sid": "DEEZZ5",
    "arrival_point": "BJARR",
    "star": "ANJLL4",
    "departure_runway": "31L",
    "arrival_runway": "25L"
  },
  
  "position": {
    "latitude": 39.8561,
    "longitude": -104.6737,
    "altitude": 35000,
    "track": 268,
    "ground_speed": 487,
    "true_airspeed": 462,
    "vertical_rate": 0,
    "current_airspace": "ZDV",
    "current_tracon": null,
    "current_airport_zone": null
  },
  
  "progress": {
    "flight_status": "ENROUTE",
    "is_active": true,
    "distance_to_destination": 985.3,
    "distance_flown": 1489.7,
    "great_circle_distance": 2150.0,
    "total_flight_distance": 2475.0,
    "percent_complete": 60.2,
    "time_to_destination": 121.5
  },
  
  "times": {
    "estimated_off_block_time": "2026-01-16T14:30:00Z",
    "estimated_time_of_departure": "2026-01-16T14:45:00Z",
    "estimated_time_of_arrival": "2026-01-16T19:15:00Z",
    "estimated_runway_arrival": "2026-01-16T19:12:00Z",
    "eta_source": "trajectory",
    "eta_method": "route_distance",
    "estimated_elapsed_time": 285,
    "actual_off_block_time": "2026-01-16T14:28:00Z",
    "actual_time_of_departure": "2026-01-16T14:43:00Z",
    "actual_landing_time": null,
    "actual_in_block_time": null,
    "controlled_time_of_departure": null,
    "controlled_time_of_arrival": null,
    "edct": null
  },
  
  "tmi": {
    "is_controlled": false,
    "ground_stop_held": false,
    "ground_stop_release_time": null,
    "control_type": null,
    "program_name": null,
    "control_element": null,
    "exempt_indicator": false,
    "exempt_reason": null,
    "delay_value": null,
    "delay_status": null,
    "slot_time": null,
    "program_id": null,
    "slot_id": null
  },
  
  "data_source": "vatcscc",
  "first_tracked_time": "2026-01-16T14:25:00Z",
  "position_time": "2026-01-16T16:45:00Z",
  "logon_time": "2026-01-16T14:20:00Z",
  "last_sync_time": "2026-01-16T16:45:15Z"
}


Backward Compatibility

To support existing API consumers during transition, consider:

1. Version header: Accept: application/vnd.vatcscc.swim.v2+json for new format

2. Query parameter: ?format=fixm to opt-in to new field names

3. Deprecation period: Return both old and new field names temporarily

Example with format parameter:

$format = swim_get_param('format', 'fixm');  // fixm (default) | legacy

if ($format === 'fixm') {
    return formatFlightRecordFIXM($row, $use_swim_db);
} else {
    return formatFlightRecordLegacy($row, $use_swim_db);
}


Files to Update

FileChanges
api/swim/v1/flights.phpformatFlightRecord() function
api/swim/v1/flight.phpSingle flight response format
api/swim/v1/positions.phpGeoJSON properties
api/swim/v1/tmi/controlled.phpTMI response format
scripts/swim_sync.phpNo changes (internal)
docs/swim/openapi.yamlUpdate field definitions
docs/swim/VATSIM_SWIM_API.postman_collection.jsonUpdate examples

End of SWIM API Field Migration Document*