feat(transform-csv): add ML to OMOP conversion pipeline with validation #14
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.
SUMMARY
This PR introduces a transformation pipeline that converts ML-format input data (CSV) into standardized OMOP-format CSVs, enabling compatibility with downstream clinical data analytics tools.
Key features:
convert.pyscript that readsdata.csvand generates four OMOP-compliant files:person.csv,measurement.csv,observation.csv, andvisit_occurrence.csv.verification.py, a lightweight validation script to check primary key uniqueness and referential integrity across all output files.add_or_update()with PostgreSQL'sON CONFLICT, session commits).TEST PLAN
✅ Ran
convert.pylocally on a sampledata.csv, verified correct file generation and row counts.✅ Verified content and structure of all four OMOP output files (
.csv) via manual inspection and sample slicing.✅ Executed
verification.pyto validate:✅ Confirmed that new logic in
analytics_repository.pyandanswer_repository.pypreserves data as expected across repeated API invocations (tested with mocked sessions and live PostgreSQL).✅ All modified services and repository functions were manually tested for correctness, including access control checks and commit persistence.
Pre-merge author checklist
I've clearly explained:
I've included tests I've run to ensure my changes work.
I've added unit tests for any new code, if applicable.
I've documented any added code.