Search in sources :

Example 51 with CodePhrase

use of com.nedap.archie.rm.datatypes.CodePhrase 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 52 with CodePhrase

use of com.nedap.archie.rm.datatypes.CodePhrase 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 53 with CodePhrase

use of com.nedap.archie.rm.datatypes.CodePhrase 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 54 with CodePhrase

use of com.nedap.archie.rm.datatypes.CodePhrase 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)

Example 55 with CodePhrase

use of com.nedap.archie.rm.datatypes.CodePhrase in project openEHR_SDK by ehrbase.

the class TerminologyCheckTest method testSimpleValidationWrongCode.

@Test
public void testSimpleValidationWrongCode() throws Exception {
    DvCodedText category = new DvCodedText("event", new CodePhrase(new TerminologyId("openehr"), "999"));
    try {
        org.ehrbase.validation.terminology.validator.DvCodedText.validate(localizedTerminologies.locale("en"), codesetMapping, "category", category, "en");
        fail("should have detected a bad code");
    } catch (Exception e) {
    }
}
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.Test)

Aggregations

CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)71 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)60 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)56 Test (org.junit.jupiter.api.Test)23 Test (org.junit.Test)16 Composition (com.nedap.archie.rm.composition.Composition)12 DvText (com.nedap.archie.rm.datavalues.DvText)12 ArrayList (java.util.ArrayList)8 AbstractRMObjectValidatorTest (org.ehrbase.validation.webtemplate.AbstractRMObjectValidatorTest)7 RMObject (com.nedap.archie.rm.RMObject)5 CanonicalJson (org.ehrbase.serialisation.jsonencoding.CanonicalJson)5 FlatPathDto (org.ehrbase.webtemplate.path.flat.FlatPathDto)5 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)4 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)4 ObjectVersionId (com.nedap.archie.rm.support.identification.ObjectVersionId)4 IOException (java.io.IOException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 WebTemplate (org.ehrbase.webtemplate.model.WebTemplate)4 WebTemplateNode (org.ehrbase.webtemplate.model.WebTemplateNode)4 Entry (com.nedap.archie.rm.composition.Entry)3