use of com.nedap.archie.rm.datavalues.DvText in project openEHR_SDK by ehrbase.
the class TermMappingTestOverwritten method testTermMappingFromJson.
@Override
@Test
public void testTermMappingFromJson() throws Exception {
String template = this.getFileContent("/res/Demo Vitals.xml");
String rawJson = this.getFileContent("/res/TmComposition.json");
Composition unmarshal = new CanonicalJson().unmarshal(rawJson.replace("\"@class\"", "\"_type\""), Composition.class);
String structuredJson = getFlatJson(template, FlatFormat.STRUCTURED).marshal(unmarshal);
Composition actualComposition = getFlatJson(template, FlatFormat.STRUCTURED).unmarshal(structuredJson);
List<TermMapping> termMappings = ((DvText) actualComposition.itemsAtPath("/content[openEHR-EHR-SECTION.ispek_dialog.v1]/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events/data/items[at0.63]/value").get(0)).getMappings();
assertThat(termMappings).extracting(TermMapping::getMatch, t -> t.getTarget().getCodeString(), t -> t.getTarget().getTerminologyId().getValue(), TermMapping::getPurpose).containsExactlyInAnyOrder(new Tuple('=', "21794005", "SNOMED-CT", null), new Tuple('=', "W.11.7", "RTX", null));
List<TermMapping> termMappings2 = ((DvText) actualComposition.itemsAtPath("/content[openEHR-EHR-SECTION.ispek_dialog.v1]/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events/state/items[at0041]/value").get(0)).getMappings();
assertThat(termMappings2).extracting(TermMapping::getMatch, t -> t.getTarget().getCodeString(), t -> t.getTarget().getTerminologyId().getValue(), TermMapping::getPurpose).containsExactlyInAnyOrder(new Tuple('=', "99.1", "IAXA", new DvCodedText("Purpose 1", new CodePhrase(new TerminologyId("Purposes"), "p.0.63.1"))));
}
use of com.nedap.archie.rm.datavalues.DvText in project openEHR_SDK by ehrbase.
the class TestData method buildEhrbaseBloodPressureSimpleDeV0.
public static EhrbaseBloodPressureSimpleDeV0Composition buildEhrbaseBloodPressureSimpleDeV0() {
EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = new EhrbaseBloodPressureSimpleDeV0Composition();
bloodPressureSimpleDeV0.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
bloodPressureSimpleDeV0.setEndTimeValue(OffsetDateTime.now());
bloodPressureSimpleDeV0.setBloodPressureTrainingSample(new ArrayList<>());
bloodPressureSimpleDeV0.setLanguage(Language.DE);
bloodPressureSimpleDeV0.setTerritory(Territory.DE);
bloodPressureSimpleDeV0.setCategoryDefiningCode(Category.EVENT);
bloodPressureSimpleDeV0.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
bloodPressureSimpleDeV0.setComposer(new PartyIdentified(null, "Test", null));
bloodPressureSimpleDeV0.setParticipations(new ArrayList<>());
bloodPressureSimpleDeV0.getParticipations().add(new Participation(new PartyIdentified(null, "Test", null), new DvText("Pos1"), null, null));
bloodPressureSimpleDeV0.getParticipations().add(new Participation(new PartyIdentified(null, "Test2", null), new DvText("Pos2"), null, null));
bloodPressureSimpleDeV0.getBloodPressureTrainingSample().add(buildBloodPressureTrainingSampleObservation());
return bloodPressureSimpleDeV0;
}
use of com.nedap.archie.rm.datavalues.DvText in project openEHR_SDK by ehrbase.
the class DefaultRestDirectoryEndpoint method find.
synchronized Folder find(String path) {
if (StringUtils.isBlank(path)) {
return root;
}
String[] split = path.split(FOLDER_DIVIDER);
Folder current = root;
for (String folderName : split) {
Folder newFolder = Optional.ofNullable(current).map(Folder::getFolders).flatMap(l -> l.stream().filter(f -> folderName.equals(f.getName().getValue())).findAny()).orElse(null);
if (newFolder == null) {
newFolder = new Folder();
newFolder.setArchetypeNodeId("openEHR-EHR-FOLDER.generic.v1");
newFolder.setName(new DvText(folderName));
if (current.getFolders() == null) {
current.setFolders(new ArrayList<>());
}
current.addFolder(newFolder);
}
current = newFolder;
}
return current;
}
use of com.nedap.archie.rm.datavalues.DvText in project openEHR_SDK by ehrbase.
the class DefaultRestDirectoryEndpoint method createRoot.
private void createRoot() {
root = new Folder();
root.setName(new DvText("root"));
root.setArchetypeNodeId("openEHR-EHR-FOLDER.generic.v1");
VersionUid versionUid = defaultRestClient.httpPost(resolve(""), root);
rootVersion = versionUid;
}
use of com.nedap.archie.rm.datavalues.DvText in project openEHR_SDK by ehrbase.
the class OptSkeletonBuilderTest method testGenerateEpisodeOfCare.
@Test
public void testGenerateEpisodeOfCare() throws Exception {
org.openehr.schemas.v1.TemplateDocument document = org.openehr.schemas.v1.TemplateDocument.Factory.parse(OperationalTemplateTestData.EPISODE_OF_CARE.getStream());
OPERATIONALTEMPLATE operationaltemplate = document.getTemplate();
OptSkeletonBuilder cut = new OptSkeletonBuilder();
Composition generate = (Composition) cut.generate(operationaltemplate);
assertThat(generate).isNotNull();
assertThat(generate.itemAtPath("/composer")).isNotNull();
assertThat(generate.itemAtPath("/context/end_time")).isNotNull();
assertThat(generate.itemAtPath("/name")).extracting(d -> ((DvText) d).getValue()).isEqualTo("EpisodeOfCare");
}
Aggregations