use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class MembershipOperatorTest method worksForCodingLiterals.
@ParameterizedTest
@MethodSource("parameters")
void worksForCodingLiterals(final String operator) {
final Coding snomedCoding = new Coding(SNOMED_URL, "56459004", null);
final Coding loincCoding1 = new Coding(LOINC_URL, "56459004", null);
loincCoding1.setId("fake-id-1");
final Coding loincCoding2 = new Coding(LOINC_URL, "56459004", null);
loincCoding2.setId("fake-id-2");
final Coding loincCodingWithVersion = new Coding(LOINC_URL, "56459004", null);
loincCodingWithVersion.setVersion("version1");
final Dataset<Row> codingDataset = new DatasetBuilder(spark).withIdColumn().withStructTypeColumns(codingStructType()).withRow(StringPrimitiveRowFixture.ROW_ID_1, rowFromCoding(snomedCoding)).withRow(StringPrimitiveRowFixture.ROW_ID_1, rowFromCoding(loincCoding1)).withRow(StringPrimitiveRowFixture.ROW_ID_2, rowFromCoding(snomedCoding)).withRow(StringPrimitiveRowFixture.ROW_ID_2, rowFromCoding(loincCoding2)).withRow(StringPrimitiveRowFixture.ROW_ID_3, rowFromCoding(snomedCoding)).withRow(StringPrimitiveRowFixture.ROW_ID_3, rowFromCoding(loincCodingWithVersion)).withRow(StringPrimitiveRowFixture.ROW_ID_4, null).withRow(StringPrimitiveRowFixture.ROW_ID_4, null).buildWithStructValue();
final ElementPath collection = new ElementPathBuilder(spark).fhirType(FHIRDefinedType.CODING).dataset(codingDataset).idAndValueColumns().build();
final CodingLiteralPath element = CodingLiteralPath.fromString("http://loinc.org|56459004", collection);
parserContext = new ParserContextBuilder(spark, fhirContext).groupingColumns(Collections.singletonList(collection.getIdColumn())).build();
final FhirPath result = testOperator(operator, collection, element);
assertThat(result).selectOrderedResult().hasRows(RowFactory.create(StringPrimitiveRowFixture.ROW_ID_1, true), RowFactory.create(StringPrimitiveRowFixture.ROW_ID_2, true), RowFactory.create(StringPrimitiveRowFixture.ROW_ID_3, false), RowFactory.create(StringPrimitiveRowFixture.ROW_ID_4, false));
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class SecurityTestForOperations method assertBatchSuccess.
void assertBatchSuccess() {
final String json = TestHelpers.getResourceAsString("requests/BatchProviderTest/mixedResourceTypes.Bundle.json");
final Bundle bundle = (Bundle) jsonParser.parseResource(json);
batchProvider.batch(bundle);
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class ManifestConverterTest method convertsManifest.
@Test
void convertsManifest() {
database = new Database(configuration, spark, fhirEncoders, executor);
final PassportScope passportScope = new PassportScope();
final VisaManifest manifest = new VisaManifest();
manifest.setPatientIds(Arrays.asList(PATIENT_ID_1, PATIENT_ID_2, PATIENT_ID_3, PATIENT_ID_4));
final ManifestConverter manifestConverter = new ManifestConverter(configuration, fhirContext);
manifestConverter.populateScope(passportScope, manifest);
// Convert the scope to JSON and compare it to a test fixture.
final Gson gson = new GsonBuilder().create();
final String json = gson.toJson(passportScope);
assertJson("responses/ManifestConverterTest/convertsManifest.json", json);
// our test patients.
for (final ResourceType resourceType : passportScope.keySet()) {
if (AVAILABLE_RESOURCE_TYPES.contains(resourceType)) {
boolean found = false;
for (final String filter : passportScope.get(resourceType)) {
final Dataset<Row> dataset = assertThatResultOf(resourceType, filter).isElementPath(BooleanPath.class).selectResult().apply(result -> result.filter(result.columns()[1])).getDataset();
if (dataset.count() > 0) {
found = true;
}
}
assertTrue(found, "No results found for " + resourceType.toCode());
}
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class AbstractParserTest method mockResource.
void mockResource(final ResourceType... resourceTypes) {
for (final ResourceType resourceType : resourceTypes) {
final Dataset<Row> dataset = TestHelpers.getDatasetForResourceType(spark, resourceType);
when(database.read(resourceType)).thenReturn(dataset);
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class ParserTest method testCodingLiterals.
@Test
void testCodingLiterals() {
// Coding literal form [system]|[code]
final Coding expectedCoding = new Coding("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus", "S", null);
assertThatResultOf("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus|S").isLiteralPath(CodingLiteralPath.class).hasExpression("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus|S").hasCodingValue(expectedCoding);
// Coding literal form [system]|[code]|[version]
final Coding expectedCodingWithVersion = new Coding("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus", "S", null);
expectedCodingWithVersion.setVersion("v1");
assertThatResultOf("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus|S|v1").isLiteralPath(CodingLiteralPath.class).hasExpression("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus|S|v1").hasCodingValue(expectedCodingWithVersion);
}
Aggregations