FHIR Datatypes Analysis and SDC4 Mapping Strategy

Executive Summary

This document provides a comprehensive analysis of HL7 FHIR (Fast Healthcare Interoperability Resources) R4 datatypes and their mapping to SDCStudio's SDC4 component system. Version 2.0 adds holistic top-down analysis showing how complete FHIR resources map to SDC4's existing architectural patterns, revealing that SDC4 already has ~40% of what FHIR needs natively.

Key Findings - Bottom-Up (Datatype Level)

Key Findings - Top-Down (Architecture Level) ⭐ NEW

Critical Architectural Insight

FHIR Range/ReferenceRange β†’ Use Native SDC4 ReferenceRange! Do not create @FHIR:Range cluster. SDC4's XdQuantified.reference_ranges already implements this pattern with low/high/type/appliesTo fields.

Strategic Recommendation: PROCEED with revised phased implementation leveraging native SDC4 patterns where possible, creating @FHIR components only for unique FHIR structures (Identifier, HumanName, Address, ContactPoint, CodeableConcept, Reference).

See Also: FHIRTOSDC4HOLISTICMAPPING.md for complete top-down resource analysis and FHIRSDC4DECISION_MATRIX.md for detailed mapping decisions.

Table of Contents

Part I: Holistic Architecture View (Top-Down) ⭐ NEW

  1. SDC4 Native Patterns for FHIR
  2. Holistic Mapping Philosophy
  3. Native vs @FHIR Decision Framework

Part II: Datatype Analysis (Bottom-Up)

  1. Complete FHIR Datatypes Inventory
  2. Current SDC4 Component Types
  3. FHIR-to-SDC4 Mapping Strategy

Part III: Implementation Strategy

  1. Implementation Priority Recommendations
  2. Strategic Recommendations
  3. Critical Considerations and Challenges
  4. Implementation Roadmap
  5. Success Metrics
  6. Next Steps
  7. Resource Requirements

Part I: Holistic Architecture View (Top-Down)

1. SDC4 Native Patterns for FHIR

Critical Discovery: SDC4 already implements ~40% of FHIR's structural patterns natively. Before creating @FHIR components, check if SDC4 already has the semantic equivalent.

1.1 Native SDC4 Patterns That Match FHIR

DO NOT CREATE @FHIR COMPONENTS FOR THESE - Use native SDC4 instead!

ReferenceRange (⭐ Most Important)

FHIR: Observation.referenceRange, Range datatype

SDC4: ReferenceRange and SimpleReferenceRange models + XdQuantified.reference_ranges ManyToMany

Structure:


# SDC4 ReferenceRange model (already exists!)
class ReferenceRange(XdAny):
    meaning: XdString  # "normal", "critical", etc.
    range: XdInterval  # low/high with units
    applies_to: many XdToken  # age ranges, populations

Usage in Observation:


# Blood glucose measurement
glucose = XdQuantity(
    label="Blood Glucose",
    units=ucum_mgdl,  # mg/dL
    fraction_digits=1
)

# Add reference ranges (NATIVE!)
normal_range = ReferenceRange.objects.create(
    meaning=XdString(label="Normal"),
    range=XdInterval(
        lower=70.0,
        upper=100.0,
        units=ucum_mgdl
    )
)

glucose.reference_ranges.add(normal_range)

MD2PD Template (shows native usage):


### Column: blood_glucose
**Type**: decimal
**Units**: mg/dL
**Description**: Fasting blood glucose measurement
**Constraints**:
  - precision: 1
  - range: [50, 600]

**Reference Ranges**:  ← NATIVE SDC4!
- Normal: 70-100 mg/dL (fasting)
- Pre-diabetes: 100-125 mg/dL
- Diabetes: β‰₯126 mg/dL

Why This Matters:

XdInterval

FHIR: Range (low/high bounds), Period (start/end times)

SDC4: XdInterval model

Structure:


class XdInterval(XdOrdered):
    lower: decimal/int (depends on interval_type)
    upper: decimal/int
    lower_included: bool
    upper_included: bool
    interval_type: choice (integer, decimal, temporal)
    units: FK to Units

Usage:

Example:


# Age range: 18-65 years
age_range = XdInterval(
    lower=18,
    upper=65,
    interval_type='integer',
    units=years,
    lower_included=True,
    upper_included=True
)

DM Metadata β†’ FHIR Meta

FHIR: Resource.meta (versionId, lastUpdated, source, profile, security, tag)

SDC4: DM model fields

Direct Mapping:

FHIR Meta Field SDC4 DM Field Notes
id ct_id CUID2 identifier
meta.versionId (audit trail) Track via Audit model
meta.lastUpdated updated DateTime field
meta.source dc_source Dublin Core source
meta.profile (links) Reference to profile DM
meta.security pred_obj Security labels as semantic links
meta.tag pred_obj Tags as semantic links

Usage: Store FHIR metadata at DM level, NOT in data cluster

Audit Trail and Provenance

FHIR: Meta.lastUpdated, Provenance resource

SDC4: DM.created, DM.updated, DM.creator, DM.edited_by, Audit model

Structure:


class DM(XdAny):
    created: DateTime  # FHIR Provenance.recorded
    updated: DateTime  # FHIR Meta.lastUpdated
    creator: FK Modeler  # FHIR Provenance.agent
    edited_by: FK Modeler
    author: str  # FHIR Provenance.agent (name)
    contrib: list  # FHIR Provenance.agent (contributors)
    audit: M2M Audit  # Full audit trail

Why Use Native:

Attestation and Signature

FHIR: Signature datatype

SDC4: Attestation model, DM.attestation

Structure:


class Attestation(XdAny):
    attested_view: XdString  # What was attested
    proof: XdString  # Digital signature
    reason: XdString  # Why attested
    time_committed: XdTemporal  # When
    is_pending: bool
    committer: M2M Participation  # Who

Usage: Legal validation already modeled in SDC4

Participation and Performer Roles

FHIR: Observation.performer, Procedure.performer, performer roles

SDC4: Participation model, DM.participations

Structure:


class Participation(XdAny):
    function: XdToken  # Role (performer, author, verifier)
    performer: FK Party  # Who
    time: XdInterval  # When
    mode: XdToken  # How (in-person, remote, etc.)

Usage: Role-based attribution already in SDC4

FHIR: Coding (system, code, display), CodeableConcept.coding[]

SDC4: PredObj model, pred_obj ManyToMany on all XdAny

Structure:


class PredObj(XdAny):
    pred_uri: XdLink  # Predicate (e.g., rdfs:isDefinedBy, skos:exactMatch)
    obj_uri: XdLink  # Object (e.g., LOINC code URI)
    obj_val: XdString  # Optional literal value

FHIR Coding Mapping:


# FHIR: { "system": "http://loinc.org", "code": "2339-0", "display": "Glucose" }
# SDC4:
glucose_component.pred_obj.add(
    PredObj.objects.create(
        pred_uri="http://www.w3.org/2000/01/rdf-schema#isDefinedBy",
        obj_uri="http://loinc.org/2339-0",
        obj_val="Glucose [Mass/volume] in Blood"
    )
)

Why Use Native:

1.2 When Native Patterns Are Sufficient

Use Native SDC4 Instead of @FHIR When:

FHIR Concept Native SDC4 Reason
Range (measurements) ReferenceRange + XdInterval Already implements pattern
Period (time spans) Two XdTemporal fields OR XdInterval Simpler, equivalent
Meta (resource metadata) DM fields (created, updated, etc.) Metadata belongs at DM level
Provenance DM creator/author/audit Already tracked
Signature Attestation Legal validation built-in
Performer roles Participation Role-based attribution
Coding (single code) pred_obj β†’ PredObj More flexible, RDF-native

2. Holistic Mapping Philosophy

2.1 Content-Compliant vs Structure-Duplicate

Principle: Map FHIR concepts to semantically equivalent SDC4 patterns, not structurally identical.

Example - WRONG Approach (Structure-Duplicate):


## Sub-Cluster: Range  ❌
**ReuseComponent**: @FHIR:Range
### Column: low
**Type**: decimal
### Column: high
**Type**: decimal

Example - RIGHT Approach (Content-Compliant):


### Column: systolic_bp
**Type**: decimal
**Units**: mmHg
**Description**: Systolic blood pressure
**Reference Ranges**:  βœ… Uses native SDC4!
- Normal: 90-120 mmHg
- Elevated: 120-129 mmHg
- Hypertension Stage 1: 130-139 mmHg
- Hypertension Stage 2: β‰₯140 mmHg

The second approach uses SDC4's native ReferenceRange pattern instead of creating a duplicate @FHIR:Range cluster.

2.2 DM Architecture Mirrors FHIR Resources

FHIR Resource Structure:


Resource
β”œβ”€β”€ id, meta (metadata)
β”œβ”€β”€ text (human-readable)
β”œβ”€β”€ extension[] (custom fields)
└── [domain content] (actual data)

SDC4 DM Structure (perfect match!):


DM
β”œβ”€β”€ ct_id, created, updated (metadata)
β”œβ”€β”€ description (human-readable)
β”œβ”€β”€ pred_obj[] (semantic links, like extensions)
└── data β†’ Cluster (domain content)

Mapping:

FHIR Element SDC4 Element Level
Resource.id DM.ct_id DM
Resource.meta DM.created/updated/audit DM
Resource.text DM.description DM
Resource.extension[] DM.pred_obj or custom fields DM
Resource.[content] DM.data β†’ Cluster Data

2.3 Hierarchical Composition Patterns

FHIR Nesting:


