Hello,
CSV upload for observations(encounter) fails when a concept has a dot(.) in concept names.
Find an example and wiki
We are planning to support configurable separator instead of the fixed dot(.)
EG: Repeat.1.Obs.History and Examination.History and Examination Notes
(Existing)
Repeat.1.Obs.History and Examination$History and Examination Notes
(Suggested) Please note $ in the above example which is configured in global properties.
This is supported only for obs(in encounter upload) to avoid changing other rules in CSV upload feature.
@mksrom @angshuonline @snehabagri @binduak @vinisha @vmalini @mohitd @praveenad
1 Like
unsure. have you tried checking the log? what does it say?
It throws the null pointer exception when a concept has a dot in it.
The following is the piece of code in bahmni-core which explicitly splits csv headers by dot(.) which of-course splits concepts into multiple parts(if it has dot) and eventually can’t find that concept.
public List<EncounterTransaction.Observation> getObservations(EncounterRow encounterRow) throws ParseException {
List<EncounterTransaction.Observation> observations = new ArrayList<>();
if (encounterRow.hasObservations()) {
Date encounterDate = encounterRow.getEncounterDate();
for (KeyValue obsRow : encounterRow.obsRows) {
if (obsRow.getValue() != null && !StringUtils.isEmpty(obsRow.getValue().trim())) {
List<String> conceptNames = new ArrayList<>(Arrays.asList(obsRow.getKey().split("\\.")));
String lastConceptName = conceptNames.get(conceptNames.size() - 1);
Concept lastConcept = Context.getConceptService().getConceptByName(lastConceptName);
if(lastConcept.isNumeric()){
ConceptNumeric cn = (ConceptNumeric) lastConcept;
if(!cn.isAllowDecimal() && obsRow.getValue().contains(".")){
throw new APIException("Decimal is not allowed for "+ cn.getName() +" concept");
}
}
EncounterTransaction.Observation existingObservation = getRootObservationIfExists(observations, conceptNames, null);
if (existingObservation == null) {
observations.add(createObservation(conceptNames, encounterDate, obsRow));
} else {
updateObservation(conceptNames, existingObservation, encounterDate, obsRow);
}
}
}
}
return observations;
}
Find more details in ObservationMapper