Skip to main content

Python library to parse IATA MVT flight movement messages

Project description

mvt-parser

Python library for parsing IATA MVT flight movement messages.

Install

pip install mvt-parser

Quick start

from mvt_parser import MVTParser

parser = MVTParser()
msg = parser.parse("""
MVT
BA100/27.PPVMU.LHR
AD1200/1210 EA1300 CDG
DL72/0015
PX145/12
SI DEICING
""")

print(msg.flight_number)          # BA100
print(msg.actual_departure)       # 1200/1210
print(msg.estimated_arrival)      # 1300
print(msg.delays[0].reason_codes) # ['72']
print(msg.passenger_info.total)   # 145

Supported message types

Type Description
MVT Movement — actual departure or arrival
MVA Movement Advice — estimated time update
DIV Diversion — flight redirected to another airport

All three support optional COR (correction) and REV (revision) flags.

Parsed fields

msg.flight_number           # "BA100"
msg.scheduled_day           # "27"
msg.aircraft_registration   # "PPVMU"
msg.airport_of_movement     # "LHR"
msg.is_correction           # False
msg.is_revision             # False

msg.actual_departure        # MovementTime(primary="1200", secondary="1210")
msg.actual_arrival          # MovementTime(primary="1515", secondary=None)
msg.estimated_departure     # "1100"
msg.estimated_arrival       # "1300"
msg.estimated_onblock       # "1320"

msg.delays                  # [Delay(reason_codes=["72"], durations=["0015"])]
msg.passenger_info          # PassengerInfo(total=145, infants=12)
msg.destination_airport     # "CDG"
msg.reclearance             # "LHR"

msg.takeoff_fuel            # 6400
msg.takeoff_weight          # 70000
msg.zero_fuel_weight        # 60000

msg.diversion_reason        # "71"
msg.return_from_airborne    # MovementTime(primary="1400", secondary="1420")
msg.supplementary_info      # ["DEICING"]
msg.next_info               # "221150"

Multi-leg flights

When a message contains multiple departure lines each line is captured as a FlightLeg:

msg = parser.parse("""
MVT
BA100/27.PPVMU.LHR
AD1200/1210 EA1300 CDG
AD1400/1415 EA1600 FRA
""")

for leg in msg.legs:
    print(leg.actual_departure, "->", leg.destination)
# 1200/1210 -> CDG
# 1400/1415 -> FRA

Export to dict / JSON

msg.to_dict()  # plain Python dict
msg.to_json()  # pretty-printed JSON string

Error handling

All parse failures raise MVTParseError:

from mvt_parser import MVTParser, MVTParseError

try:
    msg = parser.parse(raw)
except MVTParseError as e:
    print(f"Invalid message: {e}")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mvt_parser-0.1.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mvt_parser-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file mvt_parser-0.1.1.tar.gz.

File metadata

  • Download URL: mvt_parser-0.1.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mvt_parser-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d4e5f3d3ff4236acf792ffd6c51cce94abdd5b60eb6bea8749d81509c4fd063f
MD5 7eebb385f58cf63312f1a69751139e86
BLAKE2b-256 b59d13cf256a56d7d7e6f2ce6f5b0e539ff6e804de5b2e242a135de0cd7d86f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mvt_parser-0.1.1.tar.gz:

Publisher: publish.yml on noredgaras/mvt_parser_lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mvt_parser-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mvt_parser-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mvt_parser-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27fecdd218a0ccae544fc991fe6191792484f813cd6b0807aec430970a1416b4
MD5 3d567125608305b363950318790ca7a6
BLAKE2b-256 f636e800531850e9acb1e1ebfb111a8197bc98e7cdc12ffb6b7ca6ee4edbc266

See more details on using hashes here.

Provenance

The following attestation bundles were made for mvt_parser-0.1.1-py3-none-any.whl:

Publisher: publish.yml on noredgaras/mvt_parser_lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page