Patient
β”œβ”€β”€ identifier[] (Identifier datatypes)
β”œβ”€β”€ name[] (HumanName datatypes)
β”œβ”€β”€ telecom[] (ContactPoint datatypes)
└── address[] (Address datatypes)

SDC4 Nesting (clusters = reusable components):


DM: Patient Demographics
└── data: Patient Cluster
    β”œβ”€β”€ identifier_mrn β†’ @FHIR:Identifier
    β”œβ”€β”€ identifier_ssn β†’ @FHIR:Identifier
    β”œβ”€β”€ name_legal β†’ @FHIR:HumanName
    β”œβ”€β”€ name_preferred β†’ @FHIR:HumanName
    β”œβ”€β”€ phone_mobile β†’ @FHIR:ContactPoint
    β”œβ”€β”€ email β†’ @FHIR:ContactPoint
    └── address_home β†’ @FHIR:Address

Key Insight: FHIR's compositional model (resource contains datatypes) perfectly matches SDC4's hierarchical model (DM β†’ Cluster β†’ sub-Clusters β†’ Components).

2.4 Semantic Preservation Over Structural Mimicry

Goal: Preserve FHIR's semantic meaning, not replicate its exact structure.

Example: FHIR CodeableConcept

Structural Mimicry (❌ Too Literal):


## Sub-Cluster: CodeableConcept
  ## Sub-Cluster: Coding (repeating)
    ### Column: system
    **Type**: url
    ### Column: code
    **Type**: text
    ### Column: display
    **Type**: text
  ### Column: text
  **Type**: text

Semantic Preservation (βœ… Content-Compliant):


### Column: diagnosis_code
**Type**: text
**Description**: Primary diagnosis code
**Enumeration**: [ICD-10 codes here]
**Semantic Links**:
  - http://hl7.org/fhir/sid/icd-10/E11.9 (Type 2 diabetes)
  - http://snomed.info/sct/44054006 (Type 2 diabetes mellitus)
**Examples**: E11.9, E11.65, E11.22

This uses:

3. Native vs @FHIR Decision Framework

3.1 Decision Tree


                    FHIR Concept
                         |
                         v
            Does SDC4 have native pattern?
                    /         \
                  YES          NO
                   |            |
                   v            v
         Use Native SDC4    Is it reusable
              (DONE!)       across resources?
                                /         \
                              YES          NO
                               |            |
                               v            v
                        Create @FHIR   Direct mapping
                         Cluster        in template

3.2 Use Native SDC4 When...

βœ… Exact semantic match exists

βœ… Metadata or lifecycle tracking

βœ… Structural pattern already implemented

3.3 Create @FHIR Cluster When...

πŸ”§ Unique FHIR structure

πŸ”§ Reusable across multiple FHIR resources

πŸ”§ Complex composition not in SDC4

3.4 Direct Map (No Cluster) When...

⚑ Simple primitive type

⚑ Single-use complex pattern

3.5 Quick Reference Table

FHIR Element SDC4 Approach Rationale
Range βœ… Native ReferenceRange Already exists
Period βœ… Native XdInterval or two XdTemporal Simpler
Meta βœ… Native DM fields Metadata at DM level
Provenance βœ… Native DM.audit/creator Already tracked
Signature βœ… Native Attestation Built-in
Coding (single) βœ… Native pred_obj More flexible
Identifier πŸ”§ @FHIR:Identifier Unique structure
HumanName πŸ”§ @FHIR:HumanName Unique structure
Address πŸ”§ @FHIR:Address Unique structure
ContactPoint πŸ”§ @FHIR:ContactPoint Unique structure
CodeableConcept πŸ”§ @FHIR:CodeableConcept Complex, reusable
Reference πŸ”§ @FHIR:Reference Links everywhere
Quantity ⚑ Direct XdQuantity Simple mapping
boolean ⚑ Direct XdBoolean Primitive
string ⚑ Direct XdString Primitive
date ⚑ Direct XdTemporal Primitive

4. Vocabulary and Terminology Architecture

4.1 SDC4's Multi-Vocabulary Semantic Linking

Core Principle: SDC4 allows components to be semantically linked to multiple vocabularies simultaneously using RDF predicates, putting semantic definition control in the hands of the domain expert (modeler).

Architecture Overview


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Component Semantic Definition System                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚  Component (e.g., "Blood Glucose Observation")              β”‚
β”‚        ↓                                                     β”‚
β”‚   semantic_links (ManyToMany)                               β”‚
β”‚        ↓                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚   β”‚  PredObj (Predicate-Object pairs)     β”‚                β”‚
β”‚   β”‚  ────────────────────────────────────  β”‚                β”‚
β”‚   β”‚  predicate: rdfs:seeAlso              β”‚                β”‚
β”‚   β”‚  object_uri: http://loinc.org|2339-0  β”‚ ← LOINC       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚   β”‚  PredObj                               β”‚                β”‚
β”‚   β”‚  ────────────────────────────────────  β”‚                β”‚
β”‚   β”‚  predicate: skos:exactMatch           β”‚                β”‚
β”‚   β”‚  object_uri: http://snomed.../33747003 β”‚ ← SNOMED CT   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚   β”‚  PredObj                               β”‚                β”‚
β”‚   β”‚  ────────────────────────────────────  β”‚                β”‚
β”‚   β”‚  predicate: rdf:type                  β”‚                β”‚
β”‚   β”‚  object_uri: http://local.../GLU-001  β”‚ ← Local Codes β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚                                                              β”‚
β”‚  Result: ONE component β†’ THREE vocabularies                 β”‚
β”‚          Direct cross-vocabulary mapping                    β”‚
β”‚          No UMLS intermediate needed!                       β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Architectural Components

1. PredObj Model (src/dmgen/models.py):


class PredObj(models.Model):
    """Represents RDF triple objects for semantic linking"""
    po_name = CharField(max_length=100)         # Human-readable name
    predicate = ForeignKey(Predicate)           # RDF predicate
    object_uri = CharField(max_length=2000)     # Target vocabulary URI
    project = ForeignKey(Project)               # Organizing project
    public = BooleanField(default=True)         # Availability

2. Predicate Model:


class Predicate(models.Model):
    """RDF predicates for semantic relationships"""
    ns_abbrev = ForeignKey(NS)         # Namespace (rdfs, skos, owl, etc.)
    class_name = CharField()           # Predicate name (seeAlso, exactMatch, etc.)

3. Namespace Model (NS):


class NS(models.Model):
    """Namespace definitions for vocabularies"""
    abbrev = CharField()               # e.g., "loinc", "snomed", "rdfs"
    uri = CharField()                  # Full namespace URI

4. Component Integration:

All XdAny subclasses (XdString, XdQuantity, XdToken, etc.) inherit:


pred_obj = models.ManyToManyField('PredObj', related_name='%(class)s_links')

RDF Predicates Supported

Predicate Namespace Use Case Example
rdfs:seeAlso RDFS Related concept Component β†’ related LOINC code
rdfs:isDefinedBy RDFS Definition source Component β†’ defining vocabulary
skos:exactMatch SKOS Exact equivalent LOINC code ≑ SNOMED concept
skos:closeMatch SKOS Close equivalent Similar but not identical
skos:broadMatch SKOS Broader concept Specific β†’ general
skos:narrowMatch SKOS Narrower concept General β†’ specific
owl:sameAs OWL Identical resource Same thing, different URI
rdf:type RDF Type/class relationship Instance β†’ class
dct:subject Dublin Core Subject/topic Content classification

Modeler Flexibility: Domain expert chooses appropriate predicate based on semantic relationship.

4.2 Runtime Enumeration vs Semantic Definition

Critical Distinction: SDC4 separates runtime constraints from semantic meaning.


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TWO ORTHOGONAL CONCEPTS FOR COMPONENT DEFINITIONS           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                             β”‚
β”‚ 1️⃣ RUNTIME ENUMERATION                                     β”‚
β”‚    What values CAN BE ENTERED                              β”‚
β”‚    ───────────────────────────────────────────────────     β”‚
β”‚    β€’ Implemented in XdString/XdToken.enums field           β”‚
β”‚    β€’ Dropdown selections in data entry UI                  β”‚
β”‚    β€’ Database constraint validation                        β”‚
β”‚    β€’ Fixed, small set of allowed values                    β”‚
β”‚    β€’ Example: "Male, Female, Other, Unknown"               β”‚
β”‚                                                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                             β”‚
β”‚ 2️⃣ SEMANTIC DEFINITION                                     β”‚
β”‚    What does this component MEAN                           β”‚
β”‚    ────────────────────────────────────────────────────    β”‚
β”‚    β€’ Implemented via semantic_links (M2M to PredObj)       β”‚
β”‚    β€’ Ontology integration (LOINC, SNOMED, local)           β”‚
β”‚    β€’ RDF triple generation                                 β”‚
β”‚    β€’ Multiple vocabularies simultaneously                  β”‚
β”‚    β€’ Example: Links to AdministrativeGender ValueSet       β”‚
β”‚                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

When to Use Each

Scenario Runtime Enum Semantic Links Both Example
Open vocabulary ❌ βœ… ❌ FHIR Observation.code (any LOINC/SNOMED)
Fixed ValueSet βœ… βœ… βœ… FHIR Observation.status (registered/final/amended)
Ontology mapping only ❌ βœ… ❌ FHIR Identifier.system (URI namespace)
Simple dropdown βœ… ❌ ❌ Survey question "Yes/No/Maybe" (no ontology)
Administrative codes βœ… βœ… βœ… FHIR Patient.gender (M/F/O/U + AdministrativeGender)

