Skip to content

feat: select departure and arrivial runways as part of a flight and fetch from flightdatabox#675

Closed
mhlas7 wants to merge 16 commits into
johanohly:mainfrom
mhlas7:runways
Closed

feat: select departure and arrivial runways as part of a flight and fetch from flightdatabox#675
mhlas7 wants to merge 16 commits into
johanohly:mainfrom
mhlas7:runways

Conversation

@mhlas7

@mhlas7 mhlas7 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

#648

@johanohly sorry about all of the PR's from me lately. I have a few weeks off between jobs and a bunch of ideas for AirTrail!

Changes

  • Added a new database table to store runways referenced by the airport id
  • On first start and manual airport refresh, pull the airports csv from OurAirports and populate the runways table
  • Add runway selection modal to add route and edit route. The dropdown shows a filtered list of applicable list of runways for the arrival or departure airport.
  • Added hooks to grab arrival and departure runways from AeroDataBox (lots of flights don't have runway data from AeroDataBox)

Screenshots

New button in the route add and edit modal

image

The runways modal with runways selected

image

Runways modal with the list of filtered runways for KSEA

image

When no airports are selected, a status message shows

image

Note

Add departure and arrival runway selection to flights with data sourced from OurAirports and AeroDataBox

  • Adds a runway table and links flights to specific runways and runway ends via new nullable foreign key columns, with referential integrity enforced by the database.
  • Introduces a new FlightRunwayModal component in the add/edit flight forms, letting users select departure and arrival runway ends based on the flight's chosen airports.
  • Populates and syncs runway data from OurAirports CSV on startup and via the admin "Update from Source" action, which now returns separate stats for airports and runways.
  • Resolves runway idents returned by AeroDataBox flight lookups to internal runway IDs and auto-populates them into the flight form.
  • Server-side flight save validates that selected runways belong to the correct airport and that the selected end exists on that runway.
  • Risk: runway data population now runs at server startup; failures are caught and logged rather than crashing the server, so missing runway data will not surface until the update is retried.

Macroscope summarized 9faddba.

@github-actions github-actions Bot added the Web label Jul 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Label error. Requires exactly 1 of: changelog:.*. Found: Web

Comment thread src/lib/components/modals/flight-form/FlightRunwayModal.svelte
Comment thread src/lib/server/utils/flight.ts
Comment thread src/hooks.server.ts Outdated
Comment thread src/lib/utils/data/airports/runways.ts
Comment thread src/lib/utils/data/airports/source.ts Outdated
@JackyHe398

Copy link
Copy Markdown

Will it be better to allow user to input runway other than the provided options for some exceptional case (e.g. database outdated). Also a manual input allowed without input airport may also be considerable for a higher flexibility. There's no (or not too many) harm to allow user doing this.

Comment thread src/lib/components/modals/flight-form/FlightRunwayModal.svelte
mhlas7 and others added 2 commits July 18, 2026 16:58
…nways keep their previous values

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
@achatman

Copy link
Copy Markdown
Contributor

Rather than adding a dedicated modal for this, it might make sense to add to the existing Terminal & Gate modal. All three fields are about the airports, so a new title could be "Additional Airport Information" or something along those lines. Maybe just "Airport Details" would be enough.

@mhlas7

mhlas7 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Will it be better to allow user to input runway other than the provided options for some exceptional case (e.g. database outdated). Also a manual input allowed without input airport may also be considerable for a higher flexibility. There's no (or not too many) harm to allow user doing this.

The best way to implement custom runways would be to do that through the custom airports modal in settings. I'll experiment with that although it may come out in a separate PR.

@mhlas7

mhlas7 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Rather than adding a dedicated modal for this, it might make sense to add to the existing Terminal & Gate modal. All three fields are about the airports, so a new title could be "Additional Airport Information" or something along those lines. Maybe just "Airport Details" would be enough.

Personally I like having a dedicated modal for this but I can see the benefit of consolidating. Ultimately, this decision would be up to @johanohly.

@JackyHe398

Copy link
Copy Markdown

Will it be better to allow user to input runway other than the provided options for some exceptional case (e.g. database outdated). Also a manual input allowed without input airport may also be considerable for a higher flexibility. There's no (or not too many) harm to allow user doing this.

The best way to implement custom runways would be to do that through the custom airports modal in settings. I'll experiment with that although it may come out in a separate PR.

I am worrying there might be ppl know which runway they are using but don’t know the airport. I have a similar issue when dealing with my.flightradar24 but luckily they don’t have limitation on that two specific field (I forgot what they were). That’s why partially decomposing airport and runway (allow customize when airport omitted, or even when provided) can be a considerable idea.

@mhlas7

mhlas7 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Will it be better to allow user to input runway other than the provided options for some exceptional case (e.g. database outdated). Also a manual input allowed without input airport may also be considerable for a higher flexibility. There's no (or not too many) harm to allow user doing this.

The best way to implement custom runways would be to do that through the custom airports modal in settings. I'll experiment with that although it may come out in a separate PR.

I am worrying there might be ppl know which runway they are using but don’t know the airport. I have a similar issue when dealing with my.flightradar24 but luckily they don’t have limitation on that two specific field (I forgot what they were). That’s why partially decomposing airport and runway (allow customize when airport omitted, or even when provided) can be a considerable idea.

The origin and destination airports are required fields in AirTrail so it is not possible to add a flight to AirTrail that only has runway numbers.

@sonarqubecloud

Copy link
Copy Markdown

@johanohly

Copy link
Copy Markdown
Owner

First off, no need to apologize for the PRs. I do appreciate you taking the initiative!
I've now looked through this properly. I like the idea of storing runway information, but I don't think I want to merge it in this form. The database space itself is not as bad as I initially assumed, but maintaining a global runway table adds quite a lot of sync and data lifecycle complexity for two fairly niche flight fields.
I also don't think flights should reference the current runway database by internal ID. That makes backups less portable, and historical flights could change when a runway is renamed or renumbered in the source data. Missing, outdated, and custom airports also need a manual fallback.
If AirTrail gets built-in runway fields, I think they should probably just be plain text fields stored directly on the flight. AeroDataBox could still fill them automatically, and users could enter or correct them manually. The automatic lookup would then be the main advantage over advising users to add runway information as custom fields.
Given that this would require a fairly fundamental rewrite, I'd prefer to close this PR rather than ask you to keep iterating on the current approach. Sorry, especially after the amount of work you've put into it, and thank you again for the contribution.

@mhlas7
mhlas7 marked this pull request as draft July 19, 2026 21:06
@mhlas7

mhlas7 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Understood. I have a few ideas how we could do this differently. I'll turn this into a draft and put together a design for your feedback!

@mhlas7 mhlas7 closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants