use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project quality-measure-and-cohort-service by Alvearie.
the class CqlTemporalTests method confirmCanFindEventWithExistenceOfThirdEvent.
@Test
public void confirmCanFindEventWithExistenceOfThirdEvent() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, null);
Observation observation = new Observation();
DateTimeType observationEffective = new DateTimeType(new Date());
observationEffective.setYear(2015);
observationEffective.setMonth(0);
observationEffective.setDay(5);
observation.setEffective(observationEffective);
FhirServerConfig fhirConfig = getFhirServerConfig();
mockFhirResourceRetrieval("/Condition?subject=Patient%2F123&_format=json", getFhirParser(), CONDITION_IN, fhirConfig);
mockFhirResourceRetrieval("/Encounter?subject=Patient%2F123&_format=json", getFhirParser(), ENCOUNTER_1, fhirConfig);
mockFhirResourceRetrieval("/Observation?subject=Patient%2F123&_format=json", getFhirParser(), observation, fhirConfig);
CqlEvaluator evaluator = setupTestFor(patient, "cql.temporal", ClasspathCqlLibraryProvider.FHIR_HELPERS_CLASSPATH);
String expression = "ObservationWithin30DaysOfCondition";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("Test2", "1.0.0"), null, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, true);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project quality-measure-and-cohort-service by Alvearie.
the class CqlTemporalTests method anEventDoesFollow.
@Test
public void anEventDoesFollow() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, null);
FhirServerConfig fhirConfig = getFhirServerConfig();
mockFhirResourceRetrieval("/Encounter?subject=Patient%2F123&_format=json", getFhirParser(), ENCOUNTER_1, fhirConfig);
mockFhirResourceRetrieval("/Condition?subject=Patient%2F123&_format=json", getFhirParser(), CONDITION_IN, fhirConfig);
CqlEvaluator evaluator = setupTestFor(patient, "cql.temporal", ClasspathCqlLibraryProvider.FHIR_HELPERS_CLASSPATH);
String expression = "NotFollowedByCondition";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("Test4", "1.0.0"), null, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, false);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project quality-measure-and-cohort-service by Alvearie.
the class RestFhirRetrieveProviderTest method when_search_page_size_is_set___then_count_parameter_is_included_in_url.
@Test
public void when_search_page_size_is_set___then_count_parameter_is_included_in_url() {
mockFhirResourceRetrieval("/Condition?code%3Ain=MyValueSet&subject=Patient%2F123&_count=3&_format=json", new Bundle());
provider.setExpandValueSets(false);
provider.setPageSize(3);
provider.retrieve("Patient", "subject", "123", "Condition", null, "code", null, "MyValueSet", null, null, null, null);
verify(getRequestedFor(urlMatching("/Condition\\?code%3Ain=MyValueSet&subject=Patient%2F123&_count=3&_format=json")));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project quality-measure-and-cohort-service by Alvearie.
the class RestFhirRetrieveProviderTest method when_search_page_size_is_not_set___then_no_count_parameter_is_included_in_url.
@Test
public void when_search_page_size_is_not_set___then_no_count_parameter_is_included_in_url() {
mockFhirResourceRetrieval("/Condition?code%3Ain=MyValueSet&subject=Patient%2F123&_format=json", new Bundle());
provider.setExpandValueSets(false);
provider.retrieve("Patient", "subject", "123", "Condition", null, "code", null, "MyValueSet", null, null, null, null);
verify(getRequestedFor(urlMatching("/Condition\\?code%3Ain=MyValueSet&subject=Patient%2F123&_format=json")));
}
use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project openmrs-module-fhir2 by openmrs.
the class EncounterSearchQueryTest method searchForEncounters_shouldReturnEmptyCollectionOfEncountersByWrongSubjectIdentifier.
@Test
public void searchForEncounters_shouldReturnEmptyCollectionOfEncountersByWrongSubjectIdentifier() {
ReferenceAndListParam subjectReference = new ReferenceAndListParam();
ReferenceParam subject = new ReferenceParam();
subject.setValue(WRONG_PATIENT_IDENTIFIER);
subject.setChain(Patient.SP_IDENTIFIER);
subjectReference.addValue(new ReferenceOrListParam().add(subject));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, subjectReference);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, is(empty()));
}
Aggregations