Key Insight: Runtime enumeration answers "What can I select?", semantic links answer "What does it mean?"

4.3 FHIR Terminology Datatypes Mapping

Coding (Single Code)

FHIR Structure:


{
  "code": "8867-4",
  "system": "http://loinc.org",
  "display": "Heart rate",
  "userSelected": true
}

SDC4 Mapping Options:

Option 1: Native pred_obj (Recommended for single codes):


#### Column: observation_code
**Type**: text
**Description**: Vital sign observation code
**SemanticLinks**:
- http://loinc.org|8867-4 (Heart rate - LOINC)
- http://snomed.info/sct|364075005 (Heart rate observable - SNOMED)
- http://terminology.hl7.org/CodeSystem/observation-category|vital-signs (FHIR category)

βœ… Result: Component with 3 semantic_links to 3 vocabularies

Option 2: @FHIR:Coding cluster (Only if full structure needed):

Create cluster with system, code, display, version, userSelected fields.

Decision: Use Option 1 (pred_obj) for most FHIR Coding elements.

CodeableConcept (Multiple Codes + Text)

FHIR Structure:


{
  "coding": [
    {"system": "http://hl7.org/fhir/sid/icd-10", "code": "E11.9", "display": "Type 2 DM"},
    {"system": "http://snomed.info/sct", "code": "44054006", "display": "DM Type 2"},
    {"system": "http://local.hospital.org", "code": "DIAB2", "display": "Diabetes II"}
  ],
  "text": "Type 2 Diabetes Mellitus"
}

SDC4 Mapping: Create @FHIR:CodeableConcept cluster


## Sub-Cluster: diagnosis_code
**ReuseComponent**: @FHIR:CodeableConcept
**Description**: Patient diagnosis

### Within @FHIR:CodeableConcept definition:

#### Column: coding_1_code
**Type**: text
**SemanticLinks**:
- http://hl7.org/fhir/sid/icd-10|E11.9 (Type 2 diabetes - ICD-10)

#### Column: coding_2_code
**Type**: text
**SemanticLinks**:
- http://snomed.info/sct|44054006 (Diabetes mellitus type 2 - SNOMED)

#### Column: coding_3_code
**Type**: text
**SemanticLinks**:
- http://local.hospital.org/diagnoses|DIAB2 (Local hospital code)

#### Column: text
**Type**: text
**Description**: Human-readable diagnosis description

βœ… Result: Each coding has independent semantic_links - cross-vocabulary mapping within one CodeableConcept!

ValueSet References

FHIR: ValueSet URIs define sets of allowed codes

SDC4 Mapping: Combine runtime enumeration + semantic link to ValueSet


#### Column: observation_status
**Type**: text
**Enumeration**:
- registered: Initial registration
- preliminary: Early results
- final: Final verified results
- amended: Modified after final
- corrected: Corrected results
- cancelled: Cancelled observation
**SemanticLinks**:
- http://hl7.org/fhir/ValueSet/observation-status (FHIR ValueSet definition)
- http://terminology.hl7.org/CodeSystem/observation-status (CodeSystem)

βœ… Result: Runtime dropdown + semantic link to FHIR ValueSet for interoperability

4.4 Advantages Over UMLS Approach

Traditional UMLS Approach:


LOINC:2339-0 β†’ UMLS:C0428568 β†’ SNOMED:33747003
              ↑
         Intermediate
         metathesaurus

SDC4 Direct Mapping Approach:


Component "Blood Glucose"
    ↓ rdfs:seeAlso
    β”œβ”€β†’ LOINC:2339-0
    ↓ skos:exactMatch
    β”œβ”€β†’ SNOMED:33747003
    ↓ rdf:type
    └─→ Local:GLU-001

No intermediate vocabulary!

Benefits:

  1. Domain Expert Control: Modeler directly assigns semantic mappings, no vocabulary service dependency
  2. No Intermediate: Direct LOINC ↔ SNOMED mapping without UMLS concepts
  3. Flexible Predicates: Use appropriate RDF predicate for relationship type (exactMatch, seeAlso, etc.)
  4. Local Code Integration: Hospital/organization codes alongside standard vocabularies
  5. RDF Native: Generates proper RDF triples for semantic web integration
  6. Multiple Relationships: One component can have different predicate types to different vocabularies

4.5 MD2PD Template Syntax

Semantic Links in Templates:


**SemanticLinks**:
- http://loinc.org|8867-4 (Heart rate)
- http://snomed.info/sct|364075005 (Heart rate observable)
- http://local.codes|HR (Local code)

Current Implementation: URIs only, predicates assigned by semantic linking service

Parsed Structure:


column.semantic_links = [
    {'uri': 'http://loinc.org|8867-4 (Heart rate)'},
    {'uri': 'http://snomed.info/sct|364075005 (Heart rate observable)'},
    {'uri': 'http://local.codes|HR (Local code)'}
]

Agent Processing: Semantic linking service creates PredObj instances with appropriate predicates

4.6 FHIR-Specific Vocabulary Integration

Major FHIR Code Systems to leverage with semantic_links:

Code System URI Use Case Example
LOINC http://loinc.org Lab/observation codes Glucose, cholesterol, vital signs
SNOMED CT http://snomed.info/sct Clinical terms Diagnoses, procedures, findings
RxNorm http://www.nlm.nih.gov/research/umls/rxnorm Medications Drug names, ingredients
ICD-10 http://hl7.org/fhir/sid/icd-10 Diagnoses Diagnosis codes
CPT http://www.ama-assn.org/go/cpt Procedures Procedure codes (US)
UCUM http://unitsofmeasure.org Units mg/dL, mm[Hg], beats/min
HL7 V3 http://terminology.hl7.org/CodeSystem/v3-* Administrative Gender, marital status
FHIR ValueSets http://hl7.org/fhir/ValueSet/* Value sets observation-status, etc.

Implementation Strategy:

Part II: Datatype Analysis (Bottom-Up)

⚠️ IMPORTANT: Before implementing any FHIR datatype, consult Part I: Holistic Architecture View to check if SDC4 already has a native pattern that matches the semantic intent. Using native SDC4 patterns reduces duplication and improves semantic alignment.

>

Key Native Patterns:
- Range/ReferenceRange β†’ Use native ReferenceRange (M2M on XdQuantified)
- Period β†’ Use native XdInterval or two XdTemporal fields
- Meta β†’ Use native DM fields (created, updated, audit)
- Provenance β†’ Use native DM.creator, DM.audit, Audit model
- Signature β†’ Use native Attestation
- Coding (single) β†’ Use native pred_obj (PredObj model)

>

Decision Framework: See Section 3: Native vs @FHIR Decision Framework

4. Complete FHIR Datatypes Inventory

1.1 Primitive Types (19 total)

Simple, single-value types with no child elements

FHIR Type Description SDC4 Mapping Priority Notes
boolean True/false values XdBoolean HIGH Direct 1:1 mapping
integer Signed 32-bit (-2B to 2B) XdCount HIGH Most common numeric type
string Unicode text (up to 1MB) XdString HIGH Core text type
decimal Rational numbers (18 digits) XdQuantity HIGH Precision-critical measurements
uri Uniform Resource Identifier XdLink HIGH References and identifiers
url Uniform Resource Locator XdLink HIGH Web addresses
canonical URI with version XdLink MEDIUM Versioned resource references
date YYYY-MM-DD format XdTemporal HIGH Date-only values
dateTime Date with optional time/TZ XdTemporal HIGH Timestamps
time hh:mm:ss format XdTemporal MEDIUM Time-only values
instant Precise system timestamp XdTemporal MEDIUM Audit timestamps
code Constrained string from ValueSet XdToken HIGH Terminology codes
id 64-char ASCII identifier XdString MEDIUM Resource IDs
uuid UUID as URI XdString MEDIUM Globally unique IDs
oid Object Identifier XdString LOW Legacy identifiers
base64Binary Base64-encoded bytes XdFile MEDIUM Binary data
markdown CommonMark formatted text XdString LOW Rich text content
positiveInt 1 to 2B XdCount MEDIUM Positive counts only
unsignedInt 0 to 2B XdCount MEDIUM Non-negative counts
integer64 64-bit integers XdDouble LOW Large counters

Complexity: SIMPLE - All are primitive single values

Critical for Interoperability: boolean, integer, string, decimal, date, dateTime, code

Reference: https://www.hl7.org/fhir/datatypes.html#primitive

1.2 General-Purpose Datatypes (18 total)

Complex, reusable structures for common clinical patterns

1.2.1 Basic Information Structures

FHIR Type Description SDC4 Mapping Priority Complexity
Identifier Business ID with namespace Cluster with XdString components CRITICAL MEDIUM
HumanName Person's name (parts) Cluster with XdString components CRITICAL HIGH
Address Physical/postal location Cluster with XdString/XdToken CRITICAL HIGH
ContactPoint Phone/email/fax Cluster with XdString/XdToken CRITICAL MEDIUM
Period Start/end time span βœ… Use Native XdInterval or two XdTemporal fields (see Part I) HIGH LOW

Structure Example - Identifier:


Cluster: Identifier
  - use: XdToken (enum: usual, official, temp, secondary)
  - type: XdToken (CodeableConcept)
  - system: XdLink (namespace URI)
  - value: XdString (actual identifier)
  - period: Period cluster
  - assigner: Reference cluster

1.2.2 Clinical Measurements

