Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure a CQL expression referencing an abstract class/non-retrievable class, such as DomainResource, will fail. #1404

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,14 @@ void hidingVariousUseCases() throws IOException {
hidingLetFhir,
hidingAliasLet));
}

@Test
void abstractClassNotRetrievable() throws IOException {
// See: https://github.com/cqframework/clinical_quality_language/issues/1392
final CqlTranslator translator = TestUtils.runSemanticTest("abstractClassNotRetrievable.cql", 1);
final List<CqlCompilerException> errors = translator.getErrors();
final List<String> errorMessages =
errors.stream().map(Throwable::getMessage).toList();
assertThat(errorMessages, contains("Specified data type DomainResource does not support retrieval."));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
library abstractClassNotRetrievable

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'

context Patient

define "Bar":
[DomainResource] // should be marked non-retrievable, should give error/warning in translator
Original file line number Diff line number Diff line change
Expand Up @@ -3562,7 +3562,7 @@
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="FHIR" name="DocumentRelationshipType" retrievable="false" baseType="FHIR.Element">
<ns4:element name="value" elementType="System.String"/>
</ns4:typeInfo>
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true" baseType="FHIR.Resource">
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false" baseType="FHIR.Resource">
<ns4:element name="text" elementType="FHIR.Narrative"/>
<ns4:element name="contained">
<ns4:elementTypeSpecifier xsi:type="ns4:ListTypeSpecifier" elementType="FHIR.Resource"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3562,7 +3562,7 @@
<typeInfo baseType="FHIR.Element" namespace="FHIR" name="DocumentRelationshipType" retrievable="false" xsi:type="ClassInfo">
<element name="value" elementType="System.String"/>
</typeInfo>
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true" xsi:type="ClassInfo">
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false" xsi:type="ClassInfo">
<element name="text" elementType="FHIR.Narrative"/>
<element name="contained">
<elementTypeSpecifier elementType="FHIR.Resource" xsi:type="ListTypeSpecifier"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8753,7 +8753,7 @@
<typeInfo baseType="FHIR.Element" namespace="FHIR" name="DocumentRelationshipType" retrievable="false" xsi:type="ClassInfo">
<element name="value" elementType="System.String"/>
</typeInfo>
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true" xsi:type="ClassInfo">
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false" xsi:type="ClassInfo">
<element name="text" elementType="FHIR.Narrative" description="Text summary of the resource, for human interpretation" definition="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it &quot;clinically safe&quot; for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." comment="Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied). This may be necessary for data from legacy systems where information is captured as a &quot;text blob&quot; or where text is additionally entered raw or narrated and encoded information is added later."/>
<element name="contained" description="Contained, inline Resources" definition="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." comment="This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.">
<elementTypeSpecifier elementType="FHIR.Resource" xsi:type="ListTypeSpecifier"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3562,7 +3562,7 @@
<typeInfo baseType="FHIR.Element" namespace="FHIR" name="DocumentRelationshipType" retrievable="false" xsi:type="ClassInfo">
<element name="value" elementType="System.String"/>
</typeInfo>
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true" xsi:type="ClassInfo">
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false" xsi:type="ClassInfo">
<element name="text" elementType="FHIR.Narrative"/>
<element name="contained">
<elementTypeSpecifier elementType="FHIR.Resource" xsi:type="ListTypeSpecifier"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3685,7 +3685,7 @@
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="FHIR" name="DocumentRelationshipType" retrievable="false" baseType="FHIR.Element">
<ns4:element name="value" elementType="System.String"/>
</ns4:typeInfo>
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true" baseType="FHIR.Resource">
<ns4:typeInfo xsi:type="ns4:ClassInfo" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false" baseType="FHIR.Resource">
<ns4:element name="text" elementType="FHIR.Narrative"/>
<ns4:element name="contained">
<ns4:elementTypeSpecifier xsi:type="ns4:ListTypeSpecifier" elementType="FHIR.Resource"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3562,7 +3562,7 @@
<typeInfo baseType="FHIR.Element" namespace="FHIR" name="DocumentRelationshipType" retrievable="false" xsi:type="ClassInfo">
<element name="value" elementType="System.String"/>
</typeInfo>
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true" xsi:type="ClassInfo">
<typeInfo baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false" xsi:type="ClassInfo">
<element name="text" elementType="FHIR.Narrative"/>
<element name="contained">
<elementTypeSpecifier elementType="FHIR.Resource" xsi:type="ListTypeSpecifier"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8753,7 +8753,7 @@
<typeInfo xsi:type="ClassInfo" baseType="FHIR.Element" namespace="FHIR" name="DocumentRelationshipType" retrievable="false">
<element name="value" elementType="System.String"/>
</typeInfo>
<typeInfo xsi:type="ClassInfo" baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="true">
<typeInfo xsi:type="ClassInfo" baseType="FHIR.Resource" namespace="FHIR" name="DomainResource" identifier="http://hl7.org/fhir/StructureDefinition/DomainResource" label="DomainResource" retrievable="false">
<element name="text" elementType="FHIR.Narrative" description="Text summary of the resource, for human interpretation" definition="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it &quot;clinically safe&quot; for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." comment="Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied). This may be necessary for data from legacy systems where information is captured as a &quot;text blob&quot; or where text is additionally entered raw or narrated and encoded information is added later."/>
<element name="contained" description="Contained, inline Resources" definition="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." comment="This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.">
<elementTypeSpecifier elementType="FHIR.Resource" xsi:type="ListTypeSpecifier"/>
Expand Down
Loading