use of org.hl7.fhir.r4.model.Endpoint in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testValueSetMembership.
@Test
public /**
* This test exists to validate the the engine correctly expands a valueset
* and correctly determines resources that overlap the valueset membership.
*
* @throws Exception on any error.
*/
void testValueSetMembership() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1983-12-02");
Condition condition = new Condition();
condition.setId("Condition");
condition.setSubject(new Reference(patient));
condition.getCode().addCoding().setSystem("SNOMED-CT").setCode("1234");
// This stub works for [Condition] c where c.code in "ValueSet"
mockFhirResourceRetrieval("/Condition?subject=Patient%2F123&_format=json", condition);
// These stub works for [Condition: "ValueSet"]
mockFhirResourceRetrieval("/Condition?code=SNOMED-CT%7C1234&subject=Patient%2F123&_format=json", makeBundle(condition));
mockFhirResourceRetrieval("/Condition?code=SNOMED-CT%7C5678&subject=Patient%2F123&_format=json", makeBundle());
mockValueSetRetrieval("https://cts.nlm.nih.gov/fhir/ValueSet/1.2.3.4", "SNOMED-CT", "1234");
mockValueSetRetrieval("https://cts.nlm.nih.gov/fhir/ValueSet/5.6.7.8", "SNOMED-CT", "5678");
// We have to add a one off mock valueset endpoint for when the engine checks if 1234 is in the 5.6.7.8 valueset
Parameters response = new Parameters();
response.addParameter().setValue(new BooleanType(false));
mockFhirResourceRetrieval("/ValueSet/5.6.7.8/$validate-code?code=1234&system=SNOMED-CT&_format=json", response);
CqlEvaluator evaluator = setupTestFor(patient, "cql.valueset", ClasspathCqlLibraryProvider.FHIR_HELPERS_CLASSPATH);
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("Test", "1.0.0"), newPatientContext("123"));
Map<String, Object> results = actual.getExpressionResults();
Assert.assertEquals(5, results.size());
Assert.assertEquals(true, results.get("RHSRetrieveMatches"));
Assert.assertEquals(true, results.get("RHSInOperatorMatches"));
Assert.assertEquals(true, results.get("RHSRetrieveNotMatches"));
Assert.assertEquals(true, results.get("RHSInOperatorNotMatches"));
assertFhirEquals(patient, (IBaseResource) results.get("Patient"));
}
use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMessageHeaderMessageSourceComponent.
protected void composeMessageHeaderMessageSourceComponent(Complex parent, String parentType, String name, MessageHeader.MessageSourceComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "source", name, element, index);
if (element.hasNameElement())
composeString(t, "MessageHeader", "name", element.getNameElement(), -1);
if (element.hasSoftwareElement())
composeString(t, "MessageHeader", "software", element.getSoftwareElement(), -1);
if (element.hasVersionElement())
composeString(t, "MessageHeader", "version", element.getVersionElement(), -1);
if (element.hasContact())
composeContactPoint(t, "MessageHeader", "contact", element.getContact(), -1);
if (element.hasEndpointElement())
composeUri(t, "MessageHeader", "endpoint", element.getEndpointElement(), -1);
}
use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMessageHeaderMessageDestinationComponent.
protected void composeMessageHeaderMessageDestinationComponent(Complex parent, String parentType, String name, MessageHeader.MessageDestinationComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "destination", name, element, index);
if (element.hasNameElement())
composeString(t, "MessageHeader", "name", element.getNameElement(), -1);
if (element.hasTarget())
composeReference(t, "MessageHeader", "target", element.getTarget(), -1);
if (element.hasEndpointElement())
composeUri(t, "MessageHeader", "endpoint", element.getEndpointElement(), -1);
}
use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeConformanceConformanceMessagingComponent.
protected void composeConformanceConformanceMessagingComponent(Complex parent, String parentType, String name, Conformance.ConformanceMessagingComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "messaging", name, element, index);
for (int i = 0; i < element.getEndpoint().size(); i++) composeConformanceConformanceMessagingEndpointComponent(t, "Conformance", "endpoint", element.getEndpoint().get(i), i);
if (element.hasReliableCacheElement())
composeUnsignedInt(t, "Conformance", "reliableCache", element.getReliableCacheElement(), -1);
if (element.hasDocumentationElement())
composeString(t, "Conformance", "documentation", element.getDocumentationElement(), -1);
for (int i = 0; i < element.getEvent().size(); i++) composeConformanceConformanceMessagingEventComponent(t, "Conformance", "event", element.getEvent().get(i), i);
}
use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeEndpoint.
protected void composeEndpoint(Complex parent, String parentType, String name, Endpoint element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Endpoint", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Endpoint", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Endpoint", "status", element.getStatusElement(), -1);
if (element.hasConnectionType())
composeCoding(t, "Endpoint", "connectionType", element.getConnectionType(), -1);
if (element.hasNameElement())
composeString(t, "Endpoint", "name", element.getNameElement(), -1);
if (element.hasManagingOrganization())
composeReference(t, "Endpoint", "managingOrganization", element.getManagingOrganization(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeContactPoint(t, "Endpoint", "contact", element.getContact().get(i), i);
if (element.hasPeriod())
composePeriod(t, "Endpoint", "period", element.getPeriod(), -1);
for (int i = 0; i < element.getPayloadType().size(); i++) composeCodeableConcept(t, "Endpoint", "payloadType", element.getPayloadType().get(i), i);
for (int i = 0; i < element.getPayloadMimeType().size(); i++) composeCode(t, "Endpoint", "payloadMimeType", element.getPayloadMimeType().get(i), i);
if (element.hasAddressElement())
composeUri(t, "Endpoint", "address", element.getAddressElement(), -1);
for (int i = 0; i < element.getHeader().size(); i++) composeString(t, "Endpoint", "header", element.getHeader().get(i), i);
}
Aggregations