Search in sources :

Example 11 with DvDateTime

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;
}
Also used : PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) PatientenaufenthaltComposition(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.PatientenaufenthaltComposition) VersorgungsortAdminEntry(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.VersorgungsortAdminEntry) StandortCluster(org.ehrbase.client.classgenerator.examples.patientenaufenthaltcomposition.definition.StandortCluster) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 12 with DvDateTime

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;
}
Also used : EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) CompareCanonicalDvDateTime(org.ehrbase.client.openehrclient.defaultrestclient.systematic.comparator.datetime.CompareCanonicalDvDateTime) Map(java.util.Map) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) CompareCanonicalDvDateTime(org.ehrbase.client.openehrclient.defaultrestclient.systematic.comparator.datetime.CompareCanonicalDvDateTime)

Example 13 with DvDateTime

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());
}
Also used : DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) Test(org.junit.jupiter.api.Test)

Example 14 with DvDateTime

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());
}
Also used : OffsetDateTime(java.time.OffsetDateTime) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) Test(org.junit.jupiter.api.Test)

Example 15 with DvDateTime

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());
}
Also used : DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) Test(org.junit.jupiter.api.Test)

Aggregations

DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)44 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)11 Test (org.junit.Test)10 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)8 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)7 EventContext (com.nedap.archie.rm.composition.EventContext)6 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)5 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)5 PersistedPartyProxy (org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)5 Composition (com.nedap.archie.rm.composition.Composition)4 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)4 Participation (com.nedap.archie.rm.generic.Participation)4 TemporalAccessor (java.time.temporal.TemporalAccessor)4 Objects (java.util.Objects)4 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)3 DvText (com.nedap.archie.rm.datavalues.DvText)3 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)3 AuditDetails (com.nedap.archie.rm.generic.AuditDetails)3 UUID (java.util.UUID)3 Test (org.junit.jupiter.api.Test)3