The project is divided into 3 main parts:
The program that runs indefinitely, periodically fetching data from DKSR, converting this to FrostApi format and adding or updating the Frost data.
the importers should implement the abstract Importer
class.
each importer also passes 2 strings to the Importer
class, one for the DataType and one for the DataStreamName.
currently these would be "Tree" & "HealthState" and "ParkingLot" & "Occupancy" respectively.
each importer will then start a timer defining how often it should run.
they first get the DKSR data and for each they will use the GetFrostThingData()
method to see if a thing already exists.
if it does not, they will create it and then call the Update()
method of the Abstract class to handle all the frost data updates.
communication with a Frost Server
this contains response models for the FrostApi endpoints as well as models used for creating new Frost Data.
each new Thing that will be imported a mapper should be added in the mapper class in the Importer project. this mapper should map all the properties that you want to add to the thing.
the Id
property is required and it will fail if it isn't added
Response models from DKSR to use for mapping to FrostApi models
when running the application, multiple importers will start simultaneously. all executing mostly the same code. dataflow is as follows:
Importer -> import() -> get dksr data -> map to frost model -> add/update frost data
adding or updating frost data is done in a particular order
- check if the thing already exists in frost
- if not, add it
- update the thing with new data
- get datastream or create one if it does not exist
- create Location if it does not exist
- add observation to the datastream