Repository navigation
Conversation
…ply, one merged view of a concept, what an expansion used Under FHIR's rules only (ExpansionEvaluation.fhir_rules); API users see no change. - core.sources.supplements: a code system version's supplements, found by its canonical URL (the source_supplements_base index) and by pins (never HEAD; wildcards allowed); the versions a supplement applies to; one merged view of a concept (names, descriptions and extras, each marked with the supplement that gave it; the code system's own first), matching codes as written, then as FHIR spells them - ExpansionEvaluation: supplements named by a request, declared by a collection version, then applied by default; supplements_for, merged, and require_applied, which raises SupplementNotFound with one message for a supplement unknown, hidden, not a supplement, or applying to none of the versions used (a hidden default is left out silently) - Expansion: supplements_used, recorded for each code system version it used, including those reached through imports (supplement_bases) - concepts: a supplement's concept may have no name, and a name or description no language (ANY_LANGUAGE), only when the write allows it (ALLOWS_ANY_LANGUAGE); every other source keeps every rule - sources: an API metadata edit keeps a supplement with no language as it is require_applied takes named=False for a value set that the one answered for imports: its own declarations alone are its. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…s supplements, and supplement properties in filters Under FHIR's rules only (ExpansionEvaluation.fhir_rules), and only for sources with reserved code spaces or supplements in use; API users see no change. - core.sources.reserved_codes.locate: a code in one of a version's reserved code spaces (the whole code matching the pattern, on RE2; a pattern that doesn't compile reserves nothing), with its default display (the space's, else User-assigned), and its definition by the first extension-codes supplement in use that defines it. Only an extension-codes supplement defines codes, and only in its base's reserved spaces - core.collections.reserved_members: the reserved codes an expansion holds that no concept defines (Expansion.reserved_codes): a code a reference lists; all of a version's, which it can't list (has_unlisted_members), for a reference to all of a code system, or, narrowed to codes, those of them in its spaces. A filter, cascade or value set never selects one; exclusions and versions follow member_versions; with versionsMatch true they rank with the concept members of the same code; a code held under any stored form is the concept, never also a reserved code - CollectionReference: a filter on a property a supplement in use declares (named, declared or global) reads that supplement's values with the code system's own, as the merged concept has them: =, in, exists true and regex select a concept when either value meets them; not-in and exists false keep a concept only when neither has such a value Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…e storage migrations bound their lock waits) into fhir-452-c-core Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…ead as it is when a supplement may apply Under FHIR's rules, an imported value set version's default expansion is read as it is only when nothing the importer brings would change it (core.collections.imports). A code system supplement in play is one more such thing: a filter on a property a supplement declares reads the supplement's values, which the default expansion, built without them, didn't. So when a supplement may apply where the import is evaluated now (one the request names, one the imported version declares, or one applied by default: ExpansionEvaluation.asks_supplements), the import is evaluated again, condition (5) in the module's list. Nothing changes when no supplement is in play, nor under OCL's own rules. Test: a named supplement, and one the imported version declares, evaluate a stale import again; OCL's rules read it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…en a supplement applies to a version it used Condition (5) of core.collections.imports was any supplement in play; a global supplement of another code system a request carries then evaluated every stored import again, slower, and from its references rather than its default expansion. Now it's a supplement that applies, where the import is evaluated now, to a source version its default expansion used (ExpansionEvaluation.supplements_for), read only when one may. Test: a supplement of another code system reads the stored expansion; one of the code system it used, named or declared, evaluates it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…o fhir-452-c-core Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
This was referenced Dec 1, 2026
Draft
…o fhir-452-c-core Takes #1094's new head, which brings in master (#1089, #1109 and #1106): REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every environment, as on master. Merged cleanly; no change to this branch's own code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVQviVc1p6MQwqUUed
paynejd
added a commit
that referenced
this pull request
Dec 2, 2026
… fhir-452-b9-valueset Takes #1104's new head, which brings in master (#1089, #1109 and #1106): REFERENCE_SEARCH_OPTIONS_TOGGLE is on in every environment, as on master. Merged cleanly; no change to this branch's own code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVQviVc1p6MQwqUUed
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.
Branch
fhir-452-c-core, basefhir-452-b-codes(#1094, which merges the storage PR #1103 through #1091). Code system supplements (OpenConceptLab/ocl_issues#3092) and reserved code spaces (OpenConceptLab/ocl_issues#3093) in OCL's own model, for OpenConceptLab/ocl_online#452. Not part of the Dec 1 run.Everything here runs only under FHIR's rules (
ExpansionEvaluation.fhir_rules), so API users see no change. The OCL API and FHIR share this one implementation: FHIR's operations read the merge and the expansions it builds, and only present them (#1105).Size
Four commits (and two merges of its base's new heads), 17 files, +2,077/−26: 879 lines of code, 1,198 of tests.
What it does
Supplements (
ef78eb20, OpenConceptLab/ocl_issues#3092)core/sources/supplements.py): a code system version's supplements are supplement sources found by its canonical URL (decision D1, through the storage PR's index) and by pins (D2: never HEAD; wildcards allowed). A supplement is identified by its canonical, whatever URL names it.ExpansionEvaluation.supplements_for): those a request names, then those a collection version declares (D10:Collection.declared_supplements), then those that apply by default. Stored default supplements wait on decisions D3 and D4, so only global ones a request carries apply by default. One version of each supplement: a pinned version, else the newest that applies and that the reader can see.SupplementNotFound(require_applied). One applied only by default that the caller can't see is left out silently. Building an expansion never raises.merge/ExpansionEvaluation.merged): names, descriptions and extras, each marked with the supplement that gave it, the code system's own first. Codes match as written, then as FHIR spells them, whatever form OCL stores them in.Expansion.supplements_used,record_supplements), for each code system version they used, including those reached through imports (supplement_bases).ANY_LANGUAGE) when the write allows it (ALLOWS_ANY_LANGUAGE); an API metadata edit keeps a supplement with no language as it is. Every other source keeps every rule.Reserved code spaces, extension-codes supplements, and supplement properties in filters (
74d03c82, OpenConceptLab/ocl_issues#3093)core.sources.reserved_codes.locate: a code in one of a version's reserved code spaces (the whole code matching the pattern, on RE2; a pattern that doesn't compile reserves nothing), with its default display (the space's, elseUser-assigned), and its definition by the first extension-codes supplement in use that defines it. Only an extension-codes supplement defines codes, and only in its base's reserved spaces.core.collections.reserved_members: the reserved codes an expansion holds that no concept defines (Expansion.reserved_codes): a code a reference lists; all of a version's, which it can't list (has_unlisted_members), for a reference to all of a code system. A filter, cascade or value set never selects one. Exclusions and versions followmember_versions; withversionsMatchtrue they rank with the concept members of the same code.CollectionReference.get_filter_supplements,apply_database_filter): a filter on a property that a supplement in use declares reads that supplement's values with the code system's own, as the merged concept has them.What's in the FHIR PR instead
core/code_systems/), since they build on OpenConceptLab/ocl_online#452 | FHIR on stored content: CodeSystem properties and filters, full $lookup, CodeSystem $subsumes #1084's property code. Until that PR, the FHIR write still refuses a supplement concept with no name, while the model allows one.Reading order
core/sources/supplements.py: finding and choosing supplements, and the merge.core/collections/evaluation.py:supplements_for,merged,require_applied,asks_supplements.core/collections/models.py:record_supplementsandsupplement_bases; thenget_filter_supplements,apply_database_filterand theReservedMembershook in the build.core/sources/reserved_codes.py, thencore/collections/reserved_members.py.core/concepts/constants.py,serializers.py,validators.pyandcore/sources/serializers.py: names with no language, and nameless supplement concepts.core/collections/imports.py: condition (5), an import evaluated again when a supplement applies to a version it used.core/sources/tests/tests_supplements.py,tests_reserved_codes.py, thencore/collections/tests/tests_reserved_codes.pyandtests_supplement_filters.py.Decisions it follows
From OpenConceptLab/ocl_issues#3033: D1, D2, D5, D9 (refined: a hidden supplement named in a request gets the same not-found as an unknown one; one applied only by default is skipped silently) and D10. D3/D4 (who sets a stored code system's default supplements) and D6 to D8 (the OCL API's fields) are open, and nothing here decides them.
API users
Their expansions don't change. Everything that evaluates is behind
fhir_rules; nothing readsEXPANSION_FHIR_RULES_TOGGLEfor a source with no reserved code spaces; no API field sets or shows the new storage. Tests show it: an expansion an API user builds, OCL's own rules, a PUT that can't set the fields, and GET responses that don't show them.One rule changes for every write, by design: in a supplement source, a concept may have no name. A supplement may add only properties or extensions to a code. Production has no supplement sources. Every other source keeps every rule.
An import's stored expansion is also evaluated again, under FHIR's rules, when a supplement applies to a source version it used (
core.collections.imports, condition 5).Tests
9adc6e66, aspr.ymlruns it: pylint 10.00; 4,629 tests OK (2 skipped) and 822 search-index tests OK; coverage 97%.core/sources/tests/tests_supplements.py,tests_reserved_codes.py,core/collections/tests/tests_reserved_codes.py,tests_supplement_filters.py, and the import guard's intests_imports.py.Review
The code had three Codex defect passes, a simplification review and later checks on its own branches before this split. On this PR, three more passes:
4514b61b, narrowed inc6778a34).versionsMatchacross two releases that reserve one code, a case setting that differs between releases, and supplements declared by a stored collection, which nothing sets yet.🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k