EarthRanger Architecture¶
Observations¶
SubjectStatus¶
The SubjectStatus record for a Subject holds the latest movement and status of the radio that subject is assigned.
Real-time Updates¶
When a new Observation is added to the database, the following process occurs:
Identify the Source of the new Observation
Find the Subject that has this Source assigned during the Observation’s
recorded_at
time by checking theSubjectSource.assigned_range
Verify that the identified SubjectSource is the active record for the Subject during that time period
Confirm this Observation is the most recent one by:
Searching the Observation table for this Source within the assigned_range. We want the most recent in the assigned_range for this Source
If the Observation’s Source is currently assigned to the subject, we can optimize this search by getting the Observation from the LatestObservationSource table.
Update the Subject’s SubjectStatus record with the new Observation data
Daily Maintenance¶
A nightly job runs to ensure SubjectStatus records remain accurate. For each Subject:
Iterate through the Subject’s assigned SubjectSource records, ordered by descending
assigned_range
Find the most recent non-excluded Observation for each Source
Update the SubjectStatus record with the most recent valid Observation
Typically found within the current SubjectSource assigned_range
May require checking previous assigned_range windows if no recent Observation exists