Publisert - 07.05.2026

Conversion Mapping

This document describes how upstream FHIR resources are mapped to output models by ConversionService.

PlanDefinition + ActivityDefinition → TreatmentGroup

Source Output field Logic
PlanDefinition.Identifier[0].Value id First identifier value
PlanDefinition.Name name Direct mapping
PlanDefinition.Description description Direct mapping
PlanDefinition.Extension or PlanDefinition.Type diseaseGroup First checks for an extension with URL containing "diseaseGroup" and uses its ValueString (other value types are ignored). Falls back to Type.Text or Type.Coding[0].Display
PlanDefinition.UseContext[].ValueCodeableConcept.Coding[] jurisdictions Filters for codings where System equals urn:oid:2.16.578.1.12.4.1.102 (RHF OID)
PlanDefinition.EffectivePeriod validityPeriod Direct mapping (Period with start and end as YYYY-MM-DD strings)
PlanDefinition.LastReviewDate reviewDate Direct mapping (YYYY-MM-DD string)
PlanDefinition.Goal[].Addresses[] indications Flattened list of CodeableConcepts from all goals
PlanDefinition.Action[] + ActivityDefinition lookup treatmentAlternatives See below

Treatment Alternative Resolution

Each PlanDefinitionAction is resolved to a TreatmentAlternative:

  1. DefinitionCanonical is used to look up the corresponding ActivityDefinition from a dictionary keyed by identifier value.
  2. Lookup tries exact match first, then falls back to matching the last URL segment.
  3. Rank is extracted from the action's extensions (URL containing "rank"). Falls back to the action's position index (1-based).
Source Output field
Action extension with "rank" URL, or position index rank
ActivityDefinition.Identifier[0].Value, or DefinitionCanonical as fallback treatmentId
ActivityDefinition.Name, or Action.Description as fallback name
ActivityDefinition.Description description
ActivityDefinition.ArticleNumbers medicines

Medicine References from ActivityDefinition

Each entry in ActivityDefinition.ArticleNumbers becomes a MedicinalReference. The reference and display fields are null for FEST-sourced medicines:

{
  "reference": null,
  "type": "FEST/LegemiddelPakning",
  "identifier": {
    "system": "FEST/Varenummer",
    "value": "<article number>"
  },
  "display": null
}

RegulatedAuthorization → ReimbursementGroup

Source Output field Logic
RegulatedAuthorization.Identifier[0].Value id First identifier value
RegulatedAuthorization.Extension[] legalBasis The first extension whose URL contains reimbursementRegulation (case-insensitive); its ValueCodeableConcept is used directly
RegulatedAuthorization.Basis.Coding[] indications Each coding in Basis.Coding becomes its own CodeableConcept (one indication per coding), preserving the diagnosis-per-entry model from upstream

Note: in upstream RegulatedAuthorization, Basis carries the diagnoses (e.g., ICD-10 codes) while the legal basis (e.g., H-resept §950) is delivered via the reimbursementRegulation extension — the mapping flips these into the consumer-friendly ReimbursementGroup shape.

Code Systems

OID / URI Description Used in
urn:oid:2.16.578.1.12.4.1.102 Norwegian Regional Health Authority (RHF) Jurisdictions
urn:oid:2.16.578.1.12.4.1.1.7110 ICD-10 (Norwegian) Indications, Reimbursement codes
http://terminology.hl7.org/CodeSystem/meddra MedDRA Indications, Reimbursement codes
urn:oid:2.16.578.1.12.4.1.1.7427 Reimbursement regulation codes Reimbursement regulation
FEST/Varenummer FEST article numbers Medicine references

Extending the Mapping

The mapping logic lives in Api/Services/ConversionService.cs. Each field extraction is isolated in a private method (e.g., ExtractDiseaseGroup, ExtractJurisdictions). To adjust mapping for a specific field:

  1. Identify the relevant Extract* or Build* method.
  2. Modify the filtering or transformation logic.
  3. The method is pure (no I/O), so changes can be verified with unit tests.

If the upstream FHIR API introduces new extension URLs, the conversion service will need to be updated to recognize them. Unrecognized extensions are currently silently ignored.

Søk i Utviklerportalen

Søket er fullført!