FHIR Type Description SDC4 Mapping Priority Complexity
Quantity Value with units XdQuantity CRITICAL MEDIUM
SimpleQuantity Quantity without comparator XdQuantity HIGH LOW
Range Low/high boundaries βœ… Use Native ReferenceRange (see Part I) HIGH LOW
Ratio Numerator/denominator Cluster with 2 XdQuantity MEDIUM LOW
RatioRange Range of ratios Cluster with XdQuantity LOW MEDIUM
SampledData Time-series waveform XdDecimalList + metadata MEDIUM VERY HIGH

Structure Example - Quantity:


Quantity maps to XdQuantity with:
  - value: decimal magnitude
  - comparator: XdToken (enum: <, <=, >=, >)
  - unit: units string
  - system: UCUM code system URI
  - code: UCUM code

1.2.3 Content & References

FHIR Type Description SDC4 Mapping Priority Complexity
CodeableConcept Multiple codes + text Cluster with XdToken array + semantic_links CRITICAL HIGH
Coding Single terminology code βœ… Use native predobj (semanticlinks) OR Cluster CRITICAL MEDIUM
Attachment Binary data with metadata Cluster with XdFile HIGH MEDIUM
Annotation Timestamped comment Cluster with XdString/XdTemporal MEDIUM LOW
Signature Digital signature βœ… Use native Attestation LOW HIGH
Money Currency amount XdQuantity (currency units) MEDIUM LOW
⭐ IMPORTANT: For FHIR Coding/CodeableConcept, leverage SDC4's semanticlinks (predobj) system:
- Single FHIR Coding β†’ Use native predobj with semanticlinks to multiple vocabularies (LOINC + SNOMED + local)
- FHIR CodeableConcept β†’ Create @FHIR:CodeableConcept cluster where each coding[] element has its own semantic_links
- Multi-vocabulary mapping: One component can link to LOINC AND SNOMED AND local codes without UMLS intermediate
- Domain expert control: Modeler assigns semantic mappings directly
- See: Section 4: Vocabulary and Terminology Architecture for complete details

Structure Example - CodeableConcept (with semantic_links):


Cluster: CodeableConcept
  - coding: List of Coding clusters
    - system: XdLink (code system URI)
    - version: XdString
    - code: XdToken
    - display: XdString
    - userSelected: XdBoolean
  - text: XdString (human-readable)

Reference: https://www.hl7.org/fhir/datatypes.html#general-purpose

1.3 Metadata Types (11 total)

Specialized for resource documentation and specifications

FHIR Type Description SDC4 Mapping Priority Complexity
ContactDetail Contact info for org/person Cluster with ContactPoint MEDIUM MEDIUM
Contributor Author/editor metadata Cluster with XdString/XdToken LOW LOW
UsageContext Applicability context Cluster with XdToken MEDIUM MEDIUM
DataRequirement Data query specification Custom complex cluster LOW VERY HIGH
ParameterDefinition Function parameter spec Custom cluster LOW HIGH
RelatedArtifact External documentation link Cluster with XdLink/XdString LOW MEDIUM
TriggerDefinition Event trigger condition Custom cluster LOW VERY HIGH
Expression FHIRPath/CQL logic XdString (expression text) LOW MEDIUM
ExtendedContactDetail Enhanced contact with availability Cluster expansion LOW HIGH
VirtualServiceDetail Telehealth endpoints Cluster with XdLink/XdString MEDIUM MEDIUM
AvailabilityMonetaryComponent Pricing components XdQuantity with metadata LOW LOW

Complexity: MEDIUM to VERY HIGH

Critical: None (mostly for metadata, not clinical data)

Reference: https://www.hl7.org/fhir/datatypes.html#metadata

1.4 Special Purpose Datatypes (8 total)

Domain-specific implementations

FHIR Type Description SDC4 Mapping Priority Complexity
Reference Link to another resource Cluster with XdLink/XdString CRITICAL MEDIUM
Narrative XHTML human-readable text XdString or XdFile HIGH MEDIUM
Extension Custom data elements Dynamic cluster MEDIUM HIGH
Meta Resource metadata Cluster with timestamps/tags MEDIUM HIGH
Dosage Medication instructions Custom complex cluster HIGH VERY HIGH
ElementDefinition Element constraints Not mapped (internal to FHIR) LOW VERY HIGH
xhtml Valid XHTML content XdString or XdFile MEDIUM MEDIUM
CodeableReference Code OR reference hybrid Union cluster MEDIUM MEDIUM

Structure Example - Reference:


Cluster: Reference
  - reference: XdLink (relative or absolute)
  - type: XdLink (resource type URL)
  - identifier: Identifier cluster
  - display: XdString (text description)

Structure Example - Dosage (VERY COMPLEX):


Cluster: Dosage
  - sequence: XdCount
  - text: XdString
  - additionalInstruction: CodeableConcept array
  - patientInstruction: XdString
  - timing: Timing cluster (itself complex)
  - asNeeded: XdBoolean OR CodeableConcept
  - site: CodeableConcept
  - route: CodeableConcept
  - method: CodeableConcept
  - doseAndRate: Complex sub-cluster
    - type: CodeableConcept
    - dose: Range OR Quantity
    - rate: Ratio OR Range OR Quantity
  - maxDosePerPeriod: Ratio array
  - maxDosePerAdministration: Quantity
  - maxDosePerLifetime: Quantity

Reference: https://www.hl7.org/fhir/datatypes.html#special-purpose

2. Current SDC4 Component Types in SDCStudio

Analysis from: src/dmgen/models.py

2.1 Core Components (Inherit from XdAny)

SDC4 Type Purpose Fields Complexity
XdBoolean True/false values trues, falses (custom labels) SIMPLE
XdLink URLs and links link, relation, relation_uri SIMPLE
XdString Free text min/max/exactlength, enums, strfmt, def_val MEDIUM
XdToken Categorical text Similar to XdString + language MEDIUM
XdFile Binary files mediatype, encoding, language, alttxt, content_mode MEDIUM

2.2 Ordered Types (Inherit from XdOrdered)

SDC4 Type Purpose Fields Complexity
XdOrdinal Ranked enumeration ordinals, symbols, annotations MEDIUM
XdTemporal Dates/times allowduration, allowdate, allowtime, allowdatetime, etc. HIGH
XdInterval Ranges lower, upper, interval_type, included flags, units MEDIUM

2.3 Quantified Types (Inherit from XdQuantified)

SDC4 Type Purpose Fields Complexity
XdCount Integer counts with units min/max_magnitude (int), units (FK) MEDIUM
XdQuantity Decimal measurements fraction_digits, units (FK), min/max constraints HIGH
XdFloat Floating point units (FK), standard quantified fields MEDIUM
XdDouble High precision decimal units (FK), standard quantified fields MEDIUM

Note: All XdQuantified types have magnitude status, error, and accuracy flags.

2.4 List Types

SDC4 Type Purpose Fields Complexity
XdBooleanList Boolean arrays min/max/exactitems, allowduplicates, ordered SIMPLE
XdStringList Text arrays Similar cardinality controls SIMPLE
XdTokenList Categorical arrays Similar cardinality controls SIMPLE
XdDecimalList Decimal arrays Units + quantified properties MEDIUM
XdDoubleList High precision arrays Units + quantified properties MEDIUM
XdIntegerList Integer arrays Units + quantified properties MEDIUM
XdNonNegativeIntegerList Non-negative arrays Units + quantified properties MEDIUM
XdPositiveIntegerList Positive arrays Units + quantified properties MEDIUM

2.5 Structural Components

SDC4 Type Purpose Complexity
Cluster Hierarchical grouping HIGH
ReferenceRange Normal/critical ranges MEDIUM
SimpleReferenceRange Simplified ranges MEDIUM

2.6 Missing Types (Not Currently Implemented)

Based on FHIR analysis, SDCStudio is missing:

3. FHIR-to-SDC4 Mapping Strategy

3.1 Direct Mappings (Simple Types)

FHIR Type SDC4 Type Confidence Notes
boolean XdBoolean 100% Perfect match
integer XdCount 95% Add units="count"
positiveInt XdCount 95% Add constraint: min=1
unsignedInt XdCount 95% Add constraint: min=0
decimal XdQuantity 90% Need units context
string XdString 100% Perfect match
code XdToken 95% Enumeration required
date XdTemporal 100% Set allow_date=True
dateTime XdTemporal 100% Set allow_datetime=True
time XdTemporal 100% Set allow_time=True
instant XdTemporal 100% Set allow_datetime=True
uri XdLink 90% May need validation
url XdLink 95% Perfect for links
canonical XdLink 90% Version handling needed
base64Binary XdFile 85% Set content_mode appropriately

3.2 Complex Cluster Mappings

Identifier (CRITICAL)

MD2PD Template:


## Sub-Cluster: Identifier
**ReuseComponent**: @FHIR:Identifier
**Description**: Business identifier with namespace and validity period

### Column: use
**Type**: text
**Description**: Purpose of this identifier
**Enumeration**:
  - usual: Usual
  - official: Official
  - temp: Temporary
  - secondary: Secondary
**Constraints**:
  - required: false

### Column: type_code
**Type**: text
**Description**: Type of identifier (coded)
**Constraints**:
  - required: false

### Column: system
**Type**: url
**Description**: Namespace for the identifier value
**Examples**: http://hospital.org/patient-ids, urn:oid:2.16.840.1.113883.4.1

### Column: value
**Type**: text
**Description**: The actual identifier value
**Constraints**:
  - required: true
**Examples**: 12345, MRN-987654, SSN-123-45-6789

### Column: period_start
**Type**: date
**Description**: When identifier is/was valid from
**Constraints**:
  - required: false

### Column: period_end
**Type**: date
**Description**: When identifier is/was valid to
**Constraints**:
  - required: false

SDC4 Implementation: Create reusable Cluster with label "FHIR:Identifier"

