use of au.csiro.pathling.encoders.FhirEncoders 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 au.csiro.pathling.encoders.FhirEncoders in project pathling by aehrc.
the class AggregateExecutorTest method runFirstGroupingThroughSearch.
/**
* Test that the drill-down expression from the first grouping from each aggregate result can be
* successfully executed using the FHIRPath search.
*/
@AfterEach
void runFirstGroupingThroughSearch() {
if (response != null) {
final Optional<Grouping> firstGroupingOptional = response.getGroupings().stream().filter(grouping -> grouping.getDrillDown().isPresent()).findFirst();
if (firstGroupingOptional.isPresent()) {
final Grouping firstGrouping = firstGroupingOptional.get();
assertTrue(firstGrouping.getDrillDown().isPresent());
final String drillDown = firstGrouping.getDrillDown().get();
final StringAndListParam filters = new StringAndListParam();
filters.addAnd(new StringParam(drillDown));
final IBundleProvider searchExecutor = new SearchExecutor(configuration, fhirContext, spark, database, Optional.of(terminologyServiceFactory), fhirEncoders, subjectResource, Optional.of(filters));
final List<IBaseResource> resources = searchExecutor.getResources(0, 100);
assertTrue(resources.size() > 0);
}
}
}
Aggregations