hapifhir / org.hl7.fhir.core

Apache License 2.0
151 stars 152 forks source link

Validation failing for bundle with resources that have contained resources in -ea mode #930

Closed dotasek closed 1 year ago

dotasek commented 1 year ago

The following included bundle will cause an uncaught exception if the validator CLI is run with -ea.

Originally from https://smilecdr.com/docs/fhir_repository/clinical_quality_language/measure-bundle-example.json.html

{
    "resourceType": "Bundle",
    "id": "EXM104-8.2.000-bundle",
    "type": "transaction",
    "entry": [ {
        "resource": {
            "resourceType": "Measure",
            "id": "measure-EXM104-8.2.000",
            "meta": {
                "profile": [ "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/proportion-measure-cqfm" ]
            },
            "extension": [ {
                "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
                "valueCode": "boolean"
            }, {
                "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem",
                "valueReference": {
                    "reference": "#cqf-tooling"
                }
            } ],
            "url": "http://hl7.org/fhir/us/cqfmeasures/Measure/EXM104",
            "identifier": [ {
                "use": "official",
                "system": "http://hl7.org/fhir/cqi/ecqm/Measure/Identifier/cms",
                "value": "104"
            } ],
            "version": "8.2.000",
            "name": "EXM104",
            "title": "Discharged on Antithrombotic Therapy",
            "status": "active",
            "experimental": true,
            "date": "2018-09-17",
            "publisher": "The Joint Commission",
            "contact": [ {
                "telecom": [ {
                    "system": "url",
                    "value": "https://www.jointcommission.org/en/"
                } ]
            } ],
            "description": "Ischemic stroke patients prescribed or continuing to take antithrombotic therapy at hospital discharge",
            "useContext": [ {
                "code": {
                    "code": "program"
                },
                "valueCodeableConcept": {
                    "text": "eligible-provider"
                }
            } ],
            "jurisdiction": [ {
                "coding": [ {
                    "system": "urn:iso:std:iso:3166",
                    "code": "US"
                } ]
            } ],
            "purpose": "Ischemic stroke patients prescribed or continuing to take antithrombotic therapy at hospital discharge",
            "copyright": "Measure specifications are in the Public Domain. LOINC(R) is a registered trademark of the Regenstrief Institute. This material contains SNOMED Clinical Terms(R) (SNOMED CT(C)) copyright 2004-2017 International Health Terminology Standards Development Organization. All rights reserved.",
            "approvalDate": "2016-01-01",
            "lastReviewDate": "2019-08-19",
            "effectivePeriod": {
                "start": "2019-01-01",
                "end": "2019-12-31"
            },
            "topic": [ {
                "coding": [ {
                    "system": "http://loinc.org",
                    "code": "57024-2",
                    "display": "Health Quality Measure Document"
                } ]
            } ],
            "relatedArtifact": [ {
                "type": "citation",
                "citation": "Adams HP, del Zoppo G, Alberts MJ, Bhatt DL, Brass L, Furlan A, Grubb RL, Higashida RT, Jauch EC, Kidwell C, Lyden PD, Morgenstern LB, Qureshi AI, Rosenwasser RH, Scott PA, Wijdicks E. Guidelines for the Early Management of Adults with Ischemic Stroke: A Guideline From the American Heart Association/American Stroke Association Stroke Council, Clinical CardiologyCouncil, Cardiovascular Radiology and Intervention Council, and the Atherosclerotic Peripheral Vascular Disease and Quality of Care Outcomes in Research Interdisciplinary Working Groups. Stroke. 2007;38:1655-1711."
            }, {
                "type": "citation",
                "citation": "Adams H, Adams R, Del Zoppo G, Goldstein LB. Guidelines for the Early Management of Patients With Ischemic Stroke: Guidelines Update A Scientific Statement From the Stroke Council of the American Heart Association/American Stroke Association. Stroke Vol. 36, 2005: 916:923."
            }, {
                "type": "citation",
                "citation": "Albers GW, Amarenco P, Easton JD, Sacco RL, Teal P. Antithrombotic and Thrombolytic Therapy for Ischemic Stroke. Chest Vol. 119, 2001: 300-320."
            }, {
                "type": "citation",
                "citation": "Brott TG, Clark WM, Grotta JC, et al. Stroke the first hours. Guidelines for acute treatment. Consensus Statement. National Stroke Association. 2000."
            }, {
                "type": "citation",
                "citation": "Chen ZM, Sandercock P, Pan HC, et al. Indications for early aspirin use in acute ischemic stroke: a combined analysis of 40,000 randomized patients from the Chinese acute stroke trial and the international stroke trial. On behalf of the CAST and IST collaborative groups, Stroke 2000;31:1240-1249."
            }, {
                "type": "citation",
                "citation": "Coull BM, Williams LS, Goldstein LB, et al. Anticoagulants and Antiplatelet Agents in Acute Ischemic Stroke. Report of the Joint Stroke Guideline Development Committee of the American Academy of Neurology and the American Stroke Association (a Division of the American Heart Association) Stroke. 2002;33:1934 - 1942."
            }, {
                "type": "citation",
                "citation": "Guideline on the Use of Aspirin as Secondary Prophylaxis for Vascular Disease in Primary Care, Centre for Health Services Research University of Newcastle upon Tyne, & Centre for Health Economics of York, 1998."
            }, {
                "type": "citation",
                "citation": "Kernan, W.N., B. Ovbiagele, H. R. Black, D. M. Bravata, M. I. Chimowitz, M. D. Ezekowitz, M. C. Fang, M. Fisher, K. L. Furie, D. V. Heck, S. C. Johnston, S. E. Kasner, S. J. Kittner, P. H. Mitchell, M. W. Rich, D. Richardson, L. H. Schwamm, J. A. Wilson. \"Guidelines for the Prevention of Stroke in Patients with Stroke and Transient Ischemic Attack: A Guideline for Healthcare Professionals from the American Heart Association/American Stroke Association.\" [in eng.]  Stroke 45, no. 7 (May 2014): 2160-223. "
            }, {
                "type": "depends-on",
                "resource": "Library/library-FHIRHelpers-4.0.1"
            }, {
                "type": "depends-on",
                "resource": "Library/library-MATGlobalCommonFunctions-5.0.000"
            }, {
                "type": "depends-on",
                "resource": "Library/library-SupplementalDataElements-2.0.0"
            }, {
                "type": "depends-on",
                "resource": "Library/library-TJCOverall-5.0.000"
            } ],
            "library": [ "Library/library-EXM104-8.2.000" ],
            "disclaimer": "These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications. The measures and specifications are provided without warranty.",
            "scoring": {
                "coding": [ {
                    "system": "http://hl7.org/fhir/measure-scoring",
                    "code": "proportion"
                } ]
            },
            "type": [ {
                "coding": [ {
                    "system": "http://hl7.org/fhir/measure-type",
                    "code": "process"
                } ]
            } ],
            "rationale": "The effectiveness of antithrombotic agents in reducing stroke mortality, stroke-related morbidity and recurrence rates has been studied in several large clinical trials. While the use of these agents for patients with acute ischemic stroke and transient ischemic attacks continues to be the subject of study, substantial evidence is available from completed studies. Data at this time suggest that antithrombotic therapy should be prescribed at discharge following acute ischemic stroke to reduce stroke mortality and morbidity as long as no contraindications exist.\n\nFor patients with a stroke due to a cardioembolic source (eg atrial fibrillation, mechanical heart valve), warfarin is recommended unless contraindicated. In recent years, novel oral anticoagulant agents (NOACs) have been developed and approved by the U.S. Food and Drug Administration (FDA) for stroke prevention, and may be considered as an alternative to warfarin for select patients. Anticoagulation therapy is not generally recommended for secondary stroke prevention in patients presumed to have a non-cardioembolic stroke.\nAnticoagulants at doses to prevent venous thromboembolism are insufficient antithrombotic therapy to prevent recurrent ischemic stroke or TIA.",
            "clinicalRecommendationStatement": "Clinical trial results suggest that antithrombotic therapy should be prescribed at discharge following acute ischemic stroke to reduce stroke mortality and morbidity as long as no contraindications exist",
            "improvementNotation": {
                "coding": [ {
                    "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
                    "code": "increase"
                } ]
            },
            "guidance": "The \"Non-elective Inpatient Encounter\" value set intends to capture all non-scheduled hospitalizations. This value set is a subset of the \"Inpatient encounter\" value set, excluding concepts that specifically refer to elective hospital admissions. Non-elective admissions include emergency, urgent and unplanned admissions.\n\nThe \"Medication, Discharge\" datatype refers to the discharge medication list and is intended to express medications ordered for post-discharge use.",
            "group": [ {
                "id": "group-1",
                "population": [ {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "initial-population",
                            "display": "Initial Population"
                        } ]
                    },
                    "criteria": {
                        "language": "text/cql",
                        "expression": "Initial Population"
                    }
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "numerator",
                            "display": "Numerator"
                        } ]
                    },
                    "criteria": {
                        "language": "text/cql",
                        "expression": "Numerator"
                    }
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "denominator",
                            "display": "Denominator"
                        } ]
                    },
                    "criteria": {
                        "language": "text/cql",
                        "expression": "Denominator"
                    }
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "denominator-exclusion",
                            "display": "Denominator Exclusion"
                        } ]
                    },
                    "criteria": {
                        "language": "text/cql",
                        "expression": "Denominator Exclusion"
                    }
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "denominator-exception",
                            "display": "Denominator Exception"
                        } ]
                    },
                    "criteria": {
                        "language": "text/cql",
                        "expression": "Denominator Exception"
                    }
                } ]
            } ],
            "supplementalData": [ {
                "code": {
                    "text": "sde-ethnicity"
                },
                "usage": [ {
                    "coding": [ {
                        "system": "http://hl7.org/fhir/measure-data-usage",
                        "code": "supplemental-data"
                    } ]
                } ],
                "criteria": {
                    "language": "text/cql",
                    "expression": "SDE Ethnicity"
                }
            }, {
                "code": {
                    "text": "sde-payer"
                },
                "usage": [ {
                    "coding": [ {
                        "system": "http://hl7.org/fhir/measure-data-usage",
                        "code": "supplemental-data"
                    } ]
                } ],
                "criteria": {
                    "language": "text/cql",
                    "expression": "SDE Payer"
                }
            }, {
                "code": {
                    "text": "sde-race"
                },
                "usage": [ {
                    "coding": [ {
                        "system": "http://hl7.org/fhir/measure-data-usage",
                        "code": "supplemental-data"
                    } ]
                } ],
                "criteria": {
                    "language": "text/cql",
                    "expression": "SDE Race"
                }
            }, {
                "code": {
                    "text": "sde-sex"
                },
                "usage": [ {
                    "coding": [ {
                        "system": "http://hl7.org/fhir/measure-data-usage",
                        "code": "supplemental-data"
                    } ]
                } ],
                "criteria": {
                    "language": "text/cql",
                    "expression": "SDE Sex"
                }
            } ]
        },
        "request": {
            "method": "PUT",
            "url": "Measure/measure-EXM104-8.2.000"
        }
    }, {
        "resource": {
            "resourceType": "MeasureReport",
            "id": "measurereport-denom-EXM104",
            "contained": [ {
                "resourceType": "Bundle",
                "id": "4e9ea2cf-bdfc-460f-b7a0-49f70201e177",
                "type": "collection",
                "entry": [ {
                    "fullUrl": "1a19a371-91b8-4a1d-9bb0-e8a997baa655",
                    "resource": {
                        "resourceType": "List",
                        "id": "1a19a371-91b8-4a1d-9bb0-e8a997baa655",
                        "title": "denominator",
                        "entry": [ {
                            "item": {
                                "reference": "denom-EXM104"
                            }
                        }, {
                            "item": {
                                "reference": "denom-EXM104-2"
                            }
                        }, {
                            "item": {
                                "reference": "denom-EXM104-1"
                            }
                        } ]
                    }
                }, {
                    "fullUrl": "Patient/denom-EXM104",
                    "resource": {
                        "resourceType": "Patient",
                        "id": "denom-EXM104",
                        "meta": {
                            "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" ]
                        },
                        "extension": [ {
                            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
                            "extension": [ {
                                "url": "ombCategory",
                                "valueCoding": {
                                    "system": "urn:oid:2.16.840.1.113883.6.238",
                                    "code": "2054-5",
                                    "display": "Black or African American"
                                }
                            } ]
                        }, {
                            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
                            "extension": [ {
                                "url": "ombCategory",
                                "valueCoding": {
                                    "system": "urn:oid:2.16.840.1.113883.6.238",
                                    "code": "2135-2",
                                    "display": "Hispanic or Latino"
                                }
                            } ]
                        } ],
                        "identifier": [ {
                            "use": "usual",
                            "type": {
                                "coding": [ {
                                    "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                                    "code": "MR",
                                    "display": "Medical Record Number"
                                } ]
                            },
                            "system": "http://hospital.smarthealthit.org",
                            "value": "9999999910"
                        } ],
                        "name": [ {
                            "family": "Jones",
                            "given": [ "Rick" ]
                        } ],
                        "gender": "male",
                        "birthDate": "1955-11-05"
                    }
                }, {
                    "fullUrl": "c247b95f-44a0-4ba4-af88-29419f6454af",
                    "resource": {
                        "resourceType": "List",
                        "id": "c247b95f-44a0-4ba4-af88-29419f6454af",
                        "title": "initial-population",
                        "entry": [ {
                            "item": {
                                "reference": "denom-EXM104"
                            }
                        }, {
                            "item": {
                                "reference": "denom-EXM104-2"
                            }
                        }, {
                            "item": {
                                "reference": "denom-EXM104-1"
                            }
                        } ]
                    }
                }, {
                    "fullUrl": "Encounter/denom-EXM104-2",
                    "resource": {
                        "resourceType": "Encounter",
                        "id": "denom-EXM104-2",
                        "meta": {
                            "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter" ]
                        },
                        "status": "finished",
                        "class": {
                            "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
                            "code": "IMP",
                            "display": "inpatient encounter"
                        },
                        "type": [ {
                            "coding": [ {
                                "system": "http://snomed.info/sct",
                                "code": "32485007",
                                "display": "Hospital admission (procedure)"
                            } ]
                        } ],
                        "subject": {
                            "reference": "Patient/denom-EXM104"
                        },
                        "period": {
                            "start": "2019-08-21T00:00:00-06:00",
                            "end": "2019-12-19T08:15:00-07:00"
                        },
                        "diagnosis": [ {
                            "condition": {
                                "reference": "Condition/denom-EXM104-1"
                            },
                            "use": {
                                "coding": [ {
                                    "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
                                    "code": "billing",
                                    "display": "Billing"
                                } ]
                            },
                            "rank": 1
                        } ]
                    }
                }, {
                    "fullUrl": "0f7a251e-fc83-461c-8a9b-ce07bc2d067d",
                    "resource": {
                        "resourceType": "List",
                        "id": "0f7a251e-fc83-461c-8a9b-ce07bc2d067d",
                        "title": "numerator",
                        "entry": [ {
                            "item": {
                                "reference": "denom-EXM104"
                            }
                        }, {
                            "item": {
                                "reference": "denom-EXM104-2"
                            }
                        }, {
                            "item": {
                                "reference": "denom-EXM104-1"
                            }
                        } ]
                    }
                }, {
                    "fullUrl": "Condition/denom-EXM104-1",
                    "resource": {
                        "resourceType": "Condition",
                        "id": "denom-EXM104-1",
                        "meta": {
                            "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition" ]
                        },
                        "verificationStatus": {
                            "coding": [ {
                                "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
                                "code": "confirmed",
                                "display": "Confirmed"
                            } ]
                        },
                        "category": [ {
                            "coding": [ {
                                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                                "code": "encounter-diagnosis",
                                "display": "Encounter Diagnosis"
                            } ]
                        } ],
                        "code": {
                            "coding": [ {
                                "system": "http://snomed.info/sct",
                                "code": "116288000",
                                "display": "Paralytic stroke (disorder)"
                            } ]
                        },
                        "subject": {
                            "reference": "Patient/denom-EXM104"
                        }
                    }
                } ]
            } ],
            "status": "complete",
            "type": "individual",
            "measure": "Measure/measure-EXM104-8.2.000",
            "subject": {
                "reference": "Patient/denom-EXM104"
            },
            "period": {
                "start": "2018-12-31T17:00:00-07:00",
                "end": "2019-12-30T17:00:00-07:00"
            },
            "group": [ {
                "id": "group-1",
                "population": [ {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "initial-population",
                            "display": "Initial Population"
                        } ]
                    },
                    "count": 1
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "numerator",
                            "display": "Numerator"
                        } ]
                    },
                    "count": 0
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "denominator",
                            "display": "Denominator"
                        } ]
                    },
                    "count": 1
                }, {
                    "code": {
                        "coding": [ {
                            "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                            "code": "denominator-exclusion",
                            "display": "Denominator Exclusion"
                        } ]
                    },
                    "count": 0
                } ],
                "measureScore": {
                    "value": 0.0
                }
            } ],
            "evaluatedResource": [ {
                "reference": "#4e9ea2cf-bdfc-460f-b7a0-49f70201e177"
            } ]
        },
        "request": {
            "method": "PUT",
            "url": "MeasureReport/measurereport-denom-EXM104"
        }
    } ]
}

