use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class TestData method buildTestPatientenaufenthaltComposition.
public static PatientenaufenthaltComposition buildTestPatientenaufenthaltComposition() {
PatientenaufenthaltComposition patientenaufenthaltComposition = new PatientenaufenthaltComposition();
patientenaufenthaltComposition.setComposer(new PartyIdentified(null, "Test", null));
patientenaufenthaltComposition.setCategoryDefiningCode(Category.EVENT);
patientenaufenthaltComposition.setLanguage(Language.DE);
patientenaufenthaltComposition.setTerritory(Territory.DE);
patientenaufenthaltComposition.setStartTimeValue(OffsetDateTime.now());
patientenaufenthaltComposition.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
VersorgungsortAdminEntry versorgungsortAdminEntry = new VersorgungsortAdminEntry();
StandortCluster standortCluster = new StandortCluster();
standortCluster.setStandorttypValue("Test");
standortCluster.setStandortbeschreibungValue("Beschreibung");
standortCluster.setStandortschlusselDefiningCode(StandortschlusselDefiningCode.ANGIOLOGIE.ANGIOLOGIE);
standortCluster.setBettplatzkennungValue("Platz 2");
versorgungsortAdminEntry.setStandort(standortCluster);
versorgungsortAdminEntry.setBeginnValue(new DvDateTime("2020-01-01T10:00Z").getValue());
versorgungsortAdminEntry.setEndeValue(new DvDateTime("2020-01-01T12:00Z").getValue());
versorgungsortAdminEntry.setGrundDesAufenthaltesValue("test value");
versorgungsortAdminEntry.setLanguage(Language.DE);
versorgungsortAdminEntry.setSubject(new PartySelf());
patientenaufenthaltComposition.setVersorgungsort(versorgungsortAdminEntry);
return patientenaufenthaltComposition;
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class EhrComparator method compare.
public Object compare(Map<String, Object> actualEhrMap) {
String type = (String) actualEhrMap.get("_type");
HierObjectId ehrId = (HierObjectId) toRmObject((Map<String, Object>) actualEhrMap.get("ehr_id"), HierObjectId.class);
EhrStatus ehrStatus = (EhrStatus) toRmObject((Map<String, Object>) actualEhrMap.get("ehr_status"), EhrStatus.class);
HierObjectId systemId = (HierObjectId) toRmObject((Map<String, Object>) actualEhrMap.get("system_id"), HierObjectId.class);
DvDateTime timeCreated = (DvDateTime) toRmObject((Map<String, Object>) actualEhrMap.get("time_created"), DvDateTime.class);
// high level attributes
assertThat(type).isEqualTo("EHR");
new CompareCanonicalHierObjects(ehrId).isExpectedEqualToCanonicalUsing(ehrUUID.toString());
new CompareCanonicalHierObjects(systemId).isExpectedEqualToCanonicalUsing("local.ehrbase.org");
new CompareCanonicalDvDateTime(timeCreated).setCompareDateOnly(true).isExpectedEqualToCanonicalUsing(transactionDateTime);
EhrStatusComparator.compare(ehrStatus, referenceEhrStatus);
return null;
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class DvDateTimeValidatorTest method testValidate_Pattern.
@Test
void testValidate_Pattern() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_datetime_pattern.json");
var value = OffsetDateTime.of(2022, 1, 10, 12, 0, 0, 0, ZoneOffset.UTC);
var result = validator.validate(new DvDateTime(value), node);
assertTrue(result.isEmpty());
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class DvDateTimeValidatorTest method testValidate_Range.
@Test
void testValidate_Range() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_datetime_range.json");
OffsetDateTime value;
value = OffsetDateTime.of(2022, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC);
var result = validator.validate(new DvDateTime(value), node);
assertTrue(result.isEmpty());
value = OffsetDateTime.of(2022, 1, 1, 11, 15, 0, 0, ZoneOffset.of("+01:00"));
result = validator.validate(new DvDateTime(value), node);
assertTrue(result.isEmpty());
value = OffsetDateTime.of(2022, 1, 10, 12, 0, 0, 0, ZoneOffset.UTC);
result = validator.validate(new DvDateTime(value), node);
assertEquals(1, result.size());
value = OffsetDateTime.of(2022, 1, 1, 7, 0, 0, 0, ZoneOffset.UTC);
result = validator.validate(new DvDateTime(value), node);
assertEquals(1, result.size());
value = OffsetDateTime.of(2022, 1, 10, 18, 30, 0, 0, ZoneOffset.of("+01:00"));
result = validator.validate(new DvDateTime(value), node);
assertEquals(1, result.size());
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class DvDateTimeValidatorTest method testValidate.
@Test
void testValidate() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_datetime.json");
var result = validator.validate(new DvDateTime(OffsetDateTime.now()), node);
Assertions.assertTrue(result.isEmpty());
}
Aggregations