Skip to content

[Spike] Logic to update the Seal of Reliability #1761

Description

@Alessandro100

Write a shared function that would update the feed.seal_of_reliability property. With tests

Current Logic (As of 2026-07-27)

Official:

  • Official at time of reviewing dataset. Does not require a 6 month check.
  • Calculation: is_official = true

Stable:

  • dataset created_at has to be six months or longer in the past AND it is_producer_unstable = null/false.

Available:

  • Successfully returned a response for 6 months. No 15 subsequent days within this period of outages.
  • Calculation: Every day, look back 6 months (or as long as we have availability data) and check that there are no 15 subsequent days of outage. Success = returned a response in the HTTP 200s. [From pre-existing availability table]
  • Grace period: 14 days. So if a feed fails to return a successful response, they have 14 days to fix the problem before disqualification.

Compliant:

  • Returns no validation errors for 6 months.
  • Calculation: 0 errors returned from the validation report. Any validation error that is currently in the feed is less than 30 days old.
  • Grace period: If a validation error is returned, there are 30 days for it to be fixed before it's disqualified.

Fresh: Includes 7 days or more service coverage each day.

  • Calculation: service_end_date extends 7 day or more into the future.
  • Grace period: if service_end_date extends less than 7 days into the future, 14 days to fix it before disqualification.
  • Feeds marked as seasonal should not run this calculation.

Fresh: Has continuous service coverage across subsequent datasets with no coverage gaps.
Calculation: View in-depth calculation here.

For the Fresh-Continuous Coverage, here is the algorithm:

  • If feed date not available
    • If calendar range < 2 years
      • Calendar gap (1 day) - F
        • Calendar no gap - T
      • If calendar range > 2 years - F
    • If feed date available
      • If feed date range < 2 years
        • If feed date no gap
          • Calendar gap - T
        • If feed date gap (any number of days)
          • Calendar gap - F
          • Calendar no gap T
      • If feed date range > 2 years - F
  • Rationale behind 2 years
    • 80% of feeds with feed info file had a date range that covered 2 years or less

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions