use of com.nedap.archie.rm.datatypes.CodePhrase in project openEHR_SDK by ehrbase.
the class DvStateValidatorTest method testValidate.
@Test
void testValidate() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_state.json");
var dvState = new DvState();
dvState.setValue(new DvCodedText("Test", new CodePhrase(new TerminologyId("local"), "at0010")));
var result = validator.validate(dvState, node);
assertTrue(result.isEmpty());
}
use of com.nedap.archie.rm.datatypes.CodePhrase in project openEHR_SDK by ehrbase.
the class DvStateValidatorTest method testValidate_List.
@Test
void testValidate_List() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_state_codedtext.json");
var dvState = new DvState();
dvState.setValue(new DvCodedText("First", new CodePhrase(new TerminologyId("local"), "at0028")));
var result = validator.validate(dvState, node);
assertTrue(result.isEmpty());
dvState.setValue(new DvCodedText("Test", new CodePhrase(new TerminologyId("local"), "at0010")));
result = validator.validate(dvState, node);
assertEquals(1, result.size());
}
use of com.nedap.archie.rm.datatypes.CodePhrase in project fhir-bridge by ehrbase.
the class KontaktActionConverter method mapContactWithInfected.
private void mapContactWithInfected(Boolean hadContact) {
DvCodedText dvCodedText = new DvCodedText("Done", new CodePhrase(new TerminologyId("local"), "at0016"));
kontaktAction.setCurrentState(dvCodedText);
if (hadContact) {
kontaktAction.setKontaktZuEinemBestaetigtenFallDefiningCode(AelterOderGleich65JahreAltDefiningCode.JA);
} else {
kontaktAction.setKontaktZuEinemBestaetigtenFallDefiningCode(AelterOderGleich65JahreAltDefiningCode.NEIN);
}
}
use of com.nedap.archie.rm.datatypes.CodePhrase in project fhir-bridge by ehrbase.
the class DocumentReferenceToHipDocumentConverter method getMultimedia.
private MediendateiCluster getMultimedia(DocumentReference documentReference) {
Attachment attachment = documentReference.getContentFirstRep().getAttachment();
DvMultimedia multimedia = new DvMultimedia();
multimedia.setUri(new DvURI(attachment.getUrl()));
multimedia.setMediaType(new CodePhrase(new TerminologyId("IANA_media-types"), attachment.getContentType()));
multimedia.setSize(attachment.getSize());
MediendateiCluster result = new MediendateiCluster();
result.setMediendateiInhalt(multimedia);
result.setMediendateiInhaltValue(attachment.getTitle());
result.setBeschreibungValue(documentReference.getDescription());
getCreation(attachment).ifPresent(result::setErstelltValue);
return result;
}
use of com.nedap.archie.rm.datatypes.CodePhrase in project openEHR_SDK by ehrbase.
the class StdToCompositionWalker method postHandle.
@Override
protected void postHandle(Context<Map<FlatPathDto, String>> context) {
super.postHandle(context);
if (isRaw(context)) {
handleRaw(context);
}
WebTemplateNode currentNode = context.getNodeDeque().peek();
currentNode.getChildren().forEach(childNode -> {
// Check for Raw in optional (skipped Nodes)
if (context.getFlatHelper().skip(childNode, currentNode)) {
context.getNodeDeque().push(childNode);
context.getRmObjectDeque().push(new RMObject() {
});
String path = context.getFlatHelper().buildNamePath(context, true);
Map<FlatPathDto, String> subValues = context.getObjectDeque().peek().entrySet().stream().filter(e -> e.getKey().startsWith(path + "/_" + childNode.getId())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
context.getObjectDeque().push(subValues);
if (isRaw(context)) {
handleRaw(context);
}
context.getNodeDeque().poll();
context.getRmObjectDeque().poll();
context.getObjectDeque().poll();
}
});
List<? extends UnmarshalPostprocessor<? extends RMObject>> postprocessor = findUnmarshalPostprocessors(context.getRmObjectDeque().peek().getClass());
String namePath = buildNamePathWithElementHandling(context);
if (Entry.class.isAssignableFrom(context.getRmObjectDeque().peek().getClass())) {
if (((Entry) context.getRmObjectDeque().peek()).getSubject() instanceof PartyRelated) {
Optional.ofNullable(context.getNodeDeque().peek()).flatMap(c -> c.findChildById("subject")).flatMap(c -> c.findChildById("relationship")).stream().map(WebTemplateNode::getInputs).flatMap(List::stream).filter(i -> "code".equals(i.getSuffix())).map(WebTemplateInput::getList).map(l -> l.size() == 1 ? l.get(0) : null).filter(Objects::nonNull).findAny().ifPresent(v -> ((PartyRelated) ((Entry) context.getRmObjectDeque().peek()).getSubject()).setRelationship(new DvCodedText(v.getLabel(), new CodePhrase(new TerminologyId("openehr"), v.getValue()))));
}
}
postprocessor.forEach(p -> ((UnmarshalPostprocessor) p).process(namePath, context.getRmObjectDeque().peek(), context.getObjectDeque().peek(), consumedPaths, context));
}
Aggregations