From a3edae975beecebacbe151fe4d03655a9eec3ed9 Mon Sep 17 00:00:00 2001 From: PicelBoi Date: Fri, 2 Jan 2026 17:24:03 -0500 Subject: [PATCH] Current unfinished work on Airport Delays --- .../API/Products/AirportDelaysProduct.cs | 18 +++++++++++ MistWX-i2Me/RecordGeneration/AirportDelays.cs | 32 +++++++++++++++++++ MistWX-i2Me/Schema/faa/AirportEvents.cs | 10 ++++++ 3 files changed, 60 insertions(+) create mode 100644 MistWX-i2Me/API/Products/AirportDelaysProduct.cs create mode 100644 MistWX-i2Me/RecordGeneration/AirportDelays.cs create mode 100644 MistWX-i2Me/Schema/faa/AirportEvents.cs diff --git a/MistWX-i2Me/API/Products/AirportDelaysProduct.cs b/MistWX-i2Me/API/Products/AirportDelaysProduct.cs new file mode 100644 index 0000000..18686d8 --- /dev/null +++ b/MistWX-i2Me/API/Products/AirportDelaysProduct.cs @@ -0,0 +1,18 @@ +using MistWX_i2Me.Schema.ibm; + +namespace MistWX_i2Me.API.Products; + +public class AirportDelaysProduct : Base +{ + public AirportDelaysProduct() + { + RecordName = "AirportDelays"; + DataUrl = + "https://nasstatus.faa.gov/api/airport-events"; + } + + public async Task>> Populate(string[] locations) + { + return await GetJsonData(locations); + } +} \ No newline at end of file diff --git a/MistWX-i2Me/RecordGeneration/AirportDelays.cs b/MistWX-i2Me/RecordGeneration/AirportDelays.cs new file mode 100644 index 0000000..b42a957 --- /dev/null +++ b/MistWX-i2Me/RecordGeneration/AirportDelays.cs @@ -0,0 +1,32 @@ +using MistWX_i2Me.API; +using MistWX_i2Me.Schema.ibm; + +namespace MistWX_i2Me.RecordGeneration; + +public class AirportDelaysRecord : I2Record +{ + public async Task MakeRecord(List> results) + { + Log.Info("Creating Air Quality Record"); + string recordPath = Path.Combine(AppContext.BaseDirectory, "temp", "AirQuality.xml"); + string recordScript = ""; + + foreach (var result in results) + { + if (String.IsNullOrEmpty(result.Location.epaId)) + { + continue; + } + + recordScript += + $"" + + $"{result.RawResponse}{result.Location.epaId}"; + } + + recordScript += ""; + + File.WriteAllText(recordPath, ValidateXml(recordScript)); + + return recordPath; + } +} \ No newline at end of file diff --git a/MistWX-i2Me/Schema/faa/AirportEvents.cs b/MistWX-i2Me/Schema/faa/AirportEvents.cs new file mode 100644 index 0000000..fe5dacd --- /dev/null +++ b/MistWX-i2Me/Schema/faa/AirportEvents.cs @@ -0,0 +1,10 @@ +namespace MistWX_i2Me.Schema.faa; + +public class AirportEvent +{ + public string almanacInterval { get; set; } +} +public class AirportEventsResponse +{ + public List almanacInterval { get; set; } +} \ No newline at end of file