HumanName (CRITICAL)

MD2PD Template:


## Sub-Cluster: HumanName
**ReuseComponent**: @FHIR:HumanName
**Description**: Person's name with use context and parts

### Column: use
**Type**: text
**Description**: How this name is used
**Enumeration**:
  - usual: Usual
  - official: Official
  - temp: Temporary
  - nickname: Nickname
  - anonymous: Anonymous
  - old: Old/previous
  - maiden: Maiden name
**Constraints**:
  - required: false

### Column: text
**Type**: text
**Description**: Full name as it should be displayed
**Examples**: Dr. John Smith Jr., Ms. Jane Doe

### Column: family
**Type**: text
**Description**: Family name/surname/last name
**Examples**: Smith, Doe, Johnson

### Column: given
**Type**: text
**Description**: Given names (space-separated)
**Examples**: John Michael, Jane Elizabeth

### Column: prefix
**Type**: text
**Description**: Parts before the name
**Examples**: Dr., Ms., Mr., Prof.

### Column: suffix
**Type**: text
**Description**: Parts after the name
**Examples**: Jr., III, MD, PhD

### Column: period_start
**Type**: date
**Description**: When this name was/is in use from
**Constraints**:
  - required: false

### Column: period_end
**Type**: date
**Description**: When this name was/is in use to
**Constraints**:
  - required: false

Address (CRITICAL)

MD2PD Template:


## Sub-Cluster: Address
**ReuseComponent**: @FHIR:Address
**Description**: Physical or postal address with use context

### Column: use
**Type**: text
**Description**: Purpose of this address
**Enumeration**:
  - home: Home
  - work: Work
  - temp: Temporary
  - old: Old/previous
  - billing: Billing
**Constraints**:
  - required: false

### Column: type
**Type**: text
**Description**: Postal vs physical address
**Enumeration**:
  - postal: Postal
  - physical: Physical location
  - both: Both postal and physical
**Constraints**:
  - required: false

### Column: text
**Type**: text
**Description**: Full address as displayed
**Examples**: 123 Main St, Apt 4B, Springfield, IL 62701 USA

### Column: line_1
**Type**: text
**Description**: Street address line 1
**Examples**: 123 Main Street, PO Box 456

### Column: line_2
**Type**: text
**Description**: Street address line 2 (apartment, suite, etc.)
**Examples**: Apt 4B, Suite 200

### Column: city
**Type**: text
**Description**: City name
**Examples**: Springfield, Chicago, New York

### Column: district
**Type**: text
**Description**: District/county
**Examples**: Cook County, Kings County

### Column: state
**Type**: text
**Description**: State/province/territory
**Examples**: IL, CA, NY, Ontario

### Column: postal_code
**Type**: text
**Description**: Postal or ZIP code
**Examples**: 62701, 90210, M5H 2N2

### Column: country
**Type**: text
**Description**: Country (ISO 3166 code preferred)
**Examples**: US, CA, GB, AU

### Column: period_start
**Type**: date
**Description**: When address was/is valid from
**Constraints**:
  - required: false

### Column: period_end
**Type**: date
**Description**: When address was/is valid to
**Constraints**:
  - required: false

Quantity (CRITICAL)

MD2PD Template:


## Sub-Cluster: Quantity
**ReuseComponent**: @FHIR:Quantity
**Description**: Measured amount with units and comparator

### Column: value
**Type**: decimal
**Description**: Numeric value of the measurement
**Examples**: 5.5, 120.0, 98.6

### Column: comparator
**Type**: text
**Description**: How to interpret the value
**Enumeration**:
  - <: Less than
  - <=: Less than or equal to
  - >=: Greater than or equal to
  - >: Greater than
**Constraints**:
  - required: false

### Column: unit
**Type**: text
**Description**: Unit representation (display)
**Examples**: kg, mg/dL, mmHg, celsius

### Column: system
**Type**: url
**Description**: System that defines the coded unit form
**Examples**: http://unitsofmeasure.org
**Constraints**:
  - required: false

### Column: code
**Type**: text
**Description**: Coded form of the unit (UCUM)
**Examples**: kg, mg/dL, mm[Hg], Cel
**Constraints**:
  - required: false

Implementation Note: Can map simplified version directly to XdQuantity with UCUM units.

CodeableConcept (CRITICAL)

MD2PD Template:


## Sub-Cluster: CodeableConcept
**ReuseComponent**: @FHIR:CodeableConcept
**Description**: Concept with multiple codes from different terminologies

### Column: text
**Type**: text
**Description**: Plain text representation of the concept
**Examples**: Type 2 Diabetes Mellitus, Hypertension

## Sub-Cluster: Coding
**Parent**: CodeableConcept
**Description**: Individual code from a terminology
**Cardinality**: 0..*

### Column: system
**Type**: url
**Description**: Terminology system URL
**Examples**: http://snomed.info/sct, http://loinc.org, http://hl7.org/fhir/sid/icd-10

### Column: version
**Type**: text
**Description**: Version of the code system
**Examples**: 2023-03, 2.74

### Column: code
**Type**: text
**Description**: Code value from the system
**Examples**: 44054006, 8867-4, E11.9

### Column: display
**Type**: text
**Description**: Human-readable meaning
**Examples**: Type 2 diabetes mellitus, Heart rate, Type 2 diabetes without complications

### Column: userSelected
**Type**: boolean
**Description**: Was this code selected by the user directly
**Constraints**:
  - required: false

Challenge: Repeating Coding element requires list handling or multiple row approach.

Reference (CRITICAL)

MD2PD Template:


## Sub-Cluster: Reference
**ReuseComponent**: @FHIR:Reference
**Description**: Link to another FHIR resource

### Column: reference
**Type**: url
**Description**: Literal reference (relative or absolute URI)
**Examples**: Patient/123, http://fhir.example.org/Patient/456

### Column: type
**Type**: url
**Description**: Type of resource being referenced
**Examples**: http://hl7.org/fhir/StructureDefinition/Patient

### Column: display
**Type**: text
**Description**: Text alternative for the reference
**Examples**: John Smith (MRN: 12345), Dr. Jane Doe

Simplified version - Full version includes embedded Identifier cluster.

ContactPoint (CRITICAL)

MD2PD Template:


## Sub-Cluster: ContactPoint
**ReuseComponent**: @FHIR:ContactPoint
**Description**: Phone, email, fax, or other contact details

### Column: system
**Type**: text
**Description**: Type of contact point
**Enumeration**:
  - phone: Phone
  - fax: Fax
  - email: Email
  - pager: Pager
  - url: URL
  - sms: SMS
  - other: Other
**Constraints**:
  - required: false

### Column: value
**Type**: text
**Description**: The actual contact value
**Examples**: (555) 123-4567, john.smith@example.com, http://example.com

### Column: use
**Type**: text
**Description**: Purpose of this contact point
**Enumeration**:
  - home: Home
  - work: Work
  - temp: Temporary
  - old: Old/incorrect
  - mobile: Mobile
**Constraints**:
  - required: false

### Column: rank
**Type**: integer
**Units**: priority
**Description**: Preference order (1 = highest)
**Constraints**:
  - range: [1, 999]
  - required: false

### Column: period_start
**Type**: date
**Description**: When contact point was/is valid from
**Constraints**:
  - required: false

### Column: period_end
**Type**: date
**Description**: When contact point was/is valid to
**Constraints**:
  - required: false

3.3 Specialized Cluster Mappings

Period

βœ… USE NATIVE SDC4: Use XdInterval model or two XdTemporal fields instead of creating @FHIR:Period. See Section 1: SDC4 Native Patterns.

Native approach (if using XdInterval):

Old cluster approach (not recommended):

Range

βœ… USE NATIVE SDC4: Use ReferenceRange model (M2M on XdQuantified) instead of creating @FHIR:Range. See Section 1.1: ReferenceRange.

Native approach:

Old cluster approach (not recommended):

Timing (VERY COMPLEX)

Used for medication schedules, appointments. Requires extensive cluster with:

Priority: MEDIUM (healthcare-specific, very complex)

Dosage (VERY COMPLEX)

See structure example in Section 1.4 - extremely complex with nested choice types and arrays.

Priority: HIGH for medication workflows, but implement AFTER simpler types

4. Implementation Priority Recommendations

Tier 1: CRITICAL (Implement First)

These are foundational and used across ALL FHIR resources

  1. Identifier - Every resource has identifiers
  2. HumanName - Patient, Practitioner, Person, RelatedPerson
  3. Address - Patient, Organization, Location, Practitioner
  4. CodeableConcept - Diagnoses, procedures, medications, observations
  5. Reference - Links between all resources
  6. Quantity - All measurements, vital signs, lab results
  7. ContactPoint - Contact information for persons/organizations

Estimated Effort: 3-4 weeks for all Tier 1 components

Impact: Enables 80% of common FHIR use cases

Dependencies: None - can start immediately

Success Criteria:

Tier 2: HIGH (Implement Second)

Clinical and operational essentials

⚠️ REVISED based on holistic analysis: Period and Range use native SDC4 patterns (see Part I)
  1. ~~Period~~ - βœ… Use native XdInterval or two XdTemporal fields (see Part I)
  2. ~~Range~~ - βœ… Use native ReferenceRange (see Part I)
  3. Coding - Individual codes (part of CodeableConcept) - ⚠️ Consider using native pred_obj for single codes (see Part I)
  4. Attachment - Documents, images, reports
  5. Narrative - Human-readable resource text
  6. Extension - Custom fields (extensibility)
  7. Money - Billing and claims

