onaio / fhir-tooling

A command line utility to support FHIR Core content authoring
Other
1 stars 1 forks source link

Validate StructureMaps based on connection to Questionnaires #199

Open pld opened 3 weeks ago

pld commented 3 weeks ago

Extend validation tooling and expand CI to:

  1. Parse the Composition to create a map from Questionnaires to the StructureMaps
  2. For each (Questionnaire, StructureMap) pair
    1. Generate a QuestionnnaireResponse for the Questionnaire
    2. Run the StructureMap against the QuestionnaireResponse and output a list of additional [Resources]
      • Fail any StructureMap fails to run
    3. For each Resource in the output list of [Resources]
      1. Validate it is valid FHIR with valid references
        • Fail if any resource is invalid or has invalid references
  3. Pass
pld commented 3 weeks ago

Somewhat related issue, https://github.com/onaio/fhir-tooling/issues/6

pld commented 3 weeks ago

Somewhat related issue, https://github.com/opensrp/fhircore/issues/3113

f-odhiambo commented 3 weeks ago

NB. We need some form of template validation that will help validate gaps in missing references that cause malformed resources e.g.

  1. Encounter.subject = Patient/$patient_id = valid
  2. Encounter.subject = $patient_id is not valid
  3. Encounter.subject = Patient/ is not valid

This should apply to other Resources that reference each other

Maybe having a reference check such as Reference xx/xx should be sufficient

pld commented 3 weeks ago

Good call, yep we probably need something like a linter for FHIR, or a very rudimentary version of that

dubdabasoduba commented 2 weeks ago

@Wambere @f-odhiambo I am looking at this validation in 2 stages

Stage 1

Stage 2

cc: @pld

pld commented 2 weeks ago

Sounds good, for stage 2 we would not want to access a server, we need to have this test work without assuming anything exists that the test writer cannot control.

There's a potential Stage 3 where we write the extracted resources first, or a subset of them, like should create this resources with these keys filled... hmm actually instead of writing the extracted resource a Profile might be want we want , then we validate that the extracted resources matches the target (or the profile). And later we build tooling to generate the structuremap from the Q and the target/profile

@Wambere let's focus on Stage 1 for now, get that into CI, then we can revisit the approach for Stage 2 and how it fits into our priorities.