From fd769472fea57b2c0b94e2dfd6d6c07ee7d0bc83 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 16 Oct 2023 23:08:28 +1100 Subject: [PATCH] fix bugs in processing current packages for xig --- .../fhir/convertors/analytics/PackageVisitor.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java index 3b29a673f..2adb4ec2a 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/analytics/PackageVisitor.java @@ -155,7 +155,7 @@ public class PackageVisitor { System.out.println("Go: "+cpidMap.size()+" current packages"); int i = 0; for (String s : cpidMap.keySet()) { - processCurrentPackage(s, cpidMap.get(s), cpidSet, i, cpidMap.size()); + processCurrentPackage(cpidMap.get(s), s, cpidSet, i, cpidMap.size()); i++; } @@ -266,12 +266,20 @@ public class PackageVisitor { } private Map getAllCIPackages() throws IOException { + System.out.println("Fetch https://build.fhir.org/ig/qas.json"); Map res = new HashMap<>(); if (current) { JsonArray json = (JsonArray) JsonParser.parseFromUrl("https://build.fhir.org/ig/qas.json"); for (JsonObject o : json.asJsonObjects()) { String url = o.asString("repo"); - res.put(url, o.asString("package-id")); + String pid = o.asString("package-id"); + if (url.contains("/branches/master") || url.contains("/branches/main") ) { + if (!res.containsKey(pid)) { + res.put(pid, url); + } else if (!url.equals(res.get(pid))) { + System.out.println("Ignore "+url+" already encountered "+pid +" @ "+res.get(pid)); + } + } } } return res;