Repository navigation
Conversation
…upplement supplements; FHIR CodeSystem carries it - Source gets supplements (a canonical URL, optionally |version), supplement_type and supplement_global (migration 0047, three nullable columns). supplements is required when content_type is supplement (FHIR csd-4) and holds at most one non-empty |version. REST create, update and read, new versions and the bulk importer carry all three. - FHIR CodeSystem read and write carry supplements and the codesystem-supplement-type and codesystem-supplement-global extensions. - A supplement's FHIR read shows its concepts as a code and their names: no display made up from another name, no conceptclass or datatype. Its preferred name in the CodeSystem's language is the display. It stays content supplement past the concept limit, its concepts left out (SUBSETTED). - The FHIR write adds nothing to a supplement's concepts, and a concept with designations but no display loads (data['display'] was read without a check). - /fhir/CodeSystem/ search takes supplements (url matches any version, url|version that one) and content-mode (the content the read shows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTHAarCyLb2cuys8Yd
…; keep a designation with a use Review pass 1 (Codex): - F1.1: a supplement concept with no display and no designation got no name, so OCL's validator dropped it while the write reported success. The write now refuses it (400) before anything is saved. - F1.2: a designation that is also the display is shown as a designation too when it has a use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTHAarCyLb2cuys8Yd
Member
Author
Codex review, pass 1 (codex-cli 0.169.0, commit 0ac202d)Verdict: findings (2 P1).
Responses Fixed in 99ccf1e:
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "full",
"commit": "0ac202de",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P1",
"tag": null,
"file": "core/code_systems/serializers.py",
"line": 117,
"claim": "Property-only supplement concepts are silently discarded during FHIR import.",
"scenario": "POST a supplement containing a concept with code and property inactive=false, without display or designations. This branch leaves names empty. BasicConceptValidator rejects the concept during Concept.persist_new(), which deletes it and returns errors. CodeSystemDetailSerializer.create() ignores those errors, so the request reports success and publishes a version missing the concept.",
"action": "Allow nameless supplement concepts through the model validator without inventing names, propagate concept persistence errors, and add an import regression test.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.2",
"severity": "P1",
"tag": null,
"file": "core/code_systems/serializers.py",
"line": 151,
"claim": "Removing the display name also removes explicitly supplied designation-use metadata.",
"scenario": "Write a French supplement concept with display='Choléra' and designation={language:'fr', value:'Choléra', use:{code:'synonym'}}. add_preferred_name() promotes that designation, and this filter removes it from the read response. Only display remains, losing the explicit synonym designation; writing that response back loses its stored use too.",
"action": "Retain designations carrying a distinct explicit use when their text also supplies display. Add a round-trip test covering matching display and typed designation values.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Member
Author
Codex review, pass 2 (codex-cli 0.169.0, commit 99ccf1e)Verdict: clean. No findings. Earlier findings: F1.1 resolved, F1.2 resolved. findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "99ccf1e8",
"verdict": "clean",
"prior": [
{
"id": "F1.1",
"status": "resolved"
},
{
"id": "F1.2",
"status": "resolved"
}
],
"findings": []
} |
…ch had one caller left Simplification review S1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qTHAarCyLb2cuys8Yd
Member
Author
Simplification review (fresh Claude subagent, commit 99ccf1e)Verdict: findings (1 dup-test, 1 shrink, 1 yagni).
Responses
findings.json{
"reviewer": "claude subagent",
"perspective": "simplify",
"mode": "full",
"commit": "99ccf1e8",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "S1",
"severity": null,
"tag": "yagni",
"file": "core/fhir/search.py",
"line": 249,
"claim": "with_concepts_over_limit() is now a one-line wrapper with a single caller (line ~621). The PR split it from the new concepts_over_limit() only so by_content_mode could reuse the Exists expression, and the wrapper adds nothing on top.",
"scenario": null,
"action": "Delete with_concepts_over_limit and at its one call site write rows = rows.annotate(concepts_over_limit=concepts_over_limit()).",
"lines_delta": -5,
"confidence": "medium"
},
{
"id": "S2",
"severity": null,
"tag": "shrink",
"file": "core/sources/models.py",
"line": 718,
"claim": "clean_supplements has an early return and a nested if, just to separate 'missing' from 'malformed'.",
"scenario": null,
"action": "self.supplements = self.supplements or None\nif self.is_supplement and not self.supplements:\n raise ValidationError({'supplements': [SUPPLEMENTS_REQUIRED]})\nversion = (self.supplements or '').split('|')[1:]\nif len(version) > 1 or version == ['']:\n raise ValidationError({'supplements': [SUPPLEMENTS_FORMAT]})",
"lines_delta": -3,
"confidence": "low"
},
{
"id": "S3",
"severity": null,
"tag": "dup-test",
"file": "core/sources/tests/tests.py",
"line": 851,
"claim": "test_supplements_is_optional_for_other_content makes a whole POST to pin one boolean branch of clean_supplements. The same branch is already hit by the other tests, since every non-supplement source created in the existing suite leaves supplements empty. The test also needs no setup that the sibling tests lack.",
"scenario": null,
"action": "Fold its single assertion (a plain source created with supplements returns 201 and keeps the value) into test_create_update_read_and_versions_carry_supplements, or drop it. Nothing else replaces it.",
"lines_delta": -6,
"confidence": "low"
}
]
} |
Member
Author
Member
Author
|
@snyaggarwal this is ready for review. Jon asks you to merge it if you approve; he knows you're working this weekend.
|
This branch has not been deployed
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.
closes OpenConceptLab/ocl_issues#3030 (part of OpenConceptLab/ocl_issues#3029)
A supplement source can now say which code system it supplements, and FHIR CodeSystem reads, writes and searches carry it. A supplement's FHIR read no longer gains a made-up display, an extra English designation, or concept class and datatype properties. The first users are French and Brazilian Portuguese ICD-10 supplements, shaped like HL7 Denmark's
http://hl7.dk/fhir/core/CodeSystem/icd10-daon tx.fhir.org.This PR adds a migration:
sources/0047_source_supplementsadds three nullable columns tosources(no default, no data migration). Reversing it drops them.Changes
core/sources/models.py): new fieldssupplements(canonical URL, optionally|version),supplement_typeandsupplement_global.clean_supplementsrequiressupplementswhencontent_typeissupplement(FHIR csd-4) and allows at most one non-empty|version; the URL itself goes throughURIValidatorlikecanonical_url. New versions copy all three from HEAD.Source.is_supplementis the shared check.core/sources/serializers.py): create, update and read carry the three fields on sources and source versions. The bulk importer'sSourceImporteraccepts them.core/code_systems/serializers.py):supplements, and thecodesystem-supplement-type(valueCode) andcodesystem-supplement-global(valueBoolean) extensions, on read and write.CodeSystemSupplementConceptSerializer) are a code and its names, plusinactivewhen retired. Noconceptclassordatatypeon the concepts or in the CodeSystem'spropertylist.data['display']is no longer read unchecked, so a concept with designations and no display loads. For a supplement nothing is added. A display that is sent becomes the preferred name in the CodeSystem'slanguage. If that name also came as a designation with its ownuse, it is still listed as a designation.content: supplementpastFHIR_CODE_SYSTEM_CONCEPT_LIMIT; its concepts are left out and the read is tagged SUBSETTED.core/fhir/search.py):/fhir/CodeSystem/takessupplements(a URL matches any version of it;url|versionmatches that version only, as tx.fhir.org does) andcontent-mode(the content the read shows; systemhttp://hl7.org/fhir/codesystem-content-mode). Both are listed in the CapabilityStatement and Swagger.Tests
SourceSupplementsTest(REST create/update/read/versions and validation),CodeSystemSupplementTest(FHIR write and read, an update, the concept limit, designations without a display),CodeSystemSupplementSearchTest(both search parameters), and a bulk importer test.PYTHONHASHSEED=2): 3,224 tests withTEST_ES=off --exclude-tag es --parallel=4, then 630 with--tag es, all OK.pylint -j0 core/10.00, no messages.Decisions to confirm
supplementsis required only forcontent_type: supplement, and any other source may set it. FHIR's csd-4 only goes that way.supplement_typeandsupplement_global, kept as the publisher gives them. Nothing applies them yet; whether a global flag can affect another owner's code system is D4 in Supplements: decide how OCL finds, scopes, turns on and merges supplements ocl_issues#3033.language, and that name isn't repeated as a designation. FHIR defines the display as the designation in the resource language. Without one, the read has designations only, like HL7 Denmark's supplement.supplement, its concepts left out and tagged SUBSETTED, instead ofnot-present. ICD-10 supplements have about 10,000 concepts, so their FHIR read won't list concepts, the same as the base ICD-10 today.content-modematches the content the read shows, so a large non-supplement code system isnot-present, not its stored mode.supplementsis matched as text. Checking that it resolves, and that a supplement's codes exist in it, is Supplements: check a supplement against the code system it supplements ocl_issues#3032.Not in this PR
supplementsisn't indexed in Elasticsearch, and the REST source list doesn't filter on it (D1 in Supplements: decide how OCL finds, scopes, turns on and merges supplements ocl_issues#3033).🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qTHAarCyLb2cuys8Yd