Skip to content

OpenConceptLab/ocl_online#452 | FHIR: the request-scoped terminology engine's foundations - #1095

Draft
paynejd wants to merge 8 commits into
fhir-452-stored-opsfrom
fhir-452-b-engine
Draft

paynejd wants to merge 8 commits into
fhir-452-stored-opsfrom
fhir-452-b-engine

Conversation

@paynejd

@paynejd paynejd commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Branch fhir-452-b-engine, base fhir-452-stored-ops (#1084).

What it does

The HL7 Terminology Ecosystem IG's general test cases send all their content in the request (tx-resource, an inline valueSet or codeSystem). So a FHIR terminology operation needs to read what a request carries, beside OCL's stored content. This PR adds the parts that read and hold it, built from the IG, the FHIR specification and the IG's test cases. Nothing is routed to them yet, and nothing a request carries is saved.

  • resources: the terminology resources a request carries, read as R5 (an R4 client's cross-version extensions become R5 elements) and checked.
  • params: the inputs the operations read, typed, and each malformed one named.
  • context: one request's resources, inputs, limits and deadline. A value set or concept map canonical resolves to what the request carries first, then OCL's stored content, then FHIR's built-ins.
  • codesystem, designations, languages, versions: a carried code system's concepts; designations by use and language; displayLanguage and Accept-Language matching; FHIR version ordering and wildcards.
  • messages, outcome: OCL's own wording for each issue, keyed by the IG's message ids, and the OperationOutcome issues the IG asks for.
  • r4: an R5-shaped answer written as R4, with the IG's cross-version extensions.
  • builtin: two FHIR R4 definitions the IG's cases use without carrying them (administrative-gender and publication-status, CC0). They're used only where OCL stores no copy.
  • ig_fixtures: the resources the IG's test cases carry, for the engine's tests.
  • Settings: FHIR_TX_RESOURCE_LIMIT (100), FHIR_TX_CONCEPT_LIMIT (10,000), FHIR_TX_EXPANSION_LIMIT (10,000), FHIR_TX_TIME_LIMIT_MS (10,000), FHIR_TX_BATCH_LIMIT (1,000). They're fixed server limits, the same for every caller.
  • FhirParameters keeps the request headers an operation reads: Accept-Language, and X-TOO-COSTLY-THRESHOLD, which can only lower the expansion limit.

Reading order

core/fhir/engine/__init__.py (how the engine fits), resources.py, params.py, context.py, codesystem.py, designations.py, then the rest, then the tests. ig_fixtures.py and builtin/*.json are data.

What a reviewer checks

These are parsing and in-memory models. None of it reads or writes OCL's tables: stored content comes through the context's hooks (StoredContent), which the stored provider in the next PR installs. Nothing is reachable from a request yet.

How it was tested

  • On this branch alone: pylint 10.00 (core); the FHIR, CodeSystem and ValueSet tests with Elasticsearch: 1,036 OK, 2 skipped (core.fhir, core.code_systems, core.value_sets). The new engine 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.

What changes for existing callers

Nothing: nothing is routed here.

Size

About 2.2k lines of code, 1.5k of tests and 1.3k of data (the IG's fixtures and two FHIR definitions).

Rollback

Revert this PR and the ones after it. No migrations.

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

…engine's foundations

The HL7 Terminology Ecosystem IG's general test cases send all their content in the request
(tx-resource, an inline valueSet or codeSystem), so a FHIR terminology operation needs to read
what a request carries, beside OCL's stored content. This adds the parts that read and hold it;
nothing is routed to them yet, and nothing a request carries is saved.

- resources: the terminology resources a request carries, read and checked (R4 and R5 shapes,
  contained resources, canonical URLs with versions).
- params: the operation inputs the engine reads (tx parameters, display language, designations).
- context: one request's resources, inputs, limits and deadline, and resolving a value set or
  concept map canonical: carried first, then OCL's stored content, then FHIR's built-ins.
- codesystem and designations: a carried code system in memory, and its designations by use and
  language; languages: BCP-47 matching; versions: FHIR version ordering and wildcards.
- messages and outcome: the IG's message ids and OperationOutcome issues; r4: writing an
  R5-shaped answer as R4.
- builtin: two FHIR definitions the IG's cases use without carrying them
  (administrative-gender, publication-status), used only where OCL stores no copy.
- ig_fixtures: the resources the IG's test cases carry, for the engine's tests.
- Limits: FHIR_TX_RESOURCE_LIMIT, FHIR_TX_CONCEPT_LIMIT, FHIR_TX_EXPANSION_LIMIT,
  FHIR_TX_TIME_LIMIT_MS and FHIR_TX_BATCH_LIMIT, fixed server settings, the same for every caller.
- FhirParameters keeps the request headers an operation reads (Accept-Language, and
  X-TOO-COSTLY-THRESHOLD, which can only lower the expansion limit).

Built from the IG, the FHIR specification and the IG's test cases.

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
…into fhir-452-b-engine

Takes #1084'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
…into fhir-452-b-engine

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

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

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
…into fhir-452-b-engine

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
…into fhir-452-b-engine

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
…into fhir-452-b-engine

Takes #1084'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
…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

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