Skip to content

Commit

Permalink
implement evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
nr23730 committed Mar 4, 2024
1 parent 817ce46 commit 6f10644
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/main/java/de/uksh/medic/etl/openehrmapper/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,27 +166,35 @@ public static void gen_OBSERVATION(String path, String name, Object jsonmap, Map
processAttributeChildren(oap, paramName, history, (Map<String, Object>) map.get(paramName));
observation.setData(history);
if (oa) {
((ArrayList<ContentItem>) jsonmap).add(observation);
((List<ContentItem>) jsonmap).add(observation);
}
}
}

@SuppressWarnings("unchecked")
public static void gen_EVALUATION(String path, String name, Object jsonmap, Map<String, Object> map)
throws Exception {
String nodeId = getNodeId(path);
String label = getTypeLabel(path, nodeId);
// String newPath = path + "/attributes";
Evaluation events = new Evaluation();
events.setArchetypeNodeId(nodeId);
String paramName = getArcheTypeId(path);
String oap = path + "/attributes[rm_attribute_name=\"data\"]";
Boolean oa = (Boolean) XP.evaluate(oap, opt, XPathConstants.BOOLEAN);

events.setNameAsString(label);
Evaluation evaluation = new Evaluation();
evaluation.setArchetypeDetails(new Archetyped(new ArchetypeID(paramName), "1.1.0"));
evaluation.setArchetypeNodeId(paramName);
evaluation.setNameAsString(getLabel(getNodeId(path), paramName));
evaluation.setLanguage(new CodePhrase(new TerminologyId("ISO_639-1"), "de"));
evaluation.setEncoding(new CodePhrase(new TerminologyId("IANA_character-sets"), "UTF-8"));
evaluation.setSubject(new PartySelf());

// events.setTime(new DvDateTime((String) map.get("events_time")));
// ItemTree itemTree = new ItemTree();
// processAttributeChildren(path, nodeId, itemTree, map);
// events.setData(itemTree);
if (map.containsKey(paramName)) {
ItemTree data = new ItemTree();
processAttributeChildren(oap, paramName, data, (Map<String, Object>) map.get(paramName));
evaluation.setData(data);
if (oa) {
((List<ContentItem>) jsonmap).add(evaluation);
}
}

// ((History<ItemStructure>) jsonmap).addEvent(events);
}

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -390,7 +398,7 @@ public static void gen_HISTORY(String path, String name, Object jsonmap, Map<Str

history.setNameAsString(label);

history.setOrigin(new DvDateTime((String) map.get("events_time")));
history.setOrigin(new DvDateTime((String) ((List<String>) map.get("events_time")).get(0)));

processAttributeChildren(newPath, nodeId, history, map);
}
Expand All @@ -406,7 +414,7 @@ public static void gen_EVENT(String path, String name, Object jsonmap, Map<Strin

events.setNameAsString(label);

events.setTime(new DvDateTime((String) map.get("events_time")));
events.setTime(new DvDateTime((String) ((List<String>) map.get("events_time")).get(0)));
ItemTree itemTree = new ItemTree();
processAttributeChildren(newPath, nodeId, itemTree, map);
events.setData(itemTree);
Expand Down

0 comments on commit 6f10644

Please sign in to comment.