From dd3981c09040604fc628a8e9d0c389b3db9ed80f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 20 Apr 2024 23:33:48 +1000 Subject: [PATCH] fix up vsac importer for changes to client --- .../org/hl7/fhir/convertors/misc/VSACImporter.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/VSACImporter.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/VSACImporter.java index 6dce32f88..b3791818e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/VSACImporter.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/VSACImporter.java @@ -92,6 +92,7 @@ public class VSACImporter extends OIDBasedValueSetImporter { t = System.currentTimeMillis(); } } catch (Exception e) { + e.printStackTrace(); System.out.println("Unable to fetch OID " + oid + ": " + e.getMessage()); errs.put(oid, e.getMessage()); } @@ -126,7 +127,7 @@ public class VSACImporter extends OIDBasedValueSetImporter { try { Parameters p = new Parameters(); p.addParameter("url", new UriType(vs.getUrl())); - ValueSet vse = fhirToolingClient.expandValueset(vs, p); + ValueSet vse = fhirToolingClient.expandValueset(null, p); vs.setExpansion(vse.getExpansion()); } catch (Exception e) { errs.put(oid, "Expansion: " +e.getMessage()); @@ -139,7 +140,7 @@ public class VSACImporter extends OIDBasedValueSetImporter { p.addParameter("url", new UriType(vs.getUrl())); t = System.currentTimeMillis(); try { - ValueSet vse = fhirToolingClient.expandValueset(vs, p); + ValueSet vse = fhirToolingClient.expandValueset(null, p); vs.getExpansion().getContains().addAll(vse.getExpansion().getContains()); vs.getExpansion().setParameter(vse.getExpansion().getParameter()); } catch (Exception e2) { @@ -163,6 +164,9 @@ public class VSACImporter extends OIDBasedValueSetImporter { } else { vs.setTitle(vs.getName()); } + if (vs.getUrl().startsWith("https://")) { + System.out.println("URL is https: "+vs.getUrl()); + } vs.setName(makeValidName(vs.getName())); JurisdictionUtilities.setJurisdictionCountry(vs.getJurisdiction(), "US"); new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(ManagedFileAccess.outStream(Utilities.path(dest, "ValueSet-" + oid + ".json")), vs); @@ -171,8 +175,8 @@ public class VSACImporter extends OIDBasedValueSetImporter { } private boolean isIncomplete(ValueSetExpansionComponent expansion) { - IntegerType c = expansion.getParameter("count").getValueIntegerType(); - IntegerType offset = expansion.getParameter("offset").getValueIntegerType(); + IntegerType c = expansion.getParameter("count") != null ? expansion.getParameter("count").getValueIntegerType() : new IntegerType(0); + IntegerType offset = expansion.getParameter("offset") != null ? expansion.getParameter("offset").getValueIntegerType() : new IntegerType(0); return c.getValue() + offset.getValue() < expansion.getTotal(); }