Skip to content

feat: Input Schema - #207

Merged
jangevaare merged 6 commits into
mainfrom
feat/input-schema
Sep 2, 2026
Merged

feat: Input Schema#207
jangevaare merged 6 commits into
mainfrom
feat/input-schema

Conversation

@TiaTuinstra

@TiaTuinstra TiaTuinstra commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Switching from input dataframe normalization / fuzzy matching of columns to enforced frictionless schema.

Expects immunization database report column names in input_schema.yaml - then maps to internal values.

Comment thread config/input_schema.yaml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we snake_case-ify like standards in other pipelines?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Went with yaml because the internet suggested it was a little more human readable - so though it might be nicer for other PHUs looking to user our code; but can switch it to json to match our existing pipeline schemas!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I thought frictionless tabular schema was officially only a JSON spec https://specs.frictionlessdata.io/table-schema/#language

I agree it's quite readable

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeahh you're right though, I'll change it - readability argument is weak since non-developers probably wouldn't be editing a schema file anyway, and using proper frictionless descriptor makes other tooling we decide to implement straightforward (thanks for the review btw!!)

Comment thread docs/user_guide/getting_started.md Outdated
| `Client Id` | 10-digit numeric string |
| `First Name` | |
| `Last Name` | |
| `Age` | Integer |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should work to also refine and minimize this set... Age and Birth Year are best as derived in pipeline as needed rather than relied upon from input data.

Comment thread docs/user_guide/getting_started.md Outdated
| `Board Name` |
| `Board Id` |
| `School Id` |
| `Unique Id` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is different from client ID?

@TiaTuinstra TiaTuinstra Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In test sets contains 'SCHOOL NAME - PHIX ID' - perhaps a relic of earlier report formats. This is the structure we currently expect from SCHOOL_NAME column in new reports; will remove 'Unique Id' from expected list and test set to reflect new standards


The following columns are **optional** and will be used when present:

| Column name |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Support optional "version" identifier (e.g. for multi-language support, A/B tests, etc)

Comment thread docs/user_guide/getting_started.md Outdated

| Column name | Notes |
|---|---|
| `School Type` | |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see in test fixtures this included "catholic". I would've expected this was secondary/elementary. Is it also possible however, that type is maintained in our look up table from #194 or perhaps isn't needed at all - and simply any dynamics around separate notices for elementary vs secondary is dealt with via the optional, more generic version code approach (see other comment on optional fields)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In current code, school type column is never actually used - templates pass hard-coded values to conf.typ for info box; in the interest of min required cols, this could be easily handled as template/version specific

@jangevaare jangevaare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Couple early comments!

Comment thread README.md
@@ -249,6 +249,7 @@ uv run pytest -m "not e2e"
- Use data extracts from [Panorama PEAR](https://accessonehealth.ca/)
- Place input files in the `input/` subfolder (not tracked by Git)
- Files must be `.xlsx` format with a **single worksheet** per file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason that we want .xlsx over .csv? .xlsx can do some weird things with dates/formatting we may like to avoid dealing with at all, and incurs some xlsx handling dependencies. Perhaps this is a PEAR thing though - if more rows can be exported at a time in xlsx format vs csv?

I believe with PEAR you can export the report template definitions/schema which we could include in this repo once revised (in addition for PHU users to access the template from our collaboration folder in PEAR)

Comment thread docs/user_guide/getting_started.md Outdated
| `School Id` |
| `Unique Id` |

The full schema is defined in `config/input_schema.yaml`. If the file is missing any required column, the pipeline will stop immediately with a clear error message listing the missing columns.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another idea on this... I am imagining that it's going to come up a lot where we want to list a schema in a user friendly way in documentation, that is also coded in the frictionless JSON and that this will create an opportunity for drift between documentation and implementation. Should we consider (perhaps separate of this PR, or even this project), a tool that will enable us to have an approachable display method in mkdocs for our various schemas?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Current approach: uv run python docs/generate_schema_docs.py run before mkdocs build in docs.yml. Could add a more standardized generate_schema_docs.py file to our template repo to keep consistent across our projects

…ower_snake_case; adding generated schema .md to docs; support for optional 'version_id column'
@TiaTuinstra TiaTuinstra linked an issue Aug 25, 2026 that may be closed by this pull request
@jangevaare jangevaare changed the title feat: Switch from fuzzy matching and data normalization of input file… feat: Input Schema Sep 2, 2026
@jangevaare
jangevaare merged commit 0f1155f into main Sep 2, 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.

Frictionless schema

2 participants