mirror of
https://github.com/MistWeatherMedia/i2ME.git
synced 2026-11-28 14:20:00 -08:00
Current unfinished work on Airport Delays
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
Reference in new issue
Block a user