refactor: extract deterministic FHIR reference helper#553
Open
prakashiitp wants to merge 2 commits into
Open
Conversation
Author
|
Implemented the requested changes for #544 and opened this PR. All tests are passing locally ( Please let me know if any further changes are needed. Thank you for your review! |
maziyarpanahi
approved these changes
Jun 22, 2026
maziyarpanahi
left a comment
Owner
There was a problem hiding this comment.
Thank you @prakashiitp. I reviewed this against #544 / OM-359 and added one maintainer follow-up commit: test: pin deterministic FHIR fullUrl contract.
What I changed:
- re-exported
deterministic_fullurlfromopenmed.clinical.exporters.fhirso exporters have a stable public import path; - added a module-level contract to
openmed/clinical/exporters/fhir/references.pyexplaining that helper-generatedurn:uuidreferences survive Bundle assembly; - pinned the legacy UUID seed with an exact expected
urn:uuidregression; - added an exact Bundle-output regression covering deterministic fullUrls and literal
ResourceType/idreference rewriting; - let Ruff clean up formatting in the touched FHIR files.
Verification on the current PR checkout:
PYTHONPATH=/private/tmp/openmed-pr-553 /Users/maziyar/Developer/openmed/.venv/bin/python -m pytest tests/unit/clinical/test_fhir_references.py tests/unit/clinical/test_fhir_bundle.py -q-> 17 passed/Users/maziyar/Developer/openmed/.venv/bin/ruff check openmed/clinical/exporters/fhir/__init__.py openmed/clinical/exporters/fhir/references.py openmed/clinical/exporters/fhir/bundle.py tests/unit/clinical/test_fhir_references.py-> passed/Users/maziyar/Developer/openmed/.venv/bin/ruff format --check openmed/clinical/exporters/fhir/__init__.py openmed/clinical/exporters/fhir/references.py openmed/clinical/exporters/fhir/bundle.py tests/unit/clinical/test_fhir_references.py-> passed
I also copied the labels from #544 onto the PR. The branch is mergeable with no conflicts; GitHub has not attached hosted checks to the new head commit yet, so I verified the touched behavior locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request
Description
This PR extracts the deterministic
urn:uuidgeneration logic from the FHIR Bundle assembler into a reusable helper so exporters can pre-compute stable cross-resource references before Bundle assembly.Type of Change
Changes Made
deterministic_fullurl()helper inopenmed.clinical.exporters.fhir.referencesTesting
Validation:
Result:
Documentation
Code Quality
Dependencies
Checklist
Related Issues
Closes #544
Screenshots/Examples
N/A