Skip to content

OpenConceptLab/ocl_online#452 | FHIR: carried content in OCL's own tables for one request, and the stored provider - #1096

Draft
paynejd wants to merge 8 commits into
fhir-452-b-enginefrom
fhir-452-b-workspace
Draft

paynejd wants to merge 8 commits into
fhir-452-b-enginefrom
fhir-452-b-workspace

Conversation

@paynejd

@paynejd paynejd commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Branch fhir-452-b-workspace, base fhir-452-b-engine (#1095).

What it does

So carried and stored content take the same code paths, a code system or value set a request carries is evaluated by OCL's own expansion model: CollectionReference, Expansion.add_references, $cascade and the reference filters.

  • The workspace (core/fhir/workspace/):
    • A carried CodeSystem is loaded as a Source with its versions and concepts, and a carried ValueSet as a Collection with its references. Each is loaded only when resolution first asks for its canonical.
    • Everything is loaded inside one transaction that is always rolled back (ExpansionEvaluation.at_request_time). While it's open, search index writes, tasks, cache writes and on_commit hooks are refused. One deadline, from the request's time limit, covers it.
    • Resolution: what references and the version parameters name resolves to what the request carries, then to OCL's stored content as the request's base shows it to its caller, then to FHIR's built-ins.
    • FHIR_WORKSPACE_TOGGLE (a new toggle: on in dev, QA and staging, off in production) turns it off. A request the engine would take is then answered not-supported.
  • The stored provider (core/fhir/stored.py): a concept of a code system version OCL stores, and a value set OCL stores, read through OCL's own capabilities, as the stored operations read them. It installs the context's hooks from OpenConceptLab/ocl_online#452 | FHIR: the request-scoped terminology engine's foundations #1095.
  • FhirResolver: FHIR's version rules for a canonical's releases, and which rows and memberships the base shows the caller (shown_concepts, selected_shown, selected_at_head).
  • core/fhir/ops/concepts.py gains code_system and stored_member, which stored $expand used privately, so an expansion over carried content writes a member the same way.

Nothing is routed to the workspace yet. Its own tests drive it through the operations, so they come with #1097. This PR carries the stored provider's tests.

Reading order

core/fhir/workspace/__init__.py, loader.py, workspace.py (the guard, the deadline, the kill switch, resolution), readers.py, requests.py, then core/fhir/resolve.py, core/fhir/stored.py and core/fhir/tests_stored.py.

What a reviewer checks

  • Carried content can't outlive the request: the rollback, the refused side effects, and the deadline.
  • Only what the request's base shows its caller is read from OCL's stored content.
  • The workspace's organization is private and made for the request alone.

What changes for existing callers

Nothing is routed here yet. Stored $expand writes its members through stored_member, unchanged.

Size

About 1.9k lines of code and 0.9k of tests.

Rollback

Revert this PR and the ones after it. No migrations. The toggle row is fixture data.

How it was tested

  • On this branch alone: pylint 10.00 (core); the FHIR, CodeSystem and ValueSet tests with Elasticsearch: 1,043 OK, 2 skipped. The stored provider's tests are among them.
  • Its code was reviewed in the work it comes from: three Codex defect passes, a simplification review and checks of later commits on each part, and an adversarial review of who can see what, on the whole. This split was checked by building each PR's own tree and running its tests.

The series

The FHIR layer for OpenConceptLab/ocl_online#452. It is one linear series, and each PR is based on the one before:

  1. OpenConceptLab/ocl_online#452 | An expansion evaluation narrowed to some codes; an import's codes matched as a code reference matches them #1094: the end of the OCL API PRs (core changes, reviewed first)
  2. OpenConceptLab/ocl_online#452 | FHIR metadata: CapabilityStatement and TerminologyCapabilities for the Terminology Ecosystem IG #1083: capabilities
  3. OpenConceptLab/ocl_online#452 | FHIR on stored content: CodeSystem properties and filters, full $lookup, CodeSystem $subsumes #1084: stored CodeSystem properties and filters, $lookup, $subsumes
  4. OpenConceptLab/ocl_online#452 | FHIR: the request-scoped terminology engine's foundations #1095: the engine's foundations
  5. OpenConceptLab/ocl_online#452 | FHIR: carried content in OCL's own tables for one request, and the stored provider #1096: the workspace and the stored provider
  6. OpenConceptLab/ocl_online#452 | FHIR: $expand of a value set the request carries, over OCL's own expansion #1097: $expand on carried content, and dispatch
  7. OpenConceptLab/ocl_online#452 | FHIR: $validate-code and $batch-validate-code on content the request carries #1098: $validate-code and $batch-validate-code
  8. OpenConceptLab/ocl_online#452 | FHIR: $lookup, $subsumes and $translate on content the request carries #1099: $lookup, $subsumes and $translate on carried content

Each diff is its own. The last one's tree is the whole that was tested: 707 of the HL7 Terminology Ecosystem IG's 707 in-scope test cases pass (hl7.fhir.uv.tx-ecosystem 1.11.0, general mode; supplements are out of scope). The series stays in draft until the whole ships, after the OCL API PRs. As those land on master, each PR here is retargeted, never force-pushed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qV2gzsF5GhF5BwTJ6x

…bles for one request, and the stored provider

So carried and stored content take the same code paths, a code system or value set a request
carries is evaluated by OCL's own expansion model: CollectionReference, Expansion.add_references,
$cascade and the reference filters.

- The workspace (core.fhir.workspace): a carried CodeSystem is loaded as a Source with its
  versions and concepts, a carried ValueSet as a Collection with its references, only when
  resolution first asks for its canonical. Everything is loaded inside one transaction that is
  always rolled back (ExpansionEvaluation.at_request_time), with search index writes, tasks, cache
  writes and on_commit hooks refused while it's open, and one deadline from the request's time limit.
- Resolution: what references and the version parameters name resolves to what the request
  carries, then to OCL's stored content as the request's base shows it to its caller (FhirResolver,
  with FHIR's version rules), then to FHIR's built-ins.
- FHIR_WORKSPACE_TOGGLE turns it off; a request that carries content is then answered
  not-supported.
- The stored provider (core.fhir.stored): a concept of a code system version OCL stores, and a value
  set OCL stores, read through OCL's own capabilities, as the stored operations read them.
- FhirResolver: the version rules for a canonical's releases, and which rows and memberships the
  base shows the caller (shown_concepts, selected_shown, selected_at_head).
- core.fhir.ops.concepts gains code_system and stored_member, which stored $expand used privately,
  so an expansion over carried content writes a stored member the same way.

Nothing is routed to the workspace yet. Its own tests drive it through the operations, so they come
with them; the stored provider's tests are here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qV2gzsF5GhF5BwTJ6x
paynejd and others added 7 commits December 1, 2026 00:39
…to fhir-452-b-workspace

Takes #1095's new head, which brings in master's
#1085, #1086 and
#1082. 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_01AaZ4qWUTom6BGgjQy6oehZ
…to fhir-452-b-workspace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qX3xher9sfoCLLKrTC
…ith fhir-452-b9-valueset and phase C's storage and core) into fhir-452-b-workspace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…to fhir-452-b-workspace

Phase C's storage migrations and collections/0081 bound their lock waits; 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
…to fhir-452-b-workspace

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
…to fhir-452-b-workspace

The migrations bound their lock waits before their first DDL, both ways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qWapJWFsFc1Xjopf9k
…to fhir-452-b-workspace

Takes #1095'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-b-expand

Takes #1096'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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant