From 9ae060b5d9d27d347bee03e7846e9321842db557 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 14 Aug 2023 14:18:33 -0400 Subject: [PATCH 1/6] Bump ucum version --- org.hl7.fhir.convertors/pom.xml | 1 - org.hl7.fhir.dstu2/pom.xml | 1 - org.hl7.fhir.dstu2016may/pom.xml | 15 --------------- org.hl7.fhir.dstu3/pom.xml | 1 - org.hl7.fhir.r4/pom.xml | 1 - org.hl7.fhir.r4b/pom.xml | 1 - org.hl7.fhir.validation.cli/pom.xml | 1 - org.hl7.fhir.validation/pom.xml | 2 +- pom.xml | 5 +++++ 9 files changed, 6 insertions(+), 22 deletions(-) diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index 934701ca5..52e5904db 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -78,7 +78,6 @@ org.fhir ucum - 1.0.3 true diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index 982979400..5e154e7d2 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -32,7 +32,6 @@ org.fhir ucum - 1.0.3 true diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index 14b6af817..4b7771c22 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -32,22 +32,7 @@ org.fhir ucum - 1.0.3 true - - - xpp3 - xpp3 - - - xpp3 - xpp3_xpath - - - xpp3 - xpp3_min - - diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index d998ac341..fb4607ab2 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -32,7 +32,6 @@ org.fhir ucum - 1.0.3 true diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index 3a30dd259..7c4e8014f 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -39,7 +39,6 @@ org.fhir ucum - 1.0.3 true diff --git a/org.hl7.fhir.r4b/pom.xml b/org.hl7.fhir.r4b/pom.xml index 83af6a56c..a0d87e6d6 100644 --- a/org.hl7.fhir.r4b/pom.xml +++ b/org.hl7.fhir.r4b/pom.xml @@ -38,7 +38,6 @@ org.fhir ucum - 1.0.3 true diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index c63ba2d96..86a2a89eb 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -286,7 +286,6 @@ org.fhir ucum - 1.0.3 xpp3 diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index 4a7d6c825..51904be86 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -120,7 +120,7 @@ org.fhir ucum - 1.0.3 + true diff --git a/pom.xml b/pom.xml index 649202ea9..49cc4a8fd 100644 --- a/pom.xml +++ b/pom.xml @@ -164,6 +164,11 @@ Saxon-HE ${saxon_he_version} + + org.fhir + ucum + 1.0.7 + mysql From 62225652b6ac54159462c98f71e49e83e47154f9 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 21 Aug 2023 11:21:45 -0400 Subject: [PATCH 2/6] Bump ucum + version fix build --- org.hl7.fhir.convertors/pom.xml | 10 ++++++++++ pom.xml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index 52e5904db..1f928bdac 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -81,6 +81,16 @@ true + + xpp3 + xpp3 + true + + + xpp3 + xpp3_xpath + true + org.apache.httpcomponents diff --git a/pom.xml b/pom.xml index 49cc4a8fd..9551fe746 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ org.fhir ucum - 1.0.7 + 1.0.8-SNAPSHOT From 9303aa7673cd7a8c1cc0170e073b670018b41012 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 21 Aug 2023 13:22:17 -0400 Subject: [PATCH 3/6] Bump to release version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9551fe746..5c87ffa82 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ org.fhir ucum - 1.0.8-SNAPSHOT + 1.0.8 From 32d1d8cad817b954b425a33b4f8cd8655964368f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 22 Aug 2023 21:46:25 +1000 Subject: [PATCH 4/6] Hack utility for tx.fhir.org debugging --- .../hl7/fhir/r4/utils/ParametersBuilder.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/ParametersBuilder.java diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/ParametersBuilder.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/ParametersBuilder.java new file mode 100644 index 000000000..c209391ee --- /dev/null +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/ParametersBuilder.java @@ -0,0 +1,68 @@ +package org.hl7.fhir.r4.utils; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Arrays; +import java.util.Set; +import java.util.HashSet; + +import org.hl7.fhir.r4.formats.IParser.OutputStyle; +import org.hl7.fhir.r4.formats.JsonParser; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.MetadataResource; +import org.hl7.fhir.r4.model.Parameters; +import org.hl7.fhir.utilities.TextFile; + +/** + * Used to take an overload dump from tx.fhir.org and turn it into a parameters resource + * + * @author grahamegrieve + * + */ +public class ParametersBuilder { + + public static void main(String[] args) throws FileNotFoundException, IOException { + new ParametersBuilder(args[0], args[1]).process(args[2]); + } + + + + private String folder; + private String baseId; + + protected ParametersBuilder(String folder, String baseId) { + super(); + this.folder = folder; + this.baseId = baseId; + } + + private void process(String output) throws FileNotFoundException, IOException { + Parameters p = new Parameters(); + Set ids = new HashSet<>(); + for (File f : new File(folder).listFiles()) { + if (f.getName().startsWith(baseId)) { + if (f.getName().startsWith(baseId)) { + byte[] cnt = TextFile.fileToBytes(f); + cnt = shaveZeros(cnt); // bug in tx.fhir.org + MetadataResource r = (MetadataResource) new JsonParser().parse(cnt); + if (!ids.contains(r.getUrl()+"|"+r.getVersion())) { + ids.add(r.getUrl()+"|"+r.getVersion()); + p.addParameter().setName("tx-resource").setResource(r); + } + } + } + } + new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(output), p); + } + + private byte[] shaveZeros(byte[] cnt) { + for (int i = 0; i < cnt.length; i++) { + if (cnt[i] == 0) { + return Arrays.copyOf(cnt, i-1); + } + } + return cnt; + } +} From 54eb35fa1a8766d199b15b4e881c166a716475e7 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 22 Aug 2023 21:46:47 +1000 Subject: [PATCH 5/6] fix bug with client sending too much data to tx.fhir.org --- .../org/hl7/fhir/r5/context/BaseWorkerContext.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index 4e21702d9..74a596b0b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -1499,7 +1499,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte boolean cache = false; for (CanonicalType c : inc.getValueSet()) { ValueSet vs = fetchResource(ValueSet.class, c.getValue(), src); - if (vs != null) { + if (vs != null && !hasCanonicalResource(pin, "tx-resource", vs.getVUrl())) { pin.addParameter().setName("tx-resource").setResource(vs); if (tcc.isTxCaching() && tcc.getCacheId() == null || !tcc.getCached().contains(vs.getVUrl())) { tcc.getCached().add(vs.getVUrl()); @@ -1509,7 +1509,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte } } CodeSystem cs = fetchResource(CodeSystem.class, inc.getSystem(), src); - if (cs != null && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) { + if (cs != null && !hasCanonicalResource(pin, "tx-resource", cs.getVUrl()) && (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == CodeSystemContentMode.FRAGMENT)) { pin.addParameter().setName("tx-resource").setResource(cs); if (tcc.isTxCaching() && tcc.getCacheId() == null || !tcc.getCached().contains(cs.getVUrl())) { tcc.getCached().add(cs.getVUrl()); @@ -1520,6 +1520,16 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte return cache; } + private boolean hasCanonicalResource(Parameters pin, String name, String vUrl) { + for (ParametersParameterComponent p : pin.getParameter()) { + if (name.equals(p.getName()) && p.hasResource() && + p.getResource() instanceof CanonicalResource && vUrl.equals(((CanonicalResource) p.getResource()).getVUrl())) { + return true; + } + } + return false; + } + public ValidationResult processValidationResult(Parameters pOut, String vs) { boolean ok = false; String message = "No Message returned"; From b0a9bf27edf99b6015febb333f1622a3f2f9bfae Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 22 Aug 2023 21:47:25 +1000 Subject: [PATCH 6/6] clean up file path messages for better troubleshooting --- .../src/main/java/org/hl7/fhir/utilities/PathBuilder.java | 4 ++-- .../src/test/java/org/hl7/fhir/utilities/UtilitiesTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/PathBuilder.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/PathBuilder.java index 7f3d3cd80..b546b1a37 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/PathBuilder.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/PathBuilder.java @@ -150,7 +150,7 @@ public class PathBuilder { return; } if (isPathRoot(args[0])) { - throw new RuntimeException("First entry cannot be root: " + args[0]); + throw new RuntimeException("First entry in file path cannot be root: " + args[0]+", full path = "+String.join(", ", args)); } } @@ -159,7 +159,7 @@ public class PathBuilder { return; } if (args[0] == null || Utilities.noString(args[0].trim())) { - throw new RuntimeException("First path entry cannot be null or empty"); + throw new RuntimeException("First entry in file path cannot be null or empty, full path = "+String.join(", ", args)); } } diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/UtilitiesTest.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/UtilitiesTest.java index fd00f3449..c91f1508e 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/UtilitiesTest.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/UtilitiesTest.java @@ -293,7 +293,7 @@ class UtilitiesTest { RuntimeException thrown = Assertions.assertThrows(RuntimeException.class, () -> { Utilities.path(pathStrings); }); - assertTrue(thrown.getMessage().endsWith(pathStrings[0])); + assertTrue(thrown.getMessage().endsWith(pathStrings[0]+", full path = "+String.join(", ", pathStrings))); } public static Stream macAndLinuxNonFirstElementStartPaths() { @@ -384,7 +384,7 @@ class UtilitiesTest { RuntimeException thrown = Assertions.assertThrows(RuntimeException.class, () -> { Utilities.path(pathsStrings); }); - assertEquals("First path entry cannot be null or empty",thrown.getMessage()); + assertEquals("First entry in file path cannot be null or empty, full path = "+String.join(", ", pathsStrings),thrown.getMessage()); } @Test