FHIR: every URL the API emits hangs from one base, set by FHIR_BASE_URL

The code systems, value sets and the extensions (cut-offs, report id, interval, quartiles) each wrote the domain by
hand. They now derive from webapi.fhir_base, a leaf module so metrics and durations can use it without a cycle. The
default is unchanged; the WebApp still reads the same URLs by exact match, so changing the domain goes to both.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 02:54:23 -06:00
parent 6d01742a85
commit 1d52da79e4
5 changed files with 64 additions and 9 deletions
+3 -2
View File
@@ -20,6 +20,7 @@ from pathlib import Path
from sqlalchemy import Integer, Select, String, and_, case, cast, column, func, literal, not_, null, select, table, true
from webapi.fhir_base import STRUCTURE
from webapi.metrics import (
AGGREGATION_VERSION,
EVENT_CUTOFF,
@@ -278,9 +279,9 @@ def duration_report(definition: DurationDefinition, question: Question, result:
]}
if result.median is not None:
group["measureScore"] = {"value": result.median, "unit": "d",
"extension": [{"url": "https://isssteleon.org/fhir/StructureDefinition/q1",
"extension": [{"url": f"{STRUCTURE}/q1",
"valueDecimal": result.q1},
{"url": "https://isssteleon.org/fhir/StructureDefinition/q3",
{"url": f"{STRUCTURE}/q3",
"valueDecimal": result.q3}]}
extensions = [{"url": HISTORY_ENTRY, "valueInteger": result.report_id},
{"url": EVENT_CUTOFF, "valueDate": (result.event_cutoff or question.event_cutoff).isoformat()}]