Skip to content

Commit

Permalink
implement xds enveloping
Browse files Browse the repository at this point in the history
  • Loading branch information
nr23730 committed Mar 5, 2024
1 parent 6f10644 commit 5d386b4
Show file tree
Hide file tree
Showing 2 changed files with 280 additions and 3 deletions.
265 changes: 265 additions & 0 deletions iti41.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
xmlns:lcm="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" xmlns:urn="urn:ihe:iti:xds-b:2007"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soap:Header>
<wsa:MessageID soap:mustUnderstand="true">9f48bcfe-592c-49db-872c-4b2194695940</wsa:MessageID>
<wsa:Action soap:mustUnderstand="true">urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b</wsa:Action>
</soap:Header>
<soap:Body>
<urn:ProvideAndRegisterDocumentSetRequest>
<lcm:SubmitObjectsRequest>
<rim:RegistryObjectList>
<rim:Classification
classifiedObject="urn:uuid:UUID1"
classificationNode="urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd" id="cl1"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification" />
<rim:RegistryPackage id="urn:uuid:UUID1"
objectType="urn:oasis:names:tc:ebxml- regrep:ObjectType:RegistryObject:RegistryPackage">
<rim:Classification
classificationScheme="urn:uuid:93606bcf-9494-43ec-9b4e-a7748d1a838d"
classifiedObject="urn:uuid:UUID1"
id="cl2"
objectType="urn:oasis:names:tc:ebxmlregrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="">
<rim:Slot name="authorInstitution">
<rim:ValueList>
<rim:Value>UKSH^^^^^^^^^1.2.276.0.76.3.1.454.1.2.1</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="authorSpecialty">
<rim:ValueList>
<rim:Value>FA Innere Medizin und (SP) Kardiologie</rim:Value>
</rim:ValueList>
</rim:Slot>
</rim:Classification>
<rim:ExternalIdentifier
identificationScheme="urn:uuid:6b5aea1a-874d-4603-a4bc-96a0a7b38446"
value="MPIID^^^&amp;1.2.276.0.76.3.1.454.1.11.100&amp;ISO"
id="ei1"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"
registryObject="urn:uuid:UUID1">
<rim:Name>
<rim:LocalizedString value="XDSSubmissionSet.patientId">
MPIID^^^&amp;1.2.276.0.76.3.1.454.1.11.100&amp;ISO</rim:LocalizedString>
</rim:Name>
</rim:ExternalIdentifier>
<rim:Classification
classificationScheme="urn:uuid:aa543740-bdda-424e-8c96-df4873be8500"
classifiedObject="urn:uuid:UUID1"
id="cl3"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="1">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>1.3.6.1.4.1.19376.3.276.1.5.12</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="Patientenkontakt" />
</rim:Name>
</rim:Classification>
<rim:ExternalIdentifier
identificationScheme="urn:uuid:554ac39e-e3fe-47fe-b233-965d2a147832"
value="1.2.276.0.76.3.1.454.1.1.104" id="ei2"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"
registryObject="urn:uuid:UUID1">
<rim:Name>
<rim:LocalizedString value="XDSSubmissionSet.sourceId" />
</rim:Name>
</rim:ExternalIdentifier>
<rim:Slot name="submissionTime">
<rim:ValueList>
<rim:Value>20231216014613</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:ExternalIdentifier
identificationScheme="urn:uuid:96fdda7c-d067-4183-912e-bf5ee74998a8"
id="ei3"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"
value="1.2.276.0.76.3.1.454.1.10.101.TIMESTAMP"
registryObject="urn:uuid:UUID1">
<rim:Name>
<rim:LocalizedString value="XDSSubmissionSet.uniqueId" />
</rim:Name>
</rim:ExternalIdentifier>
</rim:RegistryPackage>
<rim:Association id="as1"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association"
associationType="urn:oasis:names:tc:ebxml-regrep:AssociationType:HasMember"
sourceObject="urn:uuid:UUID1"
targetObject="urn:uuid:UUID2">
<rim:Slot name="SubmissionSetStatus">
<rim:ValueList>
<rim:Value>Original</rim:Value>
</rim:ValueList>
</rim:Slot>
</rim:Association>
<rim:ExtrinsicObject id="urn:uuid:UUID2"
mimeType="text/xml"
objectType="urn:uuid:7edca82f-054d-47f2-a032-9b2a5b5186c1">
<rim:Classification
classificationScheme="urn:uuid:93606bcf-9494-43ec-9b4e-a7748d1a838d"
classifiedObject="urn:uuid:UUID2"
id="cl4"
objectType="urn:oasis:names:tc:ebxmlregrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="">
<rim:Slot name="authorInstitution">
<rim:ValueList>
<rim:Value>UKSH^^^^^^^^^1.2.276.0.76.3.1.454.1.2.1</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="authorSpecialty">
<rim:ValueList>
<rim:Value>FA Innere Medizin und (SP) Kardiologie</rim:Value>
</rim:ValueList>
</rim:Slot>
</rim:Classification>
<rim:ExternalIdentifier
identificationScheme="urn:uuid:58a6f841-87b3-4a3e-92fd-a8ffeff98427"
value="MPIID^^^&amp;1.2.276.0.76.3.1.454.1.11.100&amp;ISO"
id="ei4"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"
registryObject="urn:uuid:UUID2">
<rim:Name>
<rim:LocalizedString value="XDSDocumentEntry.patientId" />
</rim:Name>
</rim:ExternalIdentifier>
<rim:ExternalIdentifier
identificationScheme="urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab"
value="1.2.276.0.76.3.1.454.1.10.103_urn:uuid:UUID2_TIMESTAMP"
id="ei5"
obejctType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"
registryObject="urn:uuid:UUID2">
<rim:Name>
<rim:LocalizedString value="XDSDocumentEntry.uniqueId" />
</rim:Name>
</rim:ExternalIdentifier>
<rim:Classification
classificationScheme="urn:uuid:41a5887f-8865-4c09-adf7-e362475b143a"
classifiedObject="urn:uuid:UUID2"
id="cl5"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="ADM">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>1.3.6.1.4.1.19376.3.276.1.5.8</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="Administratives Dokument" />
</rim:Name>
</rim:Classification>
<rim:Classification
classificationScheme="urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840f"
classifiedObject="urn:uuid:UUID2"
id="cl6"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="N">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>2.16.840.1.113883.5.25</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="normal" />
</rim:Name>
</rim:Classification>
<rim:Classification
classificationScheme="urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d"
classifiedObject="urn:uuid:UUID2"
id="cl7"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="raw">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>1.3.6.1.4.1.19376.1.2.3</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="Template Data Document" />
</rim:Name>
</rim:Classification>
<rim:Classification
classificationScheme="urn:uuid:f33fb8ac-18af-42cc-ae0e-ed0b0bdb91e1"
classifiedObject="urn:uuid:UUID2"
id="cl8"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="KHS">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>1.3.6.1.4.1.19376.3.276.1.5.2</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="Krankenhaus" />
</rim:Name>
</rim:Classification>
<rim:Classification
classificationScheme="urn:uuid:cccf5598-8b07-4b77-a05e-ae952c785ead"
classifiedObject="urn:uuid:UUID2"
id="cl9"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="VER">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>1.3.6.1.4.1.19376.3.276.1.5.5</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="Verwaltung" />
</rim:Name>
</rim:Classification>
<rim:Classification
classificationScheme="urn:uuid:f0306f51-975f-434e-a61c-c59651d33983"
classifiedObject="urn:uuid:UUID2"
id="cl10"
objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Classification"
nodeRepresentation="ABRE">
<rim:Slot name="codingScheme">
<rim:ValueList>
<rim:Value>1.3.6.1.4.1.19376.3.276.1.5.9</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Name>
<rim:LocalizedString value="Abrechnungsdokumente" />
</rim:Name>
</rim:Classification>
<rim:Slot name="creationTime">
<rim:ValueList>
<rim:Value>20231216014613</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="languageCode">
<rim:ValueList>
<rim:Value>de-DE</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="sourcePatientId">
<rim:ValueList>
<rim:Value>MPIID^^^&amp;1.2.276.0.76.3.1.454.1.11.100&amp;ISO</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="repositoryUniqueId">
<rim:ValueList>
<rim:Value>1.2.276.0.76.3.1.454.1.1.102</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="serviceStartTime">
<rim:ValueList>
<rim:Value>20231216014613</rim:Value>
</rim:ValueList>
</rim:Slot>
<rim:Slot name="serviceStopTime">
<rim:ValueList>
<rim:Value>20231216014613</rim:Value>
</rim:ValueList>
</rim:Slot>
</rim:ExtrinsicObject>
</rim:RegistryObjectList>
</lcm:SubmitObjectsRequest>
<urn:Document id="urn:uuid:UUID2">EHRCONTENT</urn:Document>
</urn:ProvideAndRegisterDocumentSetRequest>
</soap:Body>
</soap:Envelope>
18 changes: 15 additions & 3 deletions src/main/java/de/uksh/medic/etl/OpenEhrObds.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -78,7 +79,7 @@ public static void main(String[] args) throws IOException {

// ToDo: Replace with Kafka consumer

File f = new File("st.xml");
File f = new File("op.xml");

Map<String, Object> m = new LinkedHashMap<>();
walkXmlTree(xmlMapper.readValue(f, new TypeReference<LinkedHashMap<String, Object>>() {
Expand Down Expand Up @@ -233,8 +234,19 @@ private static Map<String, Object> convertMdr(Set<Map.Entry<String, Object>> xml
private static void buildOpenEhrComposition(Map<String, Object> data) {
EHRParser ep = new EHRParser();
try (BufferedWriter writer = new BufferedWriter(
new FileWriter(i++ + "_" + ((List<String>) data.get("ehr_id")).get(0) + ".json"))) {
writer.write(ep.build(data));
new FileWriter(i + "_" + ((List<String>) data.get("ehr_id")).get(0) + ".json"))) {
String ehr = ep.build(data);
writer.write(ehr);
String content = Files.readString(new File("iti41.xml").toPath());
content = content.replaceAll("MPIID", ((List<String>) data.get("ehr_id")).get(0));
content = content.replaceAll("EHRCONTENT", new String(Base64.getEncoder().encode(ehr.getBytes())));
content = content.replace("UUID1", UUID.randomUUID().toString());
content = content.replace("UUID2", UUID.randomUUID().toString());
content = content.replace("TIMESTAMP", String.valueOf(System.currentTimeMillis()));
BufferedWriter writerXDS = new BufferedWriter(
new FileWriter(i++ + "_" + ((List<String>) data.get("ehr_id")).get(0) + ".xml"));
writerXDS.write(content);
writerXDS.close();
} catch (XPathExpressionException | IOException | ParserConfigurationException | SAXException
| JAXBException e) {
// TODO Auto-generated catch block
Expand Down

0 comments on commit 5d386b4

Please sign in to comment.