tidal is software that pulls data from various sources and renders the data on a Raspberry Pi - driven display. The impetus for creating this project was to have the ability to see the tide levels at a glance to help facilitate activity on our local bay; kayaking, swimming, fishing, etc.
There are three sources of data for tidal:
- Lunar Data: lunar library
- Tide Data: NOAA Tide Data API
- Weather Data: National Weather Service API
Each source has an associated *Retriever class that connects to the service to gather the data for its respective data.
This is a library that calculates the phase of the moon based on historically known locations. Given a Julian Date the library returns a data structure with this shape:
struct Phase {
int julianDay;
double sunPosition;
double moonPosition;
double visible;
Segment segment;
};This is a web service provided by the National Oceanic and Atmospheric Administration. Details of the JSON format / content returned from the service can be found in the api documentation.
A sample of the data can be found in the docs directory.
This is a web service provided by the National Weather Service. Details of the JSON format / content returned from the service can be found in the api documentation.
A sample of the data can be found in the docs directory.
The data from the different sources is disparate enough that a transformation step is needed to alter the shape of the to make rendering the data easier. The classes that represent the data internally to tidal follow this model:
The primary motivation for this data model is to shape the data into a form that allows tidal to show the data for a given day. The DisplayManager should not have the responsibility of correlating data from across the different data sources. That correlation should be the responsibility of a focused class, the Predictions class.
As noted above, each data source has an associated *Retriever class that handles communication with the associated service.
These Retrievers are currently managed by the Application class. As part of the data refactoring project this logic will be moved into the Predictions class. The Predictions class will be responsible for taking the data retrieved from each source and combining it into a DisplayData instance. The DisplayData instance will then be handed off to the DisplayManager for rendering.
The following diagram shows the high-level logic flow.