Estimated Effort: 1-2 weeks (reduced from 2-3 weeks due to native pattern usage)

Impact: Enables complete clinical documentation

Dependencies: Tier 1 (CodeableConcept for Attachment, Extension uses all types)

Success Criteria:

Tier 3: MEDIUM (Implement Third)

Domain-specific but common

  1. Dosage - Medication orders (VERY complex!)
  2. Timing - Schedules and recurrence (VERY complex!)
  3. Annotation - Clinical notes
  4. SampledData - Waveforms (ECG, etc.)
  5. Ratio/RatioRange - Mix ratios, dilutions
  6. Signature - Legal validation

Estimated Effort: 3-4 weeks (Dosage and Timing are very complex)

Impact: Enables specialized healthcare workflows

Dependencies: Tier 1 and 2 (Dosage uses CodeableConcept, Range, Ratio, Timing)

Success Criteria:

Tier 4: LOW (Optional/Future)

Metadata and advanced features

  1. Meta - Resource versioning
  2. UsageContext - Applicability contexts
  3. ContactDetail - Implementation guide contacts
  4. RelatedArtifact - Citations, documentation
  5. All other metadata types

Estimated Effort: 1-2 weeks

Impact: Metadata and advanced interoperability

Dependencies: All previous tiers

Success Criteria:

5. Strategic Recommendations

5.1 Component Reuse Architecture

Create FHIR Library Project:


Project Name: FHIR
Description: Fast Healthcare Interoperability Resources (HL7 FHIR R4)
Version: R4 (4.0.1)
Published: true
Public: true
Creator: SDCStudio Team
Standards: HL7 FHIR R4, ISO 13606

Metadata Fields:

Populate with Tier 1 Components:

Usage in Templates:


## Sub-Cluster: Patient Name
**ReuseComponent**: @FHIR:HumanName
**Description**: Patient's legal name

## Sub-Cluster: Patient Address
**ReuseComponent**: @FHIR:Address
**Description**: Patient's home address

## Sub-Cluster: Medical Record Number
**ReuseComponent**: @FHIR:Identifier
**Description**: Hospital-assigned patient MRN

5.2 Template Generation Strategy

Create MD2PD FHIR Templates Directory Structure:


docs/
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ fhir/
β”‚   β”‚   β”œβ”€β”€ README.md (index of all FHIR templates)
β”‚   β”‚   β”œβ”€β”€ datatypes/
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-identifier.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-humanname.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-address.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-contactpoint.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-codeableconcept.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-quantity.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-reference.md
β”‚   β”‚   β”‚   └── ... (all other datatypes)
β”‚   β”‚   β”œβ”€β”€ resources/
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-patient.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-observation.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-condition.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-procedure.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-medication-request.md
β”‚   β”‚   β”‚   β”œβ”€β”€ fhir-encounter.md
β”‚   β”‚   β”‚   └── ... (common resources)
β”‚   β”‚   └── examples/
β”‚   β”‚       β”œβ”€β”€ patient-demographics.md
β”‚   β”‚       β”œβ”€β”€ vital-signs-observation.md
β”‚   β”‚       └── medication-order.md

Template Files to Create:

  1. FHIR Datatype Templates (for building reusable components):
    • One MD2PD template per FHIR datatype
    • Upload to create @FHIR:ComponentName clusters
    • Published and marked as library components
  2. FHIR Resource Templates (for actual data models):
    • Complete resource definitions using @FHIR components
    • Patient, Observation, Condition, Procedure, etc.
    • Real-world clinical scenarios
  3. FHIR Example Templates (for learning):
    • Step-by-step examples
    • Common use cases documented
    • Best practices demonstrated

README.md Contents:


# FHIR Templates for SDCStudio

Templates for building HL7 FHIR R4 compliant data models.

## Quick Start

1. Upload datatype templates to create @FHIR library components
2. Use resource templates to build FHIR-based data models
3. Reuse @FHIR components with **ReuseComponent**: @FHIR:ComponentName

## Template Categories

