From c44de558c1b7534e24a84c328d39d0d84aed2b47 Mon Sep 17 00:00:00 2001 From: LaurenD Date: Tue, 3 Sep 2024 11:24:23 -0400 Subject: [PATCH 1/2] Fix ids for flexporter executeScript --- .../org/mitre/synthea/export/flexporter/Actions.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/mitre/synthea/export/flexporter/Actions.java b/src/main/java/org/mitre/synthea/export/flexporter/Actions.java index 406867560..4a62689d1 100644 --- a/src/main/java/org/mitre/synthea/export/flexporter/Actions.java +++ b/src/main/java/org/mitre/synthea/export/flexporter/Actions.java @@ -758,6 +758,18 @@ public static Bundle executeScript(List> scripts, Bundle bun String outBundleJson = fjContext.getBundle(); Bundle newBundle = parser.parseResource(Bundle.class, outBundleJson); + for (BundleEntryComponent bec : newBundle.getEntry()) { + Resource r = bec.getResource(); + if (r.getId().startsWith("urn:uuid:")) { + // HAPI does some weird stuff with IDs + // by default in Synthea they are just plain UUIDs + // and the entry.fullUrl is urn:uuid:(id) + // but somehow when they get parsed back in, the id is urn:uuid:etc + // which then doesn't get written back out at the end + // so this removes the "urn:uuid:" bit if it got added + r.setId(r.getId().substring(9)); + } + } return newBundle; } From 2ab32005786597a70a115ebdf58ea31817415ad6 Mon Sep 17 00:00:00 2001 From: LaurenD Date: Tue, 3 Sep 2024 12:45:10 -0400 Subject: [PATCH 2/2] Add null check to pass test --- src/main/java/org/mitre/synthea/export/flexporter/Actions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/mitre/synthea/export/flexporter/Actions.java b/src/main/java/org/mitre/synthea/export/flexporter/Actions.java index 4a62689d1..7cdba247c 100644 --- a/src/main/java/org/mitre/synthea/export/flexporter/Actions.java +++ b/src/main/java/org/mitre/synthea/export/flexporter/Actions.java @@ -760,7 +760,7 @@ public static Bundle executeScript(List> scripts, Bundle bun Bundle newBundle = parser.parseResource(Bundle.class, outBundleJson); for (BundleEntryComponent bec : newBundle.getEntry()) { Resource r = bec.getResource(); - if (r.getId().startsWith("urn:uuid:")) { + if (r.getId() != null && r.getId().startsWith("urn:uuid:")) { // HAPI does some weird stuff with IDs // by default in Synthea they are just plain UUIDs // and the entry.fullUrl is urn:uuid:(id)