This is normally not a problem for CLI users as -ea is not part of the default execution, but for anyone using the InstanceValidator in downstream projects, they will encounter the following:

Exception in thread "main" java.lang.AssertionError: Resource is MeasureReport, expected Bundle or Parameters
        at org.hl7.fhir.validation.instance.InstanceValidator.validateContains(InstanceValidator.java:4775)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5144)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4976)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4928)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5162)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4976)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4928)
        at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:4616)
        at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:4445)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:5773)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateContains(InstanceValidator.java:4815)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5144)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4976)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4928)
        at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:4616)
        at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:4445)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:5773)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateContains(InstanceValidator.java:4815)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5144)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4976)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4928)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5162)
        at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4976)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4928)
        at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:4616)
        at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:4445)
        at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:5773)
        at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:796)
        at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:644)
        at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:469)
        at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:439)
        at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:122)
        at org.hl7.fhir.validation.ValidatorCli.doValidation(ValidatorCli.java:300)
        at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:168)

This may be due a mistake in assigning hostContext.rootResource somewhere in the validation.

dotasek commented 1 year ago

As of Grahame's latest updates, this no longer fails:

>>> java -ea -jar validator_cli.jar example.json
FHIR Validation tool Version 5.6.76 (Git# cc634aecd5f0). Built 2022-11-06T12:51:07.733Z (4 days old)
  Java:   17.0.1 from /opt/homebrew/Cellar/openjdk/17.0.1_1/libexec/openjdk.jdk/Contents/Home on aarch64 (64bit). 4096MB available
  Paths:  Current = /Users/david.otasek/IN/2022-11-10-validator-ea-failure, Package Cache = /Users/david.otasek/.fhir/packages
  Params: example.json
Scanning for versions (no -version parameter):
  No Version Info found: Using Default version '4.0'
  Jurisdiction: No Jurisdiction
Loading
  Load FHIR v4.0.1 from hl7.fhir.r4.core#4.0.1  Load hl7.terminology.r4#5.0.0 - 4174 resources (00:10.483)
 - 7394 resources (00:00.000)
  Load hl7.terminology#4.0.0 - 4164 resources (00:00.742)
  Load R5 Extensions - 123 resources (00:26.280)
  Terminology server http://tx.fhir.org - Version 2.0.14 (00:00.633)
  Package Summary: [hl7.fhir.r4.core#4.0.1, hl7.fhir.xver-extensions#0.0.11, hl7.terminology.r4#5.0.0, hl7.terminology#4.0.0]
  Get set...  go (00:00.007)
Validating
  Validate example.json
Validate Bundle against http://hl7.org/fhir/StructureDefinition/BundleInstalling hl7.fhir.us.cqfmeasures#3.0.0 to the package cache
  Fetching:
....
  Installing: .... done.
Installing fhir.cqf.common#4.0.1 to the package cache
  Fetching:

  Installing:  done.
Installing hl7.fhir.uv.cpg#1.0.0 to the package cache
  Fetching:
...............
  Installing: ............... done.
  Load hl7.fhir.uv.cpg#1.0.0 - 197 resources (00:03.893)
  Load fhir.cqf.common#4.0.1 - 2 resources (00:00.015)
Installing hl7.fhir.us.qicore#4.1.1 to the package cache
  Fetching:
....
  Installing: .... done.
  Load hl7.fhir.us.core#3.1.1 - 145 resources (00:00.640)
  Load us.nlm.vsac#0.4.0 - 8916 resources (00:00.903)
  Load hl7.fhir.us.qicore#4.1.1 - 85 resources (00:00.016)
  Load hl7.fhir.us.cqfmeasures#3.0.0 - 102 resources (00:00.017)
..........20..........40..........60..........80.........|
 00:07.356
Done. Times: Loading: 00:38.495, validation: 00:12.844. Memory = 408Mb

*FAILURE*: 44 errors, 19 warnings, 7 notes
  Error @ Bundle.entry[0].resource.ofType(Measure).scoring.coding.display (line 110, col18): Missing element 'display' - required by fixed value assigned in profile http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/proportion-measure-cqfm
  Error @ Bundle.entry[0].resource.ofType(Measure).scoring.coding.system (line 111, col54): Value is 'http://hl7.org/fhir/measure-scoring' but must be 'http://terminology.hl7.org/CodeSystem/measure-scoring'
  Error @ Bundle.entry[0].resource.ofType(Measure).scoring.coding[0] (line 110, col18): Unknown Code System 'http://hl7.org/fhir/measure-scoring'
  Error @ Bundle.entry[0].resource.ofType(Measure).type[0].coding[0] (line 116, col18): Unknown Code System 'http://hl7.org/fhir/measure-type'
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[0].usage[0].coding[0] (line 199, col19): Unknown Code System 'http://hl7.org/fhir/measure-data-usage'
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[1].usage[0].coding[0] (line 213, col19): Unknown Code System 'http://hl7.org/fhir/measure-data-usage'
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[2].usage[0].coding[0] (line 227, col19): Unknown Code System 'http://hl7.org/fhir/measure-data-usage'
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[3].usage[0].coding[0] (line 241, col19): Unknown Code System 'http://hl7.org/fhir/measure-data-usage'
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[0].resource.ofType(List).entry[0].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[2].resource.ofType(List).entry[0].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[4].resource.ofType(List).entry[0].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[0].resource.ofType(List).entry[2].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104-1
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[2].resource.ofType(List).entry[2].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104-1
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[4].resource.ofType(List).entry[2].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104-1
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[0].resource.ofType(List).entry[1].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104-2
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[2].resource.ofType(List).entry[1].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104-2
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[4].resource.ofType(List).entry[1].item: Relative URLs must be of the format [ResourceName]/[id].  Encountered denom-EXM104-2
  Error @ Bundle.entry[0].resource.ofType(Measure).identifier[0].system (line 24, col69): URL value 'http://hl7.org/fhir/cqi/ecqm/Measure/Identifier/cms' does not resolve
  Error @ Bundle.entry[0].resource.ofType(Measure).relatedArtifact[8].resource (line 97, col5): Canonical URLs must be absolute URLs if they are not fragment references (Library/library-FHIRHelpers-4.0.1)
  Error @ Bundle.entry[0].resource.ofType(Measure).relatedArtifact[9].resource (line 100, col5): Canonical URLs must be absolute URLs if they are not fragment references (Library/library-MATGlobalCommonFunctions-5.0.000)
  Error @ Bundle.entry[0].resource.ofType(Measure).relatedArtifact[10].resource (line 103, col5): Canonical URLs must be absolute URLs if they are not fragment references (Library/library-SupplementalDataElements-2.0.0)
  Error @ Bundle.entry[0].resource.ofType(Measure).relatedArtifact[11].resource (line 106, col5): Canonical URLs must be absolute URLs if they are not fragment references (Library/library-TJCOverall-5.0.000)
  Error @ Bundle.entry[0].resource.ofType(Measure).library[0] (line 107, col51): Canonical URLs must be absolute URLs if they are not fragment references (Library/library-EXM104-8.2.000)
  Error @ Bundle.entry[0].resource.ofType(Measure).scoring.coding[0].system (line 111, col54): URL value 'http://hl7.org/fhir/measure-scoring' does not resolve
  Error @ Bundle.entry[0].resource.ofType(Measure).type[0].coding[0].system (line 117, col51): URL value 'http://hl7.org/fhir/measure-type' does not resolve
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[0].usage[0].coding[0].system (line 200, col58): URL value 'http://hl7.org/fhir/measure-data-usage' does not resolve
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[1].usage[0].coding[0].system (line 214, col58): URL value 'http://hl7.org/fhir/measure-data-usage' does not resolve
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[2].usage[0].coding[0].system (line 228, col58): URL value 'http://hl7.org/fhir/measure-data-usage' does not resolve
  Error @ Bundle.entry[0].resource.ofType(Measure).supplementalData[3].usage[0].coding[0].system (line 242, col58): URL value 'http://hl7.org/fhir/measure-data-usage' does not resolve
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).measure (line 451, col48): Canonical URLs must be absolute URLs if they are not fragment references (Measure/measure-EXM104-8.2.000)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).subject: Relative Reference appears inside Bundle whose entry is missing a fullUrl
  Error @ Bundle.entry[1] (line 256, col6): Bundle entry missing fullUrl
  Error @ Bundle.entry[0].resource.ofType(Measure).extension[1].value.ofType(Reference) (line 19, col6): Unable to resolve resource with reference '#cqf-tooling'
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[0].resource.ofType(List) (line 267, col30): List.mode: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/List)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[0].resource.ofType(List) (line 267, col30): List.status: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/List)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[1].resource.ofType(Patient).extension[0] (line 292, col23): Extension.extension:text: minimum required = 1, but only found 0 (from http://hl7.org/fhir/us/core/StructureDefinition/us-core-race)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[1].resource.ofType(Patient).extension[1] (line 302, col11): Extension.extension:text: minimum required = 1, but only found 0 (from http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[2].resource.ofType(List) (line 335, col30): List.mode: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/List)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[2].resource.ofType(List) (line 335, col30): List.status: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/List)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[3].resource.ofType(Encounter).subject (line 375, col8): Unable to find a match for profile Patient/denom-EXM104 among choices: http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[4].resource.ofType(List) (line 397, col30): List.mode: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/List)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[4].resource.ofType(List) (line 397, col30): List.status: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/List)
  Error @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[5].resource.ofType(Condition).subject (line 445, col8): Unable to find a match for profile Patient/denom-EXM104 among choices: http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
  Error @ Bundle.entry[0].resource.ofType(Measure).extension[1].value.ofType(Reference) (line 19, col6): Rule ref-1: 'SHALL have a contained resource if a local reference is provided' Failed (url: cqf-tooling; ids: ) (log:  (url: cqf-tooling; ids: ))
  Information @ Bundle.entry[0].resource.ofType(Measure).extension[0] (line 12, col20): This element does not match any known slice defined in the profile http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/proportion-measure-cqfm
  Information @ Bundle.entry[0].resource.ofType(Measure) (line 107, col51): The Library Library/library-EXM104-8.2.000 could not be resolved, so expression validation may not be correct 
  Information @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[3].resource.ofType(Encounter).subject (line 375, col8): Details for Patient/denom-EXM104 matching against Profile http://hl7.org/fhir/StructureDefinition/Patient
  Information @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[3].resource.ofType(Encounter).subject (line 375, col8): Details for Patient/denom-EXM104 matching against Profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
  Information @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[3].resource.ofType(Encounter).diagnosis[0].condition (line 383, col9): Details for Condition/denom-EXM104-1 matching against Profile http://hl7.org/fhir/StructureDefinition/Condition
  Information @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[5].resource.ofType(Condition).subject (line 445, col8): Details for Patient/denom-EXM104 matching against Profile http://hl7.org/fhir/StructureDefinition/Patient
  Information @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[5].resource.ofType(Condition).subject (line 445, col8): Details for Patient/denom-EXM104 matching against Profile http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient
  Warning @ Bundle.entry[0].resource.ofType(Measure).useContext[0].code (line 44, col6): A code with no system has no defined meaning. A system should be provided
  Warning @ Bundle.entry[0].resource.ofType(Measure).scoring (line 110, col16): None of the codings provided are in the value set 'MeasureScoring' (http://hl7.org/fhir/ValueSet/measure-scoring), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-scoring#proportion)
  Warning @ Bundle.entry[0].resource.ofType(Measure).type[0] (line 115, col15): None of the codings provided are in the value set 'MeasureType' (http://hl7.org/fhir/ValueSet/measure-type), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-type#process)
  Warning @ Bundle.entry[0].resource.ofType(Measure).type[0] (line 115, col15): None of the codings provided are in the value set 'MeasureType' (http://terminology.hl7.org/ValueSet/measure-type), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-type#process)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[0].code (line 197, col6): No code provided, and a code should be provided from the value set 'MeasureDataUsage' (http://terminology.hl7.org/ValueSet/measure-data-usage)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[0].usage[0] (line 198, col17): None of the codings provided are in the value set 'MeasureDataUsage' (http://hl7.org/fhir/ValueSet/measure-data-usage), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-data-usage#supplemental-data)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[1].code (line 211, col6): No code provided, and a code should be provided from the value set 'MeasureDataUsage' (http://terminology.hl7.org/ValueSet/measure-data-usage)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[1].usage[0] (line 212, col17): None of the codings provided are in the value set 'MeasureDataUsage' (http://hl7.org/fhir/ValueSet/measure-data-usage), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-data-usage#supplemental-data)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[2].code (line 225, col6): No code provided, and a code should be provided from the value set 'MeasureDataUsage' (http://terminology.hl7.org/ValueSet/measure-data-usage)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[2].usage[0] (line 226, col17): None of the codings provided are in the value set 'MeasureDataUsage' (http://hl7.org/fhir/ValueSet/measure-data-usage), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-data-usage#supplemental-data)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[3].code (line 239, col6): No code provided, and a code should be provided from the value set 'MeasureDataUsage' (http://terminology.hl7.org/ValueSet/measure-data-usage)
  Warning @ Bundle.entry[0].resource.ofType(Measure).supplementalData[3].usage[0] (line 240, col17): None of the codings provided are in the value set 'MeasureDataUsage' (http://hl7.org/fhir/ValueSet/measure-data-usage), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://hl7.org/fhir/measure-data-usage#supplemental-data)
  Warning @ Bundle.entry[1].resource.ofType(MeasureReport).contained[0].ofType(Bundle).entry[3].resource.ofType(Encounter).type[0] (line 366, col18): None of the codings provided are in the value set 'US Core Encounter Type' (http://hl7.org/fhir/us/core/ValueSet/us-core-encounter-type), and a coding should come from this value set unless it has no suitable code (note that the validator cannot judge what is suitable) (codes = http://snomed.info/sct#32485007)
  Warning @ Bundle.entry[1].resource.ofType(MeasureReport) (line 451, col48): The Measure 'Measure/measure-EXM104-8.2.000' could not be resolved, so no validation can be performed against the Measure
  Warning @ Bundle.entry[0].resource.ofType(Measure).group[0].population[0].criteria (line 141, col30): Rule cqm-4: 'Group population criteria SHOULD be simple expression names found within the primary library for the measure. The criteria SHOULD NOT include a namespace.' Failed
  Warning @ Bundle.entry[0].resource.ofType(Measure).group[0].population[1].criteria (line 153, col30): Rule cqm-4: 'Group population criteria SHOULD be simple expression names found within the primary library for the measure. The criteria SHOULD NOT include a namespace.' Failed
  Warning @ Bundle.entry[0].resource.ofType(Measure).group[0].population[2].criteria (line 165, col30): Rule cqm-4: 'Group population criteria SHOULD be simple expression names found within the primary library for the measure. The criteria SHOULD NOT include a namespace.' Failed
  Warning @ Bundle.entry[0].resource.ofType(Measure).group[0].population[3].criteria (line 177, col30): Rule cqm-4: 'Group population criteria SHOULD be simple expression names found within the primary library for the measure. The criteria SHOULD NOT include a namespace.' Failed
  Warning @ Bundle.entry[0].resource.ofType(Measure).group[0].population[4].criteria (line 189, col30): Rule cqm-4: 'Group population criteria SHOULD be simple expression names found within the primary library for the measure. The criteria SHOULD NOT include a namespace.' Failed
dotasek commented 1 year ago

This issue was resolved in an earlier update, and a test for the expected behaviour was added here: https://github.com/FHIR/fhir-test-cases/pull/122