forked from nedap/archie
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse domain specific types, add conversion config to archie-utils
- Loading branch information
Showing
17 changed files
with
277 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
250 changes: 137 additions & 113 deletions
250
aom/src/main/java/com/nedap/archie/adl14/treewalkers/Adl14CComplexObjectParser.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
...archie/adl14/ConversionConfigForTest.java → .../OpenEHRADL14ConversionConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
package com.nedap.archie.adl14; | ||
|
||
|
||
import com.nedap.archie.json.JacksonUtil; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class ConversionConfigForTest { | ||
|
||
public class OpenEHRADL14ConversionConfiguration { | ||
|
||
public static ADL14ConversionConfiguration getConfig() throws IOException { | ||
|
||
try(InputStream stream = ConversionConfigForTest.class.getResourceAsStream("configuration.json")) { | ||
try(InputStream stream = OpenEHRADL14ConversionConfiguration.class.getResourceAsStream("/adl14conversionconfiguration.json")) { | ||
return JacksonUtil.getObjectMapper().readValue(stream, ADL14ConversionConfiguration.class); | ||
} | ||
|
||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
archie-utils/src/main/resources/adl14conversionconfiguration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"terminology_conversion_templates": [ | ||
{ | ||
"terminology_id": "snomedct", | ||
"template": "http://snomed.info/id/$code_string" | ||
}, | ||
{ | ||
"terminology_id": "snomed-ct", | ||
"template": "http://snomed.info/id/$code_string" | ||
}, | ||
{ | ||
"terminology_id": "snomed", | ||
"template": "http://snomed.info/id/$code_string" | ||
}, | ||
{ | ||
"terminology_id": "openehr", | ||
"template": "http://openehr.org/id/$code_string" | ||
}, | ||
{ | ||
"terminology_id": "loinc", | ||
"template": "http://loinc.org/id/$code_string" | ||
} | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
opt14/src/main/java/com/nedap/archie/opt14/DomainTypeConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,82 @@ | ||
package com.nedap.archie.opt14; | ||
|
||
import com.nedap.archie.adl14.aom14.CDVOrdinal; | ||
import com.nedap.archie.adl14.aom14.CDVOrdinalItem; | ||
import com.nedap.archie.adl14.aom14.CDVQuantity; | ||
|
||
import com.nedap.archie.adl14.aom14.CDVQuantityAssumedValue; | ||
import com.nedap.archie.adl14.aom14.CDVQuantityItem; | ||
import com.nedap.archie.adl14.treewalkers.Adl14CComplexObjectParser; | ||
import com.nedap.archie.aom.CObject; | ||
import com.nedap.archie.base.terminology.TerminologyCode; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import static com.nedap.archie.opt14.BaseTypesConverter.convert; | ||
|
||
public class DomainTypeConverter { | ||
public static CObject convertDomainType(CDOMAINTYPE cobject14) { | ||
if(cobject14 instanceof CDVORDINAL) { | ||
return convertCDVOrdinal((CDVORDINAL) cobject14); | ||
} else if (cobject14 instanceof CDVQUANTITY) { | ||
return convertCDVQuantity((CDVQUANTITY) cobject14); | ||
} else if (cobject14 instanceof CDVSTATE) { | ||
|
||
} else if (cobject14 instanceof CCODEPHRASE) { | ||
|
||
} | ||
return null; | ||
} | ||
|
||
private static CObject convertCDVOrdinal(CDVORDINAL ordinal14) { | ||
CDVOrdinal ordinal = new CDVOrdinal(); | ||
Map<String, CDVOrdinalItem> items = new LinkedHashMap<>(); | ||
if(ordinal14.getList() != null) { | ||
Integer i = 0; | ||
for(DVORDINAL dvordinal14:ordinal14.getList()) { | ||
CDVOrdinalItem item = new CDVOrdinalItem(); | ||
item.setValue(dvordinal14.getValue()); | ||
if(dvordinal14.getSymbol() != null) { | ||
item.setSymbol(convert(dvordinal14.getSymbol().getDefiningCode())); | ||
} | ||
items.put(i.toString(), item); | ||
i++; | ||
} | ||
} | ||
//TODO: no assumed value in our own model, but there is in the OPT form. | ||
|
||
return Adl14CComplexObjectParser.convertCDVOrdinal(ordinal); | ||
} | ||
|
||
private static CObject convertCDVQuantity(CDVQUANTITY cobject14) { | ||
CDVQUANTITY quantity14 = cobject14; | ||
CDVQuantity quantity = new CDVQuantity(); | ||
Map<String, CDVQuantityItem> items = new LinkedHashMap<>(); | ||
|
||
if(quantity14.getList() != null) { | ||
Integer i = 0; | ||
for(CQUANTITYITEM item14:quantity14.getList()) { | ||
CDVQuantityItem item = new CDVQuantityItem(); | ||
item.setMagnitude(BaseTypesConverter.convertInterval(item14.getMagnitude())); | ||
item.setPrecision(BaseTypesConverter.convertInterval(item14.getPrecision())); | ||
item.setUnits(item14.getUnits()); | ||
items.put(i.toString(), item); | ||
i++; | ||
} | ||
} | ||
quantity.setList(items); | ||
|
||
quantity.setProperty(convert(quantity14.getProperty())); | ||
|
||
DVQUANTITY assumedValue14 = quantity14.getAssumedValue(); | ||
if(assumedValue14 != null) { | ||
CDVQuantityAssumedValue assumedValue = new CDVQuantityAssumedValue(); | ||
assumedValue.setMagnitude(assumedValue14.getMagnitude()); | ||
assumedValue.setPrecision(assumedValue14.getPrecision() == null ? null : assumedValue14.getPrecision().longValue()); | ||
assumedValue.setUnits(assumedValue14.getUnits()); | ||
quantity.setAssumedValue(assumedValue); | ||
} | ||
return Adl14CComplexObjectParser.convertCDvQuantity(quantity); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters