Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ids for flexporter executeScript #1501

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/org/mitre/synthea/export/flexporter/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,18 @@ public static Bundle executeScript(List<Map<String, String>> 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() != 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)
// 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;
}
Expand Down
Loading