Current unfinished work on Airport Delays

This commit is contained in:
PicelBoi committed 2026-01-02 17:24:03 -05:00
1 parent 1af061edd0
commit a3edae975b
3 files changed
+60

No files matched your search

@@ -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<List<GenericResponse<AirportDelaysResponse>>> Populate(string[] locations)
{
return await GetJsonData<AirportDelaysResponse>(locations);
}
}
@@ -0,0 +1,32 @@
using MistWX_i2Me.API;
using MistWX_i2Me.Schema.ibm;
namespace MistWX_i2Me.RecordGeneration;
public class AirportDelaysRecord : I2Record
{
public async Task<string> MakeRecord(List<GenericResponse<AirQualityResponse>> results)
{
Log.Info("Creating Air Quality Record");
string recordPath = Path.Combine(AppContext.BaseDirectory, "temp", "AirQuality.xml");
string recordScript = "<Data type=\"AirQuality\">";
foreach (var result in results)
{
if (String.IsNullOrEmpty(result.Location.epaId))
{
continue;
}
recordScript +=
$"<AirQuality id=\"000000000\" locationKey=\"{result.Location.epaId}\" isWxScan=\"0\">" +
$"{result.RawResponse}<clientKey>{result.Location.epaId}</clientKey></AirQuality>";
}
recordScript += "</Data>";
File.WriteAllText(recordPath, ValidateXml(recordScript));
return recordPath;
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace MistWX_i2Me.Schema.faa;
public class AirportEvent
{
public string almanacInterval { get; set; }
}
public class AirportEventsResponse
{
public List<AirportEvent> almanacInterval { get; set; }
}