Search in sources :

Example 1 with ConceptSource

use of org.openmrs.ConceptSource in project openmrs-module-pihcore by PIH.

the class CauseOfDeathListTagHandlerComponentTest method setUp.

@Before
public void setUp() throws Exception {
    ConceptSource ciel = conceptSource("CIEL", "Columbia International eHealth Laboratory concept ID", null, CoreConceptMetadataBundle.ConceptSources.CIEL);
    conceptService.saveConceptSource(ciel);
    // for some reason, one of the other tests leaves the context dirty, and the locale set to "fr", which causes the tests to fail when matching obs
    Context.setLocale(new Locale("en"));
    unknownConcept = testData.concept().datatype("N/A").conceptClass("Misc").name("Unknown Concept").save();
    administrationService.saveGlobalProperty(new GlobalProperty(HtmlFormEntryConstants.GP_UNKNOWN_CONCEPT, unknownConcept.getUuid()));
    codedCauseConcept = testData.concept().datatype("Coded").conceptClass("Misc").name("CAUSE OF DEATH FROM DEATH CERTIFICATE").mapping("SAME-AS", "CIEL:1814").save();
    nonCodedCauseConcept = testData.concept().datatype("Text").conceptClass("Misc").name("Probable cause of death (text)").mapping("SAME-AS", "CIEL:160218").save();
    sequenceConcept = testData.conceptNumeric().datatype("Numeric").conceptClass("Misc").name("DIAGNOSIS SEQUENCE NUMBER").mapping("SAME-AS", "CIEL:1815").save();
    groupingConcept = testData.concept().datatype("N/A").conceptClass("Misc").name("CAUSES OF DEATH FROM DEATH CERTIFICATE").mapping("SAME-AS", "CIEL:1816").setMembers(codedCauseConcept, nonCodedCauseConcept, sequenceConcept).save();
    HtmlFormSetup.setupHtmlFormEntryTagHandlers();
}
Also used : Locale(java.util.Locale) ConceptSource(org.openmrs.ConceptSource) GlobalProperty(org.openmrs.GlobalProperty) Before(org.junit.Before)

Example 2 with ConceptSource

use of org.openmrs.ConceptSource in project openmrs-module-pihcore by PIH.

the class PastMedicalHistoryCheckboxTagHandlerTest method setupConcepts.

private void setupConcepts() throws Exception {
    // copied from some pihcore concept setup, but tweaked to work with standardTestDataset.xml
    ConceptDatatype coded = MetadataUtils.existing(ConceptDatatype.class, CoreConceptMetadataBundle.ConceptDatatypes.CODED);
    ConceptDatatype text = MetadataUtils.existing(ConceptDatatype.class, CoreConceptMetadataBundle.ConceptDatatypes.TEXT);
    ConceptDatatype notApplicable = MetadataUtils.existing(ConceptDatatype.class, CoreConceptMetadataBundle.ConceptDatatypes.N_A);
    ConceptClass diagnosis = MetadataUtils.existing(ConceptClass.class, "938834bf-a745-4dbd-b611-f06a9a5a3060");
    ConceptClass question = MetadataUtils.existing(ConceptClass.class, "a82ef63c-e4e4-48d6-988a-fdd74d7541a7");
    ConceptClass misc = MetadataUtils.existing(ConceptClass.class, "ecdee8a7-d741-4fe7-8e01-f79cacbe97bc");
    ConceptMapType sameAs = MetadataUtils.existing(ConceptMapType.class, CoreConceptMetadataBundle.ConceptMapTypes.SAME_AS);
    ConceptSource ciel = conceptSource("CIEL", "Columbia International eHealth Laboratory concept ID", null, CoreConceptMetadataBundle.ConceptSources.CIEL);
    conceptService.saveConceptSource(ciel);
    // these are in standardTestDataset.xml
    Concept no = conceptService.getConcept(8);
    Concept unknown = conceptService.getConcept(22);
    // need this to have a different UUID to match our dictionary
    yes = conceptService.getConcept(7);
    yes.setUuid(CommonConcepts.Concepts.YES);
    conceptService.saveConcept(yes);
    Concept pmhWhich = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_FINDING).datatype(coded).conceptClass(diagnosis).name("1908BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Past medical history finding", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).description("1470FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "Coded list of past medical history problems but not procedures which are coded under Past Surgical History.", Locale.ENGLISH).mapping(new ConceptMapBuilder("171868ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "1628").build()).build());
    Concept isSymptomPresent = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_PRESENCE).datatype(coded).conceptClass(diagnosis).name("2009BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Sign/symptom present", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).answers(yes, no, unknown).mapping(new ConceptMapBuilder("171968ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "1729").build()).build());
    // TODO waiting for confirmation from Andy that this is appropriate as comments
    Concept pmhComment = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_COMMENT).datatype(text).conceptClass(question).name("108123BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Past medical history added (text)", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).mapping(new ConceptMapBuilder("217354ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "160221").build()).build());
    Concept pmhConstruct = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_CONSTRUCT).datatype(notApplicable).conceptClass(misc).name("1913BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Past medical history", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).name("86916BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "PMH", Locale.ENGLISH, ConceptNameType.SHORT).setMembers(pmhWhich, isSymptomPresent, pmhComment).mapping(new ConceptMapBuilder("171873ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "1633").build()).build());
}
Also used : Concept(org.openmrs.Concept) ConceptClass(org.openmrs.ConceptClass) ConceptMapType(org.openmrs.ConceptMapType) ConceptBuilder(org.openmrs.module.metadatadeploy.builder.ConceptBuilder) ConceptMapBuilder(org.openmrs.module.metadatadeploy.builder.ConceptMapBuilder) ConceptSource(org.openmrs.ConceptSource) ConceptDatatype(org.openmrs.ConceptDatatype)

Example 3 with ConceptSource

use of org.openmrs.ConceptSource in project openmrs-core by openmrs.

the class ConceptSourceValidatorTest method validate_shouldPassValidationIfFieldLengthsAreCorrect.

@Test
public void validate_shouldPassValidationIfFieldLengthsAreCorrect() {
    ConceptSource conceptSource = new ConceptSource();
    conceptSource.setName("New name");
    conceptSource.setDescription("Some description");
    conceptSource.setHl7Code("Hl7Code");
    conceptSource.setRetireReason("RetireReason");
    Errors errors = new BindException(conceptSource, "conceptSource");
    new ConceptSourceValidator().validate(conceptSource, errors);
    Assert.assertFalse(errors.hasErrors());
}
Also used : Errors(org.springframework.validation.Errors) BindException(org.springframework.validation.BindException) ConceptSource(org.openmrs.ConceptSource) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 4 with ConceptSource

use of org.openmrs.ConceptSource in project openmrs-core by openmrs.

the class ConceptSourceValidatorTest method validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues.

@Test
public void validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues() {
    ConceptSource conceptSource = new ConceptSource();
    conceptSource.setName("New name");
    conceptSource.setDescription("Some description");
    Errors errors = new BindException(conceptSource, "conceptSource");
    new ConceptSourceValidator().validate(conceptSource, errors);
    Assert.assertFalse(errors.hasErrors());
}
Also used : Errors(org.springframework.validation.Errors) BindException(org.springframework.validation.BindException) ConceptSource(org.openmrs.ConceptSource) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 5 with ConceptSource

use of org.openmrs.ConceptSource in project openmrs-core by openmrs.

the class ConceptSourceValidatorTest method validate_shouldPassValidationIfHl7CodeIsNullOrEmptyOrWhitespace.

@Test
public void validate_shouldPassValidationIfHl7CodeIsNullOrEmptyOrWhitespace() {
    ConceptSource conceptSource = new ConceptSource();
    conceptSource.setName("New name");
    conceptSource.setDescription("Some description");
    conceptSource.setHl7Code(null);
    Errors errors = new BindException(conceptSource, "conceptSource");
    new ConceptSourceValidator().validate(conceptSource, errors);
    Assert.assertFalse(errors.hasFieldErrors("Hl7Code"));
    conceptSource.setHl7Code("");
    errors = new BindException(conceptSource, "conceptSource");
    new ConceptSourceValidator().validate(conceptSource, errors);
    Assert.assertFalse(errors.hasFieldErrors("Hl7Code"));
    conceptSource.setHl7Code("   ");
    errors = new BindException(conceptSource, "conceptSource");
    new ConceptSourceValidator().validate(conceptSource, errors);
    Assert.assertFalse(errors.hasFieldErrors("Hl7Code"));
}
Also used : Errors(org.springframework.validation.Errors) BindException(org.springframework.validation.BindException) ConceptSource(org.openmrs.ConceptSource) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Aggregations

ConceptSource (org.openmrs.ConceptSource)39 Test (org.junit.Test)29 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)28 ConceptMapType (org.openmrs.ConceptMapType)6 ConceptReferenceTerm (org.openmrs.ConceptReferenceTerm)6 BindException (org.springframework.validation.BindException)6 Errors (org.springframework.validation.Errors)6 Drug (org.openmrs.Drug)5 ArrayList (java.util.ArrayList)4 Concept (org.openmrs.Concept)4 Locale (java.util.Locale)3 Criteria (org.hibernate.Criteria)3 ConceptClass (org.openmrs.ConceptClass)2 ConceptDatatype (org.openmrs.ConceptDatatype)2 ConceptSearchResult (org.openmrs.ConceptSearchResult)2 GlobalProperty (org.openmrs.GlobalProperty)2 User (org.openmrs.User)2 ConceptBuilder (org.openmrs.module.metadatadeploy.builder.ConceptBuilder)2 ConceptMapBuilder (org.openmrs.module.metadatadeploy.builder.ConceptMapBuilder)2 SimpleObject (org.openmrs.ui.framework.SimpleObject)2