Search in sources :

Example 51 with DvCodedText

use of com.nedap.archie.rm.datavalues.DvCodedText in project openEHR_SDK by ehrbase.

the class DvCodedTextIT method testValidate_FhirValueSet.

@Test
void testValidate_FhirValueSet() throws Exception {
    var codePhrase = new CodePhrase(new TerminologyId("http://terminology.hl7.org/CodeSystem/v3-EntityNameUseR2"), "ANON");
    var node = parseNode("/webtemplate_nodes/dv_codedtext_fhir_valueset.json");
    var result = validator.validate(new DvCodedText("Anonymous", codePhrase), node);
    assertTrue(result.isEmpty());
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) Test(org.junit.jupiter.api.Test) AbstractRMObjectValidatorTest(org.ehrbase.validation.webtemplate.AbstractRMObjectValidatorTest)

Example 52 with DvCodedText

use of com.nedap.archie.rm.datavalues.DvCodedText in project openEHR_SDK by ehrbase.

the class DvCodedTextIT method testValidate_FhirCodeSystem_WrongCode.

@Test
void testValidate_FhirCodeSystem_WrongCode() throws Exception {
    var codePhrase = new CodePhrase(new TerminologyId("http://hl7.org/fhir/observation-status"), "casual");
    var node = parseNode("/webtemplate_nodes/dv_codedtext_fhir_codesystem.json");
    var result = validator.validate(new DvCodedText("Casual", codePhrase), node);
    assertEquals(1, result.size());
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) Test(org.junit.jupiter.api.Test) AbstractRMObjectValidatorTest(org.ehrbase.validation.webtemplate.AbstractRMObjectValidatorTest)

Example 53 with DvCodedText

use of com.nedap.archie.rm.datavalues.DvCodedText in project openEHR_SDK by ehrbase.

the class DvCodedTextIT method testValidate_FhirCodeSystem.

@Test
void testValidate_FhirCodeSystem() throws Exception {
    var codePhrase = new CodePhrase(new TerminologyId("http://hl7.org/fhir/observation-status"), "final");
    var node = parseNode("/webtemplate_nodes/dv_codedtext_fhir_codesystem.json");
    var result = validator.validate(new DvCodedText("Final", codePhrase), node);
    assertTrue(result.isEmpty());
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) Test(org.junit.jupiter.api.Test) AbstractRMObjectValidatorTest(org.ehrbase.validation.webtemplate.AbstractRMObjectValidatorTest)

Example 54 with DvCodedText

use of com.nedap.archie.rm.datavalues.DvCodedText in project openEHR_SDK by ehrbase.

the class DvCodedTextIT method testValidate_UnsupportedExternalTerminology.

@Test
void testValidate_UnsupportedExternalTerminology() throws Exception {
    var node = parseNode("/webtemplate_nodes/dv_codedtext_unsupported.json");
    var dvCodedText = new DvCodedText("Iodine-deficiency related thyroid disorders and allied conditions", new CodePhrase(new TerminologyId("ICD10"), "E01"));
    var result = validator.validate(dvCodedText, node);
    assertTrue(result.isEmpty());
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) Test(org.junit.jupiter.api.Test) AbstractRMObjectValidatorTest(org.ehrbase.validation.webtemplate.AbstractRMObjectValidatorTest)

Example 55 with DvCodedText

use of com.nedap.archie.rm.datavalues.DvCodedText in project openEHR_SDK by ehrbase.

the class ItemValidatorTest method matchValidator.

@Test
public void matchValidator() throws NoSuchMethodException, IllegalAccessException, ClassNotFoundException {
    ItemValidator itemValidator = new ItemValidator();
    itemValidator.add(new org.ehrbase.validation.terminology.validator.DvCodedText());
    DvCodedText dvCodedText = new DvCodedText("secondary allied health care", new CodePhrase(new TerminologyId("openehr"), "234"));
    assertTrue(itemValidator.isValidatedRmObjectType(dvCodedText));
    try {
        itemValidator.validate(new LocalizedTerminologies().locale("en"), AttributeCodesetMapping.getInstance(), "setting", dvCodedText, "en");
    } catch (Throwable throwable) {
        fail();
    }
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) LocalizedTerminologies(org.ehrbase.terminology.openehr.implementation.LocalizedTerminologies) Test(org.junit.Test)

Aggregations

DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)74 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)56 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)50 Test (org.junit.jupiter.api.Test)25 DvText (com.nedap.archie.rm.datavalues.DvText)17 Test (org.junit.Test)15 Composition (com.nedap.archie.rm.composition.Composition)9 ArrayList (java.util.ArrayList)9 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)8 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)8 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)7 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)7 List (java.util.List)7 AbstractRMObjectValidatorTest (org.ehrbase.validation.webtemplate.AbstractRMObjectValidatorTest)7 IOException (java.io.IOException)6 PersistedPartyProxy (org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)6 CanonicalJson (org.ehrbase.serialisation.jsonencoding.CanonicalJson)6 FlatPathDto (org.ehrbase.webtemplate.path.flat.FlatPathDto)6 EventContext (com.nedap.archie.rm.composition.EventContext)4 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)4