Conversation
* rmv ds_store * updated eval cohort ppkts * fixed camelCase in write ppkts * issue 205, imrpove ppkts export pipeline, validation, fixed bug * clean up code * clean up * updated rarelink figure in docs * added variantValidator for manual hgvs curation * added phenopacket adapters to docs * updated index figure subheading * added ontology_routing adapter * test for adapter * updated phenopackets export adn validation with new functions and cli overview * added chaching * updated toml to 2.0.6 and clean up * updated codes according to rd-cdmv2.0.3 (specifically update of sex of birth to loinc_76689_9 in all files) and version updates * improved warnings output for pptks pipeline * removed rd-cdm in this version as it was unused * improved caching ppkts for label fetching util * grouped linkml validate data function * fixed updaet in kafka docker versioning to tofhir pipeline * improved packaging and readme * updated phenopackets tests * updated versions according to rd-cdm 2.0.3 * improved installation docs with updates * improved pytest * added changelog for v2.0.6 * updated eval cohort
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Implement insert_medical_procedure ap
There was a problem hiding this comment.
Pull request overview
Release v2.0.6 updates RareLink to RD-CDM v2.0.3, refreshes CDM field identifiers (Sex at Birth → LOINC 76689-9), and improves the Phenopacket export pipeline with routing + validation.
Changes:
- Replace the Personal Information “Sex at birth” field identifier from
snomedct_281053000toloinc_76689_9across schemas, mappings, fixtures, and tests. - Enhance Phenopacket export: camelCase JSON output, structured pipeline result reporting, write-time validation, and new ontology routing adapter with tests.
- Restructure packaging/dependencies for extras and remove unused RD-CDM codegen/sync modules and related tests.
Reviewed changes
Copilot reviewed 85 out of 95 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/test_processor.py | Updates test mapping/config keys for Sex at birth to LOINC field id. |
| tests/rd_cdm/test_scaffold_and_force.py | Removes RD-CDM scaffold/force tests along with removed generator code. |
| tests/rd_cdm/test_normalize_and_build_schema.py | Removes CSV version rewrite tests (code removed). |
| tests/rd_cdm/test_ensure_types_and_codegen.py | Removes LinkML codegen test (code removed). |
| tests/rd_cdm/test_csv_update.py | Removes duplicate CSV update tests (code removed). |
| tests/phenopackets/test_pipeline.py | Updates tests to new PipelineResult and correct patch paths. |
| tests/phenopackets/test_data/sample_records_rarelink_cdm_1.json | Updates sample record Sex at birth key to loinc_76689_9. |
| tests/phenopackets/test_data/sample_records_rarelink_cdm.json | Updates sample record Sex at birth key to loinc_76689_9. |
| tests/phenopackets/adapter/test_ontology_routing_adapter.py | Adds tests for new ontology routing adapter behavior. |
| submodules/tofhir | Removes tofhir git submodule pointer. |
| src/rarelink/utils/label_fetching.py | Adds caching for BioPortal label lookup. |
| src/rarelink/tofhir/schemas/Rarelink_2_personal_information.json | Updates Sex at birth element id/path to LOINC field id. |
| src/rarelink/tofhir/mappings/ips.patient.json | Updates toFHIR mapping references to LOINC field id. |
| src/rarelink/tofhir/docker-compose.yml | Pins Kafka to bitnamilegacy/kafka:3.7.0. |
| src/rarelink/rd_cdm/sync.py | Removes unused RD-CDM sync + generation script. |
| src/rarelink/rd_cdm/schema_template.py | Removes unused LinkML schema template helper. |
| src/rarelink/rd_cdm/codegen_cli.py | Removes unused codegen CLI entrypoint. |
| src/rarelink/rd_cdm/codegen.py | Removes unused RD-CDM codegen logic. |
| src/rarelink/rd_cdm/cli.py | Removes unused RD-CDM CLI wrapper. |
| src/rarelink/rd_cdm/init.py | Removes empty __all__. |
| src/rarelink/rarelink_cdm/schema_definitions/rarelink_code_systems.yaml | Updates code system versions for the release. |
| src/rarelink/rarelink_cdm/schema_definitions/rarelink_6_4_family_history.yaml | Adjusts Sex at birth meaning metadata (now LOINC-coded in diff). |
| src/rarelink/rarelink_cdm/schema_definitions/rarelink_2_personal_information.yaml | Renames Sex at birth slot to loinc_76689_9 and updates enum meaning metadata. |
| src/rarelink/rarelink_cdm/rarelink_cdm_datadictionary - v2_0_5.csv | Updates REDCap data dictionary variable name/id for Sex at birth. |
| src/rarelink/rarelink_cdm/python_datamodel/rarelink_code_systems.py | Regenerates code systems datamodel with updated versions/imports. |
| src/rarelink/rarelink_cdm/python_datamodel/rarelink_cdm.py | Updates datamodel attribute/slot name for Sex at birth to loinc_76689_9. |
| src/rarelink/rarelink_cdm/python_datamodel/rarelink_2_personal_information.py | Updates module datamodel attribute/slot name for Sex at birth to loinc_76689_9. |
| src/rarelink/rarelink_cdm/mappings/redcap/template.json | Updates REDCap mapping template key to loinc_76689_9. |
| src/rarelink/rarelink_cdm/mappings/redcap/map_2_personal_information.py | Updates field mappings to loinc_76689_9. |
| src/rarelink/rarelink_cdm/mappings/phenopackets/resources.py | Updates code system version constants used in phenopacket metadata/resources. |
| src/rarelink/rarelink_cdm/mappings/phenopackets/individual.py | Updates phenopacket “sex_field” mapping to LOINC field id. |
| src/rarelink/phenopackets/write.py | Switches JSON serialization to camelCase and adds optional validation callbacks. |
| src/rarelink/phenopackets/validate.py | Adds Python-native validation + prefix-placement warnings + optional CLI stage. |
| src/rarelink/phenopackets/pipeline.py | Introduces PipelineResult, adds callbacks, captures warnings, writes failure/warning reports. |
| src/rarelink/phenopackets/mappings/variation_descriptor_mapper.py | Emits mapper issues via warnings.warn() for pipeline capture. |
| src/rarelink/phenopackets/mappings/phenotypic_feature_mapper.py | Emits mapper issues via warnings.warn(). |
| src/rarelink/phenopackets/mappings/metadata_mapper.py | Emits CodeSystemsContainer autoload failures via warnings.warn(). |
| src/rarelink/phenopackets/mappings/medical_action_mapper.py | Emits mapper issues via warnings.warn(). |
| src/rarelink/phenopackets/mappings/measurement_mapper.py | Emits parsing issues via warnings.warn(). |
| src/rarelink/phenopackets/mappings/interpretation_mapper.py | Emits mapper issues via warnings.warn(). |
| src/rarelink/phenopackets/mappings/base_mapper.py | Cleans up comments and keeps mapping behavior stable. |
| src/rarelink/phenopackets/adapter/ontology_routing_adapter.py | Adds ontology routing adapter + prefix placement checker. |
| src/rarelink/phenopackets/adapter/multi_onset.py | Minor comment cleanup in existing adapter. |
| src/rarelink/phenopackets/adapter/init.py | Exposes new routing adapter APIs. |
| src/rarelink/cli/redcap/upload_records.py | Imports validate_linkml_data directly (removes lazy wrapper). |
| src/rarelink/cli/redcap/download_records.py | Imports validate_linkml_data directly (removes lazy wrapper). |
| res/evaluation_cohort/redcap/evaluation_cohort_rarelink-cdm-linkml.json | Updates cohort fixture Sex at birth keys to loinc_76689_9. |
| res/evaluation_cohort/phenopackets/failures.json | Removes obsolete failures report fixture. |
| res/evaluation_cohort/phenopackets/1.json | Updates example phenopacket JSON to camelCase output and new content. |
| res/evaluation_cohort/phenopackets/2.json | Updates example phenopacket JSON to camelCase output and version resources. |
| res/evaluation_cohort/phenopackets/3.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/4.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/5.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/6.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/7.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/8.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/9.json | Updates example phenopacket JSON to camelCase output. |
| res/evaluation_cohort/phenopackets/10.json | Updates example phenopacket JSON to camelCase output. |
| pytest.ini | Ignores UserWarning from phenopacket mappers in test output. |
| pyproject.toml | Bumps project version, trims core deps, adds extras, updates package data inclusion. |
| docs/index.rst | Updates overview text and section links. |
| docs/conf.py | Removes numpy/pandas intersphinx/doctest setup and simplifies mapping. |
| docs/_static/res/import_mapper_tsvs/rarelink_cdm_sssom_template.tsv | Updates Sex at birth predicate to loinc_76689_9. |
| docs/_static/res/import_mapper_tsvs/example_1_sssom.tsv | Updates Sex at birth predicate/object examples. |
| docs/_static/rarelink_cdm_datadictionary - v2_0_5.csv | Updates embedded data dictionary Sex at birth variable text/id. |
| docs/_build/html/_static/res/import_mapper_tsvs/rarelink_cdm_sssom_template.tsv | Updates built-doc artifact template TSV. |
| docs/_build/html/_static/res/import_mapper_tsvs/example_1_sssom.tsv | Updates built-doc artifact example TSV. |
| docs/_build/html/_static/rarelink_cdm_datadictionary - v2_0_5.csv | Updates built-doc artifact data dictionary CSV. |
| docs/_build/html/_sources/4_user_guide/4_2_import_mapper.rst.txt | Updates built-doc artifact import mapper text. |
| docs/_build/html/_sources/2_rarelink_framework/2_2_rarelink_cdm.rst.txt | Updates built-doc artifact CDM text. |
| docs/_build/html/_downloads/951a4999946d3dff534dce54032556ef/rarelink_cdm_datadictionary - v2_0_5.csv | Updates built-doc artifact downloadable CSV. |
| docs/_build/html/4_user_guide/4_2_import_mapper.html | Updates built-doc artifact import mapper HTML. |
| docs/_build/html/2_rarelink_framework/2_2_rarelink_cdm.html | Updates built-doc artifact CDM HTML link/field references. |
| docs/6_changelog.rst | Adds v2.0.6 changelog entry and release notes. |
| docs/4_user_guide/4_3_phenopackets.rst | Adds adapter documentation and updates TOC structure. |
| docs/4_user_guide/4_2_import_mapper.rst | Updates Sex at birth predicate/object examples. |
| docs/4_user_guide/4_1_manual_data_capture.rst | Updates mutation validation guidance links. |
| docs/3_installation/3_1_setup_rarelink_framework.rst | Updates install instructions for extras/dev workflow. |
| docs/2_rarelink_framework/2_2_rarelink_cdm.rst | Updates Sex at birth field reference to loinc_76689_9. |
| docs/2_rarelink_framework/2_1_rarelink_overview.rst | Switches overview figure to PNG and updates descriptive text. |
| README.md | Updates installation instructions and marks RD-CDM version badge to 2.0.3. |
| .gitignore | Adds .DS_Store patterns and ignores dev/. |
Comments suppressed due to low confidence (10)
src/rarelink/phenopackets/validate.py:1
sys.exit()is called butsysis not imported anywhere in this module, which will raiseNameErrorwhen runningpython -m rarelink.phenopackets.validate ...or executing this file directly. Importsysat module level (near the other imports).
src/rarelink/rarelink_cdm/schema_definitions/rarelink_2_personal_information.yaml:1- The
meaningfor permissible valuesnomedct_248152002(Female) has been changed toLOINC:76689-9, which is the Sex assigned at birth observation/field concept, not the code meaning “Female”. The permissible value meanings should remain the SNOMED CT concept identifiers (e.g.,SNOMEDCT:248152002) while only the field/slot id changes toloinc_76689_9.
src/rarelink/rarelink_cdm/schema_definitions/rarelink_6_4_family_history.yaml:1 - Same issue as in Personal Information:
LOINC:76689-9is not the meaning of “Female”. Keep permissible value meanings aligned to the actual value set codes (likely SNOMED CT), and only update the data element id / slot name toloinc_76689_9.
src/rarelink/tofhir/mappings/ips.patient.json:1 - This mapping switches the source field to
loinc_76689_9but still hardcodes SNOMED CT system/version and SNOMED code281053000in thecodeDefinitionextension. If the data element is now defined by LOINC 76689-9, thecodeDefinition(system/code/display) should be updated to LOINC (e.g.,http://loinc.org+76689-9) to avoid emitting inconsistent metadata.
src/rarelink/tofhir/mappings/ips.patient.json:1 - This mapping switches the source field to
loinc_76689_9but still hardcodes SNOMED CT system/version and SNOMED code281053000in thecodeDefinitionextension. If the data element is now defined by LOINC 76689-9, thecodeDefinition(system/code/display) should be updated to LOINC (e.g.,http://loinc.org+76689-9) to avoid emitting inconsistent metadata.
src/rarelink/phenopackets/pipeline.py:1 - The docstring specifies
progress_callback: callable(record_id, success, error), but the implementation calls it with keyword arguments (success=...,error=...). Callbacks implemented as simple positional-only callables (orlambda rid, ok, err: ...) may break if they don’t accept these keywords. Prefer calling with positional arguments (or update the documented callback contract/type hints to explicitly require these keyword names).
src/rarelink/phenopackets/pipeline.py:1 - The docstring specifies
progress_callback: callable(record_id, success, error), but the implementation calls it with keyword arguments (success=...,error=...). Callbacks implemented as simple positional-only callables (orlambda rid, ok, err: ...) may break if they don’t accept these keywords. Prefer calling with positional arguments (or update the documented callback contract/type hints to explicitly require these keyword names).
src/rarelink/phenopackets/write.py:1 - File output should specify an explicit encoding (typically UTF-8) to avoid platform-dependent defaults and ensure consistent JSON output across environments. Open the file with
encoding=\"utf-8\".
src/rarelink/phenopackets/adapter/ontology_routing_adapter.py:1 _PREFIX_REis defined but not used anywhere in this module (prefix parsing is handled byprocess_code()and string splitting). Remove it to reduce dead code, or use it consistently in_get_prefix()if regex-based parsing is intended.
src/rarelink/phenopackets/validate.py:1- New validation behavior is introduced (structural checks, CURIE checks, optional CLI invocation). There’s existing phenopackets test coverage in
tests/phenopackets/, but no tests are added here forvalidate_phenopackets()/_python_validate()outcomes (e.g., missingmetaDatakeys, bad CURIE formats, and the branch wherephenopacket-toolsis not present). Add unit tests to lock down these rules and avoid regressions in what is considered a validation failure vs warning.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.