Skip to content

Use YYYY-MM strings for prevalence dates - #7

Merged
david-mears-2 merged 17 commits into
mainfrom
copilot/poc-with-tests
Sep 30, 2026
Merged

david-mears-2 merged 17 commits into
mainfrom
copilot/poc-with-tests

Conversation

Copilot AI commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Model outputs (and hence prevalence responses) now represent monthly dates as YYYY-MM strings, to avoid the implication that the monthly prevalence applies to any particular day such as the 1st, and to free up the modelling team to aggregate monthly prevalence in any way they like (the implementation could vary by model release).

AI use

As you can see in the commit history, Copilot did the first draft which I then tidied up.

Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
@david-mears-2

Copy link
Copy Markdown
Contributor

Verified that running the ./scripts/create_example_model_outputs.R and npm run generate-test-fixtures didn't result in a diff against this branch

Comment thread src/utils/validators.ts Outdated
Comment thread tests/unit/validators.test.ts
Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
Copilot AI and others added 3 commits September 11, 2026 16:28
Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
@david-mears-2
david-mears-2 marked this pull request as ready for review September 18, 2026 16:28
david-mears-2

This comment was marked as resolved.

@david-mears-2 david-mears-2 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no way to dismiss my 'requested changes' other than to approve my own PR

Comment thread src/utils/validators.ts Outdated
const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
const dateRegexes: Record<DateFormat, RegExp> = {
"YYYY-MM": /^\d{4}-(0[1-9]|1[0-2])$/,
"YYYY-MM-DD": /^\d{4}-\d{2}-\d{2}$/,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you, but you could be as detailed on the month (and day!) regex for the daily format as for the monthly.

Comment thread src/utils/validators.ts Outdated
};

export const validateDateParams = (req: Request, res: Response): boolean => {
console.log("path:", req.path);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rogue debug?

Comment thread src/utils/metadata.ts
STRFTIME(MIN("date"), '%Y-%m-%d') AS min_date,
STRFTIME(MAX("date"), '%Y-%m-%d') AS max_date
MIN("date") AS min_date,
MAX("date") AS max_date

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you don't need to format the dates from the db here because they're now month strings rather than dates?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

Base automatically changed from poc-with-tests to main September 28, 2026 17:27
@david-mears-2
david-mears-2 merged commit 9c5b620 into main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants