Skip to content

Add StructureMap runtime for SDC extraction #27

Description

@cursor

Summary

SDC questionnaires can declare sourceStructureMap for Tier-5 extraction. HAIstack defines StructureMapExtractor in pkg/sdc but does not ship a StructureMap execution engine. Extraction fails when a questionnaire references a map and no runtime is plugged in.

Problem

  • QuestionnaireExtractor routes to StructureMapExtractor when sourceStructureMap is set
  • Default runtime wires QuestionnaireExtractor without StructureMap.Run
  • Error today: StructureMap runtime is unavailable for <canonical>
  • Definition/template extraction covers many cases, but map-based extraction is a normative SDC path

Proposed scope

Implement a StructureMap runtime (suggested: pkg/structuremap or separate module) that:

  1. Loads StructureMap resources (store / registry / canonical resolution)
  2. Executes map groups/rules against Questionnaire + QuestionnaireResponse inputs
  3. Produces FHIR resources for transaction bundle entries
  4. Integrates via existing StructureMapExtractor.Run hook

Integration points

  • pkg/sdc/assembly.goStructureMapExtractor
  • pkg/sdc/extraction.goQuestionnaireExtractor.StructureMap
  • pkg/runtime/wire.go — optional default wiring when maps are present
  • modules/sdc/examples/extraction-template.json — example map artifact

Out of scope (initial)

  • Full FHIR R4/R5 StructureMap transform catalog parity on day one
  • CQL transforms inside maps (depends on CQL library issue)

Acceptance criteria

  • Can execute a minimal StructureMap producing one resource from a QuestionnaireResponse
  • QuestionnaireExtractor uses runtime when sourceStructureMap is configured
  • Clear diagnostics when map is missing or execution fails
  • Tests mirroring TestQuestionnaireExtractorUsesMetadata with a real engine

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions