update PHINVads importer for URL and version issues
This commit is contained in:
parent
fe7efcf5a2
commit
86b9db4aec
|
@ -52,7 +52,9 @@ public class PhinVadsImporter {
|
||||||
try {
|
try {
|
||||||
System.out.println("Process "+f.getName());
|
System.out.println("Process "+f.getName());
|
||||||
ValueSet vs = importValueSet(TextFile.fileToBytes(f));
|
ValueSet vs = importValueSet(TextFile.fileToBytes(f));
|
||||||
new JsonParser().compose(new FileOutputStream(Utilities.path(dest, "ValueSet-"+vs.getId()+".json")), vs);
|
if (vs.getId() != null) {
|
||||||
|
new JsonParser().compose(new FileOutputStream(Utilities.path(dest, "ValueSet-"+vs.getId()+".json")), vs);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -74,7 +76,7 @@ public class PhinVadsImporter {
|
||||||
|
|
||||||
ValueSet vs = new ValueSet();
|
ValueSet vs = new ValueSet();
|
||||||
vs.setId(rdr.cell("Value Set OID"));
|
vs.setId(rdr.cell("Value Set OID"));
|
||||||
vs.setUrl("https://phinvads.cdc.gov/fhir/ValueSet/"+vs.getId());
|
vs.setUrl("http://phinvads.cdc.gov/fhir/ValueSet/"+vs.getId());
|
||||||
vs.getMeta().setSource("https://phinvads.cdc.gov/vads/ViewValueSet.action?oid="+vs.getId());
|
vs.getMeta().setSource("https://phinvads.cdc.gov/vads/ViewValueSet.action?oid="+vs.getId());
|
||||||
vs.setVersion(rdr.cell("Value Set Version"));
|
vs.setVersion(rdr.cell("Value Set Version"));
|
||||||
vs.setTitle(rdr.cell("Value Set Name"));
|
vs.setTitle(rdr.cell("Value Set Name"));
|
||||||
|
@ -100,12 +102,31 @@ public class PhinVadsImporter {
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
url = "urn:oid:"+csoid;
|
url = "urn:oid:"+csoid;
|
||||||
}
|
}
|
||||||
|
csver = fixVersionforSystem(url, csver);
|
||||||
ConceptSetComponent inc = getInclude(vs, url, csver);
|
ConceptSetComponent inc = getInclude(vs, url, csver);
|
||||||
inc.addConcept().setCode(code).setDisplay(display);
|
inc.addConcept().setCode(code).setDisplay(display);
|
||||||
}
|
}
|
||||||
return vs;
|
return vs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String fixVersionforSystem(String url, String csver) {
|
||||||
|
if ("http://snomed.info/sct".equals(url)) {
|
||||||
|
return "http://snomed.info/sct|http://snomed.info/sct/731000124108/"+csver;
|
||||||
|
}
|
||||||
|
if ("http://loinc.org".equals(url)) {
|
||||||
|
return csver;
|
||||||
|
}
|
||||||
|
if ("http://www.nlm.nih.gov/research/umls/rxnorm".equals(url)) {
|
||||||
|
if (csver.length() == 8) {
|
||||||
|
return csver.substring(4,6)+csver.substring(6,8)+csver.substring(0,4);
|
||||||
|
} else {
|
||||||
|
return csver;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return csver;
|
||||||
|
}
|
||||||
|
|
||||||
private ConceptSetComponent getInclude(ValueSet vs, String url, String csver) {
|
private ConceptSetComponent getInclude(ValueSet vs, String url, String csver) {
|
||||||
for (ConceptSetComponent t : vs.getCompose().getInclude()) {
|
for (ConceptSetComponent t : vs.getCompose().getInclude()) {
|
||||||
if (csver == null) {
|
if (csver == null) {
|
||||||
|
|
Loading…
Reference in New Issue