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();
}
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());
}
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());
}
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());
}
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"));
}
Aggregations