- **datatypes/**: Reusable FHIR datatype components
- **resources/**: Complete FHIR resource models
- **examples/**: Learning examples and common patterns

## Priority Components (Tier 1)

Start with these critical datatypes:
- Identifier - Business identifiers
- HumanName - Person names
- Address - Physical/postal addresses
- ContactPoint - Phone/email/fax
- CodeableConcept - Coded concepts
- Quantity - Measurements
- Reference - Resource links

5.3 Type Mapping Enhancement

Extend Template Parser with FHIR-Aware Mapping:

Location: src/md2pd/agents/templateparseragent.py


# Add FHIR primitive type mappings
FHIR_TYPE_MAPPINGS = {
    'fhir:boolean': ('XdBoolean', {}),
    'fhir:integer': ('XdCount', {'units': 'count'}),
    'fhir:positiveInt': ('XdCount', {'min_magnitude': 1, 'units': 'count'}),
    'fhir:unsignedInt': ('XdCount', {'min_magnitude': 0, 'units': 'count'}),
    'fhir:decimal': ('XdQuantity', {}),
    'fhir:string': ('XdString', {}),
    'fhir:code': ('XdToken', {'requires_enumeration': True}),
    'fhir:uri': ('XdLink', {}),
    'fhir:url': ('XdLink', {}),
    'fhir:canonical': ('XdLink', {'add_version_field': True}),
    'fhir:date': ('XdTemporal', {'allow_date': True}),
    'fhir:dateTime': ('XdTemporal', {'allow_datetime': True}),
    'fhir:time': ('XdTemporal', {'allow_time': True}),
    'fhir:instant': ('XdTemporal', {'allow_datetime': True, 'precision': 'millisecond'}),
    'fhir:base64Binary': ('XdFile', {'encoding': 'base64'}),
    'fhir:id': ('XdString', {'max_length': 64}),
    'fhir:uuid': ('XdString', {'format': 'uuid'}),
    'fhir:oid': ('XdString', {'format': 'oid'}),
    'fhir:markdown': ('XdString', {'allow_formatting': True}),
    'fhir:integer64': ('XdDouble', {}),
}

def _map_fhir_type(self, type_str: str) -> Tuple[str, Dict[str, Any], str]:
    """
    Map FHIR datatype to SDC4 type with configuration.

    Args:
        type_str: Type string from template (may include 'fhir:' prefix)

    Returns:
        Tuple of (sdc4_type, config_dict, notes)
    """
    if type_str.lower().startswith('fhir:'):
        mapping = FHIR_TYPE_MAPPINGS.get(type_str.lower())
        if mapping:
            sdc4_type, config = mapping
            notes = f"FHIR type {type_str} mapped to {sdc4_type}"
            return sdc4_type, config, notes

    # Fall back to standard type mapping
    return self._map_user_friendly_type(type_str)

def _apply_fhir_config(self, column: ColumnInfo, config: Dict[str, Any]):
    """Apply FHIR-specific configuration to column."""
    if 'units' in config:
        column.units = config['units']
    if 'min_magnitude' in config:
        column.range_values = {'min': config['min_magnitude']}
    if 'requires_enumeration' in config and config['requires_enumeration']:
        # Add validation to ensure enumeration is provided
        pass
    # ... etc

Add FHIR Type Detection:


def _detect_fhir_context(self, template_content: str) -> bool:
    """
    Detect if template is using FHIR datatypes.

    Checks for:
    - **ReuseComponent**: @FHIR:* references
    - Type: fhir:* declarations
    - FHIR-specific keywords or metadata
    """
    if '@FHIR:' in template_content:
        return True
    if 'fhir:' in template_content.lower():
        return True
    return False

5.4 Validation and Constraints

FHIR-Specific Validation Rules:

  1. Identifier.system must be valid URI
  2. Quantity.system should be UCUM (http://unitsofmeasure.org)
  3. Coding.system must be valid terminology system URI (SNOMED, LOINC, etc.)
  4. Address.country should be ISO 3166 code
  5. ContactPoint.system limited to defined enumeration
  6. HumanName.use limited to defined enumeration

Implementation:

Location: src/md2pd/agents/templateparseragent.py


def _validate_fhir_constraints(self, column: ColumnInfo, validation_results: Dict):
    """
    Apply FHIR-specific validation rules.

    Args:
        column: Column to validate
        validation_results: Dictionary to accumulate validation messages
    """
    if column.reuse_project != 'FHIR':
        return

    # Identifier.system validation
    if column.reuse_label == 'Identifier' and column.name == 'system':
        if column.data_type != 'XdLink':
            validation_results['warnings'].append(
                f"FHIR Identifier.system should be XdLink (URI), got {column.data_type}"
            )

    # Quantity.system validation
    if column.reuse_label == 'Quantity' and column.name == 'system':
        if not column.examples or 'unitsofmeasure.org' not in str(column.examples):
            validation_results['suggestions'].append(
                "FHIR Quantity.system should typically be 'http://unitsofmeasure.org' for UCUM units"
            )

    # CodeableConcept.coding.system validation
    if column.reuse_label in ['CodeableConcept', 'Coding'] and column.name == 'system':
        if column.data_type != 'XdLink':
            validation_results['warnings'].append(
                f"FHIR Coding.system should be XdLink (URI), got {column.data_type}"
            )

    # ... additional FHIR-specific validations

Add to Keyword Validation:


FHIR_SPECIFIC_KEYWORDS = {
    'FHIR Version',
    'Resource Type',
    'Profile URL',
    'Must Support',
    'Binding Strength',
    'Value Set'
}

# These are documentation keywords allowed in FHIR templates
VALID_FHIR_DOC_KEYWORDS = VALID_DOC_KEYWORDS | FHIR_SPECIFIC_KEYWORDS

5.5 Documentation and Training

Create Comprehensive FHIR Documentation:

1. User Guide (docs/users/fhir-integration-guide.md)

Contents:

Structure:


# FHIR Integration Guide for SDCStudio Users

## What is FHIR?

HL7 FHIR (Fast Healthcare Interoperability Resources) is a standard for exchanging healthcare information electronically...

## Why Use FHIR Datatypes in SDCStudio?

- **Interoperability**: Models compatible with FHIR systems
- **Standards-based**: Leverage established healthcare patterns
- **Reusability**: Use pre-built @FHIR components
- **Quality**: Validated structures from HL7

## Getting Started

### Step 1: Understanding @FHIR Components

SDCStudio provides reusable FHIR components via the @FHIR project...

### Step 2: Building Your First FHIR Model

Let's create a simple Patient demographics model...

### Step 3: Using Component Reuse

Instead of defining everything from scratch, reuse @FHIR components...

2. Developer Guide (docs/dev/FHIRDATATYPEMAPPING.md)

Contents:

Structure:


# FHIR Datatype Mapping - Developer Guide

## Architecture Overview

FHIR integration in SDCStudio follows these principles:
1. Component reuse via @FHIR project
2. Type mapping in template parser
3. Validation at parsing and agent stages
4. XSD generation with FHIR compatibility

## Primitive Type Mappings

| FHIR Primitive | SDC4 Type | Config | Notes |
|----------------|-----------|--------|-------|
| boolean | XdBoolean | - | Direct mapping |
| integer | XdCount | units="count" | Default units |
...

## Complex Type Implementation

### Cluster-Based Mapping

FHIR complex types map to SDC4 Clusters with specific component patterns...

### Repeating Elements

FHIR supports arrays of complex types (e.g., CodeableConcept.coding). Current approach...

### Choice Types (value[x])

FHIR choice types represented as union clusters with cardinality constraints...

## Adding New FHIR Types

To add a new FHIR datatype to SDCStudio:
1. Create MD2PD template in `docs/templates/fhir/datatypes/`
2. Upload to create @FHIR component
3. Add type mapping if primitive
4. Add validation rules
5. Create tests
6. Update documentation

3. Template Catalog (docs/templates/fhir/README.md)

Contents:

Structure:


# FHIR Template Catalog

Complete collection of FHIR R4 datatype and resource templates for SDCStudio.

## Datatypes (50+ templates)

### Tier 1: Critical (Start Here)

| Component | Template | Complexity | Use Cases |
|-----------|----------|------------|-----------|
| Identifier | `fhir-identifier.md` | Medium | Patient IDs, MRNs, SSNs |
| HumanName | `fhir-humanname.md` | High | Patient/provider names |
| Address | `fhir-address.md` | High | Patient/facility addresses |
...

## Resources (10+ templates)

| Resource | Template | Based On | Purpose |
|----------|----------|----------|---------|
| Patient | `fhir-patient.md` | Demographics | Patient master record |
| Observation | `fhir-observation.md` | Vital Signs, Labs | Clinical measurements |
...

## Quick Reference

### Reuse Syntax

ReuseComponent: @FHIR:Identifier

ReuseComponent: @FHIR:HumanName

ReuseComponent: @FHIR:Address



### Common Patterns

**Patient Demographics Pattern**:
- Root Cluster: Patient
  - @FHIR:Identifier (MRN)
  - @FHIR:HumanName
  - @FHIR:Address
  - @FHIR:ContactPoint (phone, email)
  - Birth date
  - Gender

6. Critical Considerations and Challenges

6.1 Repeating Elements (Arrays)

Challenge: FHIR has many repeating elements that form arrays.

Examples:

Current SDCStudio Support:

Impact:

Solutions:

Option A: Multiple Rows with Parent Relationship (MVP)


Patient (Row 1):
  - id: PAT-001

Identifier (Row 2):
  - parent_id: PAT-001
  - use: official
  - system: http://hospital.org/mrn
  - value: MRN-12345

Identifier (Row 3):
  - parent_id: PAT-001
  - use: usual
  - system: urn:oid:2.16.840.1.113883.4.1
  - value: 123-45-6789

Pros:

Cons:

Option B: JSON Serialization (Simple but Lossy)


Patient (Row 1):
  - id: PAT-001
  - identifiers_json: '[{"use":"official","system":"...","value":"MRN-12345"},...]'

Pros:

Cons:

Option C: Cluster Array Support (Best, but Requires Development)


Patient (Row 1):
  - id: PAT-001
  - identifiers: [Identifier[], min=1, max=*]
    - identifier[0]: @FHIR:Identifier
    - identifier[1]: @FHIR:Identifier

Pros:

Cons:

Recommendation:

6.2 Choice Types (value[x])

Challenge: FHIR uses "choice types" where a single field can be one of multiple types.

Example: Observation.value[x] can be:

FHIR Rules:

Current SDCStudio Support:

Solutions:

Option A: Union Cluster with Cardinality (Recommended)


## Sub-Cluster: Observation Value
**Description**: Value of observation - choose ONE type

### Column: value_quantity
**Type**: decimal
**Units**: varies
**Cardinality**: 0..1
**Business Rules**: If present, other value types must be absent

### Column: value_codeable_concept
**ReuseComponent**: @FHIR:CodeableConcept
**Cardinality**: 0..1
**Business Rules**: If present, other value types must be absent

### Column: value_string
**Type**: text
**Cardinality**: 0..1
**Business Rules**: If present, other value types must be absent

### Column: value_boolean
**Type**: boolean
**Cardinality**: 0..1
**Business Rules**: If present, other value types must be absent

**Business Rules**: Exactly one value_* field must be populated

Pros:

Cons:

Option B: Separate Clusters per Type (Alternative)


## Sub-Cluster: Quantity Observation
**Description**: Observation with numeric value
- value: @FHIR:Quantity

## Sub-Cluster: Coded Observation
**Description**: Observation with coded value
- value: @FHIR:CodeableConcept

## Sub-Cluster: Text Observation
**Description**: Observation with text value
- value: XdString

Pros:

Cons:

Recommendation:

6.3 Terminology Binding

Challenge: FHIR datatypes often bind to ValueSets (controlled terminologies).

Examples:

FHIR Binding Strengths:

Solution: Pre-populate Enumerations in FHIR Component Templates

Implementation:


### Column: use
**Type**: text
**Description**: Purpose of this identifier
**Enumeration**:
  - usual: Usual
  - official: Official
  - temp: Temporary
  - secondary: Secondary
**Semantic Links**:
  - http://hl7.org/fhir/ValueSet/identifier-use
**Constraints**:
  - required: false
**Business Rules**: FHIR required binding - must use one of these codes

Benefits:

Maintenance:

6.4 Extensions

Challenge: FHIR allows arbitrary extensions to ANY datatype or resource.

Purpose:

Structure:


Extension:
  - url: URI identifying the extension definition
  - value[x]: Value of the extension (choice type)

Solution: Provide Reusable Extension Cluster Template

Template (fhir-extension.md):


## Sub-Cluster: Extension
**ReuseComponent**: @FHIR:Extension
**Description**: Optional extension to any FHIR element
**Cardinality**: 0..*

### Column: url
**Type**: url
**Description**: Identifies the meaning of the extension
**Constraints**:
  - required: true
**Examples**: http://hl7.org/fhir/StructureDefinition/patient-birthPlace

### Column: value_string
**Type**: text
**Description**: Value as string
**Cardinality**: 0..1

### Column: value_boolean
**Type**: boolean
**Description**: Value as boolean
**Cardinality**: 0..1

### Column: value_integer
**Type**: integer
**Description**: Value as integer
**Cardinality**: 0..1

### Column: value_decimal
**Type**: decimal
**Description**: Value as decimal
**Cardinality**: 0..1

### Column: value_uri
**Type**: url
**Description**: Value as URI
**Cardinality**: 0..1

### Column: value_date
**Type**: date
**Description**: Value as date
**Cardinality**: 0..1

### Column: value_datetime
**Type**: datetime
**Description**: Value as datetime
**Cardinality**: 0..1

**Business Rules**: Exactly one value_* field must be populated if extension is present

Usage in Patient Model:


## Sub-Cluster: Patient Extensions
**Description**: Custom patient data

### Extension: Birth Place
**ReuseComponent**: @FHIR:Extension
**url**: http://hl7.org/fhir/StructureDefinition/patient-birthPlace
**value_string**: City/country of birth

### Extension: Race
**ReuseComponent**: @FHIR:Extension
**url**: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
**value_codeable_concept**: Race category

Recommendation:

6.5 Version Compatibility

Challenge: FHIR has multiple versions with breaking changes.

Versions:

Key Differences:

Recommendation:

Project Naming:

6.6 Cardinality and Must Support

FHIR Cardinality:

Must Support Flag:

SDCStudio Mapping:

Example:


### Column: identifier
**ReuseComponent**: @FHIR:Identifier
**Cardinality**: 0..*
**Description**: Patient identifiers (MRN, SSN, etc.)
**Must Support**: true
**Business Rules**: System must support storing and retrieving patient identifiers

7. Implementation Roadmap

Phase 1: Foundation (Weeks 1-4)

Goal: Establish FHIR infrastructure and critical components

Week 1: Setup and Planning

Tasks:

Deliverables:

Week 2: Tier 1 Components (Part 1)

Components to Implement:

  1. βœ… Identifier
  2. βœ… HumanName
  3. βœ… Address

Tasks per Component:

Deliverables:

Week 3: Tier 1 Components (Part 2)

Components to Implement:

  1. βœ… ContactPoint
  2. βœ… Quantity
  3. βœ… Reference

Tasks: (Same as Week 2)

Deliverables:

Week 4: Tier 1 Completion and Integration

Components to Implement:

  1. βœ… CodeableConcept (complex - needs Coding too)

Integration Tasks:

Deliverables:

Phase 1 Success Criteria:

Phase 2: Expansion (Weeks 5-8)

Goal: Enable complete clinical documentation

Week 5: Tier 2 Components (Part 1)

⚠️ REVISED: Period and Range now use native SDC4 patterns (see Part I)

Components to Implement:

  1. ~~Period~~ - βœ… Use native XdInterval or two XdTemporal fields
  2. ~~Range~~ - βœ… Use native ReferenceRange
  3. βœ… Coding (or use native pred_obj for single codes)
  4. βœ… Attachment (moved from Week 6)

Tasks:

Deliverables:

Week 6: Tier 2 Components (Part 2)

⚠️ REVISED: Attachment moved to Week 5

Components to Implement:

  1. βœ… Narrative
  2. βœ… Extension
  3. βœ… Money (moved from Week 7)

Tasks:

Deliverables:

Week 7: Resource Templates and Native Pattern Documentation

⚠️ REVISED: Money moved to Week 6, focus on resource templates and native patterns

Resource Templates:

Documentation Tasks:

Deliverables:

Week 8: Enhanced Validation and Testing

Tasks:

Deliverables:

Phase 2 Success Criteria:

Phase 3: Specialization (Weeks 9-12)

Goal: Enable specialized healthcare workflows

Week 9: Planning and Analysis

Tasks:

Deliverables:

Week 10: Tier 3 Complex Components (Part 1)

Components to Implement:

  1. βœ… Dosage (VERY COMPLEX)

Tasks:

Deliverables:

Week 11: Tier 3 Complex Components (Part 2)

Components to Implement:

  1. βœ… Timing (VERY COMPLEX)

Tasks:

Deliverables:

Week 12: Tier 3 Remaining Components

Components to Implement:

  1. βœ… Annotation
  2. βœ… SampledData
  3. βœ… Ratio/RatioRange
  4. βœ… Signature

Tasks:

Resource Templates:

Deliverables:

Phase 3 Success Criteria:

Phase 4: Polish (Weeks 13-16)

Goal: Complete FHIR R4 coverage and professional polish

Week 13: Tier 4 Metadata Components

Components to Implement:

  1. βœ… Meta
  2. βœ… UsageContext
  3. βœ… ContactDetail
  4. βœ… RelatedArtifact
  5. βœ… All other metadata types

Tasks:

Deliverables:

Week 14: Comprehensive Template Library

Tasks:

Deliverables:

Week 15: FHIR Interoperability Testing

Tasks:

Deliverables:

Week 16: Documentation and Training

Tasks:

Deliverables:

Phase 4 Success Criteria:

Post-Implementation: Maintenance and Evolution

Ongoing Tasks:

Future Enhancements:

8. Success Metrics

⚠️ REVISED based on holistic analysis: Reduced component creation needs by leveraging native SDC4 patterns

8.1 Implementation Success Metrics

Component Coverage (REVISED):

Native Pattern Usage:

Quality Metrics:

Performance Metrics:

8.2 User Adoption Metrics

Ease of Use:

Usage Metrics:

Support Metrics:

8.3 Interoperability Metrics

Standards Compliance:

Data Exchange:

Integration:

8.4 Business Impact Metrics

Market Position:

ROI Metrics:

Community Metrics:

9. Next Steps

Immediate Actions (This Week)

1. Stakeholder Approval

Action: Review this analysis with product team and stakeholders

Questions to Answer:

Deliverable: Signed-off implementation plan

2. Set Up FHIR Project

Action: Create @FHIR project in SDCStudio

Steps:

  1. Log into SDCStudio as admin
  2. Navigate to Projects β†’ Create New Project
  3. Fill in details:

```

Name: FHIR

Label: FHIR

Description: Fast Healthcare Interoperability Resources (HL7 FHIR R4)

Version: R4 (4.0.1)

Creator: SDCStudio Team

Published: true

Public: true

About: http://hl7.org/fhir/

```

  1. Add metadata:

```

dc_subject: Healthcare Interoperability, FHIR, HL7, Semantic Data

dc_source: https://www.hl7.org/fhir/datatypes.html

dc_rights: Content derived from HL7 FHIR specification (CC BY 4.0)

dc_publisher: HL7 International

dc_type: SDC Component Library

```

  1. Save and verify project created

Deliverable: Active @FHIR project ready for components

3. Create First Template (Identifier)

Action: Build and publish Identifier component

Steps:

  1. Create file: docs/templates/fhir/datatypes/fhir-identifier.md
  2. Use template structure from Section 3.2
  3. Add YAML front matter:

```yaml

template_version: "4.0.0"

dataset:

name: "FHIR Identifier"

description: "Business identifier with namespace and validity period (FHIR R4)"

project: "@FHIR"

creator: "SDCStudio Team"

enrichment:

enable_llm: false

```

  1. Upload to SDCStudio
  2. Verify parsing successful
  3. Publish component
  4. Test reuse with ReuseComponent: @FHIR:Identifier

Deliverable: Published @FHIR:Identifier component

4. Update Documentation

Action: Add FHIR section to SDCStudio documentation

Files to Create/Update:

  1. docs/FHIR/FHIRDATATYPESANALYSIS.md (this document)
  2. docs/templates/fhir/README.md (template catalog index)
  3. docs/templates/README.md (add FHIR section)
  4. docs/users/fhir-integration-guide.md (user guide - start draft)

Content for docs/templates/README.md:


## FHIR Templates

HL7 FHIR (Fast Healthcare Interoperability Resources) R4 datatypes and resources.

**Location**: `fhir/`

**Usage**:

ReuseComponent: @FHIR:Identifier

ReuseComponent: @FHIR:HumanName

ReuseComponent: @FHIR:Address



**Documentation**: See [FHIR Integration Guide](../users/fhir-integration-guide.md)

**Reference**: https://www.hl7.org/fhir/datatypes.html

Deliverable: FHIR documentation integrated into SDCStudio docs

Week 1 Goals

By End of Week 1:

Success Criteria:

10. Resource Requirements

10.1 Development Resources

Personnel:

Time Allocation:

Effort Distribution:

10.2 Knowledge Resources

Required Expertise:

  1. FHIR Specification:
    • FHIR R4 Datatypes: https://www.hl7.org/fhir/datatypes.html
    • FHIR Resources: https://www.hl7.org/fhir/resourcelist.html
    • FHIR Profiles: https://www.hl7.org/fhir/profiling.html
    • US Core: http://hl7.org/fhir/us/core/
  2. Healthcare Standards:
    • SNOMED CT terminology
    • LOINC codes
    • ICD-10 diagnosis codes
    • UCUM units
    • HL7 v2/v3 (for context)
  3. SDCStudio Architecture:
    • SDC4 reference model
    • Component types (XdString, XdQuantity, etc.)
    • Cluster hierarchy
    • Template parsing system
    • XSD generation
  4. Development Tools:
    • Django ORM and models
    • Celery task processing
    • PostgreSQL
    • Git version control
    • Markdown/YAML

10.3 Testing Resources

Test Data:

Validation Tools:

Testing Environment:

10.4 Infrastructure Resources

Development:

Documentation:

External Services:

10.5 Budget Considerations

Personnel Costs:

Software/Services:

Estimated Total:

Conclusion

This comprehensive analysis demonstrates that FHIR integration is highly feasible and represents a significant strategic opportunity for SDCStudio to establish itself as the premier healthcare data modeling tool.

Key Strengths

Technical Fit:

Market Opportunity:

Manageable Scope:

Key Challenges

Complexity Areas:

None of these challenges are blockers - all have documented solutions.

Strategic Recommendation

PROCEED with FHIR integration using the phased approach outlined in this document.

Start immediately with:

  1. Create @FHIR project
  2. Implement Tier 1 (7 critical components) in 4 weeks
  3. Build example Patient demographics model
  4. Document and socialize success

This positions SDCStudio as:

Expected ROI:

Final Assessment: ⭐⭐⭐⭐⭐ HIGHLY RECOMMENDED

The technical fit is excellent, the market opportunity is substantial, the risks are manageable, and the phased approach allows for learning and adjustment. This is a high-value, achievable initiative that aligns perfectly with SDCStudio's strengths and vision.

Appendices

Appendix A: FHIR Resources by Category

Foundation Module (11 resources):

Clinical Module (19 resources):

Diagnostics Module (6 resources):

Medications Module (5 resources):

Workflow Module (11 resources):

Financial Module (15 resources):

Appendix B: FHIR Terminology Systems

Common Code Systems:

Usage in SDCStudio:

Appendix C: Useful FHIR Resources

Official Resources:

Tools:

Learning:

Appendix D: Version History

Version Date Author Changes
1.0 2025-11-03 Claude (Anthropic) Initial comprehensive analysis

End of Document

This analysis provides the foundation for FHIR integration with SDC4. Implementation should follow the phased roadmap with continuous feedback and adjustment.

About This Documentation

This document describes the open SDC4 specification maintained by the Semantic Data Charter community.

Open Source:

Commercial Implementation:

See ABOUTSDC4ANDSDCSTUDIO.md for details.

This document is part of the SDC4 Integration Guide series.

Author: Timothy W. Cook (Founder, Axius SDC, Inc.) w/Claude (Anthropic AI Assistant)

License: Creative Commons Attribution 4.0 International (CC BY 4.0)