use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class CoronaTestIT method testNUMResearchCase_5.
/**
* see https://wiki.vitagroup.ag/display/NUM/Research+Repository
*
* Containment test:
*
* contains COMPOSITION c[openEHR-EHR-COMPOSITION.event_summary.v0]
* contains
* (CLUSTER n[openEHR-EHR-CLUSTER.case_identification.v0]
* and ADMIN_ENTRY u[openEHR-EHR-ADMIN_ENTRY.hospitalization.v0]
* contains (CLUSTER a[openEHR-EHR-CLUSTER.location.v1]))
*/
@Test
public void testNUMResearchCase_5() {
ehr = openEhrClient.ehrEndpoint().createEhr();
openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildTestPatientenaufenthaltComposition());
// build AQL
PatientenaufenthaltCompositionContainment patientenaufenthaltCompositionContainment = PatientenaufenthaltCompositionContainment.getInstance();
AbteilungsfallClusterContainment abteilungsfallClusterContainment = AbteilungsfallClusterContainment.getInstance();
VersorgungsortAdminEntryContainment versorgungsortAdminEntryContainment = VersorgungsortAdminEntryContainment.getInstance();
StandortClusterContainment standortClusterContainment = StandortClusterContainment.getInstance();
ContainmentExpression containmentExpression = patientenaufenthaltCompositionContainment.contains(abteilungsfallClusterContainment.and(versorgungsortAdminEntryContainment.contains(standortClusterContainment)));
// select set values from test data
EntityQuery<Record3<TemporalAccessor, TemporalAccessor, String>> entityQuery = Query.buildEntityQuery(containmentExpression, versorgungsortAdminEntryContainment.BEGINN_VALUE, versorgungsortAdminEntryContainment.ENDE_VALUE, versorgungsortAdminEntryContainment.GRUND_DES_AUFENTHALTES_VALUE);
Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
List<Record3<TemporalAccessor, TemporalAccessor, String>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
assertThat(actual).extracting(Record3::value1, Record3::value2, Record3::value3).containsExactlyInAnyOrder(new Tuple(new DvDateTime("2020-01-01T10:00Z").getValue(), new DvDateTime("2020-01-01T12:00Z").getValue(), "test value"));
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class CoronaTestIT method testNUMResearchCase_6.
/**
* see https://wiki.vitagroup.ag/display/NUM/Research+Repository
*
* Containment test:
*
* contains COMPOSITION c[openEHR-EHR-COMPOSITION.fall.v0]
* contains (
* ADMIN_ENTRY p[openEHR-EHR-ADMIN_ENTRY.admission.v0] and
* ADMIN_ENTRY b[openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0])
*/
@Test
public void testNUMResearchCase_6() {
ehr = openEhrClient.ehrEndpoint().createEhr();
openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildTestStationarerVersorgungsfallComposition());
// build AQL
StationarerVersorgungsfallCompositionContainment stationarerVersorgungsfallCompositionContainment = StationarerVersorgungsfallCompositionContainment.getInstance();
AufnahmedatenAdminEntryContainment aufnahmedatenAdminEntryContainment = AufnahmedatenAdminEntryContainment.getInstance();
EntlassungsdatenAdminEntryContainment entlassungsdatenAdminEntryContainment = EntlassungsdatenAdminEntryContainment.getInstance();
ContainmentExpression containmentExpression = stationarerVersorgungsfallCompositionContainment.contains(aufnahmedatenAdminEntryContainment.and(entlassungsdatenAdminEntryContainment));
// select set values from test data
EntityQuery<Record3<TemporalAccessor, TemporalAccessor, String>> entityQuery = Query.buildEntityQuery(containmentExpression, aufnahmedatenAdminEntryContainment.DATUM_UHRZEIT_DER_AUFNAHME_VALUE, entlassungsdatenAdminEntryContainment.DATUM_UHRZEIT_DER_ENTLASSUNG_VALUE, stationarerVersorgungsfallCompositionContainment.FALL_KENNUNG_VALUE);
Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
List<Record3<TemporalAccessor, TemporalAccessor, String>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
assertThat(actual).extracting(Record3::value1, Record3::value2, Record3::value3).containsExactlyInAnyOrder(new Tuple(new DvDateTime("2020-04-02T12:00:00Z").getValue(), new DvDateTime("2020-04-02T12:00:00Z").getValue(), "45657678"));
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class CanonicalCompoAllTypeQueryIT method setUp.
public void setUp(CompositionTestDataCanonicalJson testComposition) throws IOException {
// manual test use
// ehrUUID = UUID.fromString("ecc0de4d-eb29-40c2-ad7a-e2ab8d66a9f8");
// compositionUUID = UUID.fromString("a9c22c37-8002-4486-932a-f3e1729efe57");
actualDvDateTime = new DvDateTime(OffsetDateTime.now());
// normal test run
ehrUUID = openEhrClient.ehrEndpoint().createEhr();
compositionEndpoint = openEhrClient.compositionEndpoint(ehrUUID);
if (testComposition != null) {
aComposition = new CanonicalJson().unmarshal(IOUtils.toString(testComposition.getStream(), StandardCharsets.UTF_8), Composition.class);
Flattener flattener = new Flattener(new TestDataTemplateProvider());
TestAllTypesEnV1Composition testAllTypesEnV1Composition = flattener.flatten(aComposition, TestAllTypesEnV1Composition.class);
// create the composition
TestAllTypesEnV1Composition comp = compositionEndpoint.mergeCompositionEntity(testAllTypesEnV1Composition);
compositionUUID = comp.getVersionUid().getUuid();
}
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class CompareCanonicalDvDateTimeTest method testComparatorDvDateTime.
@Test
public void testComparatorDvDateTime() {
DvDateTime dvDateTime = (DvDateTime) toRmObject(jsonDvDateTimeRef, DvDateTime.class);
assertThat(new CompareCanonicalDvDateTime(dvDateTime).isExpectedEqualToCanonicalUsing(dvDateTime)).isNull();
assertThat(new CompareCanonicalDvDateTime(dvDateTime).setCompareDateOnly(true).isExpectedEqualToCanonicalUsing(dvDateTime)).isNull();
assertThat(new CompareCanonicalDvDateTime(dvDateTime).setCompareDateOnly(false).isExpectedEqualToCanonicalUsing(dvDateTime)).isNull();
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class EventContextUnmarshalPostprocessor method process.
/**
* {@inheritDoc}
*/
@Override
public void process(String term, EventContext rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
setValue(term + PATH_DIVIDER + "_location", null, values, rmObject::setLocation, String.class, consumedPaths);
setValue(term + PATH_DIVIDER + "_end_time", null, values, s -> {
if (s != null) {
rmObject.setEndTime(new DvDateTime(s));
}
}, String.class, consumedPaths);
Map<FlatPathDto, String> health_care_facilityValues = FlatHelper.filter(values, term + "/_health_care_facility", false);
if (!health_care_facilityValues.isEmpty()) {
rmObject.setHealthCareFacility(new PartyIdentified());
handleRmAttribute(term, rmObject.getHealthCareFacility(), health_care_facilityValues, consumedPaths, context, "health_care_facility");
}
Map<Integer, Map<String, String>> other = extractMultiValued(term, "_participation", values);
other.values().stream().map(Map::entrySet).map(s -> s.stream().collect(Collectors.toMap(e -> "ctx/" + DefaultValuePath.PARTICIPATION.getPath() + "_" + e.getKey().replace("identifiers_", "identifiers|"), e -> StringUtils.wrap(e.getValue(), '"'))).entrySet()).map(DefaultValues::buildParticipation).forEach(rmObject::addParticipation);
consumeAllMatching(term + PATH_DIVIDER + "_participation", values, consumedPaths, false);
// Strange Path with value true if setting = other care (238)
consumedPaths.add(term + "/" + "setting|238");
// Strange Path with value true if setting != other care (238)
consumedPaths.add(term + "/" + "setting|");
if (rmObject.getSetting() != null && (rmObject.getSetting().getDefiningCode().getTerminologyId() == null || rmObject.getSetting().getDefiningCode().getTerminologyId().getValue() == null)) {
rmObject.getSetting().getDefiningCode().setTerminologyId(new TerminologyId("openehr"));
}
}
Aggregations