Repository navigation
Conversation
…AD, and its new version is made from that HEAD A FHIR CodeSystem, ValueSet or ConceptMap update (PUT) loaded the version its URL resolved, usually the latest release, applied the resource to it and saved it over HEAD. Any HEAD field the resource doesn't carry took that release's value, so an edit made to HEAD through the API since that release was undone by a metadata-only PUT, and so was HEAD's own access. Now one helper on FhirRepositorySerializerMixin does it for all three: - update_head: HEAD is the stored HEAD with what the resource says. A private HEAD still stays private whatever a concurrent write does (persist_changes keep_private), and the resource's id never renames HEAD. - as_new_version: the new version is made from that HEAD, with the resource's version and status, as the latest version, without HEAD's background tasks or its record of removed members. A CodeSystem update that doesn't give a language writes a supplement's concepts in HEAD's language, which is the one it keeps. Kept as they were: the version-exists check, concepts, references and mappings, and the supplement fields. Tests: core/fhir/tests_updates.py, for each resource type. Three existing tests described the old behaviour (a private release's access copied onto HEAD; a release without supplements refusing the PUT) and now check the new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… schema and the access HEAD has when it's saved - HEAD is saved with its stored validation schema as the original schema, as an API edit that sends none is. With None, a HEAD whose schema differs from its latest release's, and which has concepts, was revalidated to None and the update failed. - The save keeps the access HEAD has once it's locked for the save (keep_access beside keep_private), so a publish made between the update's read of HEAD and its save isn't undone, as a make-private already wasn't. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…dates save onto HEAD from HEAD) into the ValueSet writes So the two B-9 changes don't conflict in core/value_sets/serializers.py. One conflict, in CodeSystemDetailSerializer.update: this branch kept HEAD's version_algorithm over the release's on a FHIR update; an update that starts from HEAD keeps it already (an R4 CodeSystem doesn't carry one), so the merge takes update_head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… HEAD as read for update, and queues no schema revalidation - update_head reads HEAD FOR NO KEY UPDATE in the transaction that saves it, and applies the resource to that row, so an API edit committed before the update locks HEAD is the one kept, not the values read earlier. - persist_changes takes revalidates_schema=False from a write that can't change the validation schema. A FHIR update can't, so it no longer queues a revalidation of HEAD's concepts, whose full-row save could undo a concurrent change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…s stored once written, without HEAD's member counts - as_new_version reloads HEAD before making the version from it, so an edit made to HEAD after the update saved it (while concepts, references or mappings were written) gives one consistent version, not the update's values mixed with HEAD's. - The new version starts with no member counts, as any new version does, so a version that isn't expanded doesn't show HEAD's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…of revalidates_schema; the ValueSet update uses as_new_version's result Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… what its compose says - Includes and excludes become references as written, with no transform: a listed code keeps the version its include names, or none, so OCL's version rules pick one wherever the value set is evaluated. Only FHIR's elements of an include are read (system, version, concept, filter, valueSet). - compose.inactive is the collection's own rule, Collection.include_retired. False leaves retired concepts out wherever the collection is evaluated, under either rule set and when it's evaluated again as an import, while an expansion's activeOnly keeps the value it was given (ExpansionParameters retired_left_out). New versions take HEAD's rule. - A listed code's designations and extensions are kept on its reference (CollectionReference.concept_details), copied to new versions with it, and shown in the ValueSet read with compose.inactive. - What can't be used as written is refused, not saved to add nothing: a modifier extension (on the compose, an include or exclude, a listed code or a filter), a filter with no value, codes or filters with no system (core.value_sets.compose.compose_errors), and a filter OCL can't apply, as the API's add-references refuses it (Collection.get_reference_filter_errors). - Migration collections/0079: two nullable columns with no default (catalog-only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… retired status from the update, as its released The version is made from HEAD reloaded, so a concurrent change to HEAD's retired flag no longer reaches it: like released, retired is the update's status, else the resolved version's. The member-count test checks each count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… an update keeps listed codes' details current and rebuilds HEAD for a new rule - The read keeps each compose clause apart (ComposeValueSetField.clause_of): listed codes of one code system version share one include; a filter, an import or a whole code system is one of its own. An include shows its codes, filter and value sets together. - An update gives a reference HEAD already has (by expression, include or exclude) the update's display, designations and extensions. - An update that changes compose.inactive rebuilds HEAD's default expansion with its version locks, as a change of rules does, so an import that reads it reads the new rule's members. - An update's filters are checked in its HEAD's namespace, as the API's add-references checks them. - An import that holds a code at another version applies its own rule on retired concepts to its candidates. - compose_errors also refuses a modifier extension on a listed code's designation, and lists or entries that aren't what FHIR makes them (a 400, not a server error). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… fixes (up to 2c4026a) into the ValueSet writes No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…HEAD's; clauses sharing an expression are kept apart - An update that gives a compose makes HEAD's references what it says: a reference it leaves out is removed (only references to concepts, which a compose can show), then the new ones are added, and HEAD's default expansion is rebuilt with its version locks, since a removal also takes members kept references have and keeps what an exclusion took. The rule on retired concepts it compares is HEAD's as read for update. - Collection.add_references(by_clause=True), from FHIR writes only, keeps references that differ only in including or excluding, or in the value sets they intersect with, apart (CollectionReference.clause_key): their expression doesn't say either. The API's own writes dedupe by expression as before. - A listed code gives the parser its code and display only, so an OCL key such as resource_version isn't read. - Refused: a modifier extension on the ValueSet itself, a modifierExtension that isn't a list of objects, and an include or exclude with both codes and filters (FHIR R4's vsd-3). - The WHO integration test no longer expects an include to gain a version on write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…HEAD's in one transaction, and refuses what it can't keep as written - HEAD's references are replaced in one transaction: a refusal of any new one (say, an import loop) leaves HEAD's references and members as they were. Those left out go first, so a clause added back differently doesn't meet the one it replaces. - A stored reference of the same clause is kept only if it's evaluated as the update's would be (no cascade or pinned concept version, the same transform); otherwise the update's replaces it. - add_references(by_clause=True) also checks for a reference already there by clause (Collection.validate), so two includes that share an expression and differ in their value sets are both kept. - A compose given is the value set's rule on retired concepts: one without inactive clears it. An update that gives no compose keeps HEAD's. - Refused: a ValueSet marked SUBSETTED written back with its compose (it shows only part of the value set's); a listed code with no code; a concept, filter or valueSet list given as null; a filter on a search parameter (page, limit and the like), which a reference ignores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
… guards, one test for a listed code's version, one builder of an evaluation's parameters Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…'s metadata and references as they were - HEAD's save and the replacement of its references run in one transaction, under HEAD's lock, so a refused reference rolls back both: HEAD keeps its rule on retired concepts with the members built under it. - A filter's property is no longer refused for naming a search parameter: a code system may declare a property of that name, and a reference already skips the search parameter otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH
…o fhir-452-b9-valueset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qX3xher9sfoCLLKrTC
…d reserved code spaces in OCL's model, on fhir-452-b-codes) into fhir-452-b9-valueset One conflict, in core/collections/models.py: both add a Collection field after locked_date (include_retired here, declared_supplements there) and copy it to new versions. Both are kept. The migration numbers meet next: this branch's collections/0079 is renumbered in the following commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…ompose_details to 0081, after phase C's 0079 and 0080 Phase C's storage (fhir-452-c-storage) merges first with collections/0079_supplements and 0080_expansion_reserved_codes, so this branch's migration becomes 0081 and depends on 0080. Its operations are unchanged; the migration graph stays linear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
… fhir-452-b9-valueset The storage migrations now bound their lock waits, and an import's stored expansion isn't read as it is when a supplement may apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…s, as phase C's storage migrations do It first sets lock_timeout (5s) in its own transaction, both ways: behind a long transaction on collection_references or collections, it fails in seconds and changes nothing, instead of holding its locks, and every query queued behind them, until that transaction ends. Its operations are otherwise unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
… fhir-452-b9-valueset An import is evaluated again only when a supplement applies to a version it used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
… fhir-452-b9-valueset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…s before its first DDL, both ways As phase C's storage migrations now do: a forward-only first operation and a reverse-only last one set lock_timeout, since a reversed migration runs its operations last first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
… 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
paynejd
added a commit
that referenced
this pull request
Dec 2, 2026
… into fhir-452-capabilities Takes #1102'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.
Updated Dec 1:
fhir-452-c-core(OpenConceptLab/ocl_issues#3092 OpenConceptLab/ocl_issues#3093 | Supplements and reserved code spaces in OCL's model, under FHIR's rules #1104, on OpenConceptLab/ocl_online#452 | An expansion evaluation narrowed to some codes; an import's codes matched as a code reference matches them #1094, with the storage PR OpenConceptLab/ocl_issues#3092 OpenConceptLab/ocl_issues#3093 | Supplements and reserved code spaces: where OCL stores them #1103 below it), and its base moved to that branch. One conflict, incore/collections/models.py: both add aCollectionfield afterlocked_dateand copy it to new versions; both are kept (e5fd49f7).collections/0079_value_set_compose_detailsis nowcollections/0081_value_set_compose_details, depending on OpenConceptLab/ocl_issues#3092 OpenConceptLab/ocl_issues#3093 | Supplements and reserved code spaces: where OCL stores them #1103'scollections/0080(c85e9726). Its operations are unchanged.lock_timeout5 s before its first DDL, applying and reversing:87740602,5882ce34), as OpenConceptLab/ocl_issues#3092 OpenConceptLab/ocl_issues#3093 | Supplements and reserved code spaces: where OCL stores them #1103's do: behind a long transaction oncollection_referencesorcollectionsit fails in seconds instead of holding their locks.manage.py migrate collections 0080, then revert.Part of phase B (B-9, accepted Dec 1). API users' own writes don't change.
Ticket: OpenConceptLab/ocl_online#798 (B-9: a ValueSet written through FHIR keeps what it says).
Branch
fhir-452-b9-valueset, based onfhir-452-b-codes(#1094, the end of phase B's OCL API PRs), whose evaluation rules it uses. It also mergesfhir-452-b9-codesystem(#1101: FHIR updates save onto HEAD from HEAD), so the two don't conflict incore/value_sets/serializers.py. Review this PR's own commits:f751a6ad,5a3e8147,d17066ca,ca885630,6da68616ande8bdd678. The two merge commits only bring in #1101's commits:81e6f577resolves one conflict, and5cb0d969has none.The change
A FHIR ValueSet write (create or update) used to mark every include and exclude
transform: resourceversions. That replaced a listed code's version, named or not, with the newest source version holding that concept version, released or not. It also droppedcompose.inactiveand listed codes' designations and extensions, and saved filters OCL can't apply, which then added nothing. Now:system,version,concept,filter,valueSet).compose.inactiveis the collection's own rule:Collection.include_retired.falseleaves retired concepts out wherever the collection is evaluated: its own expansions under either rule set, and when it's evaluated again as an import.activeOnlykeeps the value it was given (ExpansionParameters(..., retired_left_out=...), fromExpansion.apply_parametersand its import stand-in).trueor absent keeps OCL's default. A compose given withoutinactiveclears the rule; an update that gives no compose keeps HEAD's.CollectionReference.concept_details), copied to new versions with it. The ValueSet read shows them, withcompose.inactive, and reads each clause back as its own include.add_references(by_clause=True), also in its duplicate check); the API's own writes dedupe by expression as before.system(core/value_sets/compose.py,compose_errors);Collection.get_reference_filter_errors).Migration
collections/0081_value_set_compose_details(renumbered from 0079, above): two nullable columns with no default, added by a catalog update only.Numbering: #1103 adds
collections/0079and0080, and merges first; this one is 0081.Production
No collection has ever been written through FHIR: 0 collections with
collection_typeValueSet, active or not, and 0 references on them (read-only count, Dec 1). So no stored expansion changes.Not in this PR
$expandand$validate-code. That's a follow-up on the FHIR-layer branch. Master's stored$expandisn't changed.check_definition(on the FHIR-layer branch) should callcompose_errorswhen the branches meet.Tests
core/value_sets/tests.py(ValueSetComposeWriteTest):compose.inactivefalse is the value set's own rule, and without it retired concepts stay;core/collections/tests/tests_include_retired.py:trueor absent;activeOnlykeeps its value;pr.ymlruns it: pylint 10.00; 4,553 tests OK (2 skipped) and 822 search-index tests OK; coverage 97%.Review
inactivekeeping the old rule;INTENSIONAL_REFERENCE_RESOURCE_VERSIONS_TOGGLEis off (it's on in production; a test pins the outcome);pageand the like) is skipped, not refused, unless the code system declares that property.add_referencesunder this transaction when OCL's locks toggle is off (it's on in production, whereadd_referencesalready runs in one).Rollback
Reverse migration
collections/0081(manage.py migrate collections 0080), then revert this PR. Both columns are nullable, and nothing else reads them.🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qXBZMHpxmJnf6SMKTH