Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I have been noticing missing data labels on the landing pages. See below:

**Expected: **

Changes
The issue is that the labels for the chart were naively generated under the assumption that all weeks would have data for every line (my fault, I wrote this code). So it only looks at red line data to generate the data labels.
So it looks at the return trip_metrics json file and uses that to generate the labels. see here: https://dashboard.transitmatters.org/static/landing/trip_metrics.json
Currently, there was no data for the week 2024-11-18 in the dataset for the red line (another possible fix would be to generate empty data for weekly aggregates rather than exclude the data).
This caused the labels for the data to be misaligned and causes issues not only with the missing labels, but also all of the datasets were aligned on the dates present on the red line, and gaps weren't appearing in the proper locations.
Upon further review I am pretty sure this issue stems from weekly red line data being missing. I see that for the green line, weeks with no data generate entries with values of
0
but not for the red line.I tried to take a look at this but couldn't find my AWS credentials. Maybe another day.
Regardless, this change is probably good to have.
Testing Instructions
Verify that the results on each of the landing page charts aligns with the expected data from this endpoint: https://dashboard.transitmatters.org/static/landing/trip_metrics.json
You can also compare the dataset to the existing landing page charts and see there are errors. For example, there is data for 11/18/2024 for the green line in the dataset, but the production site does not show it.