Skip to content

Commit 37f14b2

Browse files
Merge pull request #1067 from HL7/2025-03-gg-withdrawal
2025 03 gg withdrawal
2 parents 548f41c + 69a8135 commit 37f14b2

11 files changed

Lines changed: 524 additions & 90 deletions

File tree

org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/Publisher.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@
313313
import org.hl7.fhir.r5.renderers.utils.ResourceWrapper;
314314
import org.hl7.fhir.r5.terminologies.TerminologyUtilities;
315315
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
316+
import org.hl7.fhir.r5.terminologies.client.TerminologyClientContext;
316317
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
317318
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
318319
import org.hl7.fhir.r5.testfactory.TestDataFactory;
@@ -8850,8 +8851,9 @@ private void addTestDir(File dir, String t) throws FileNotFoundException, IOExce
88508851
for (File f : dir.listFiles()) {
88518852
if (f.isDirectory()) {
88528853
addTestDir(f, t);
8853-
} else {
8854-
addFileToNpm("tests/"+FileUtilities.getRelativePath(t, dir.getAbsolutePath()), f.getName(), FileUtilities.fileToBytes(f));
8854+
} else if (!f.getName().equals(".DS_Store")) {
8855+
String s = FileUtilities.getRelativePath(t, dir.getAbsolutePath());
8856+
addFileToNpm(Utilities.noString(s) ? "tests" : Utilities.path("tests", s), f.getName(), FileUtilities.fileToBytes(f));
88558857
}
88568858
}
88578859
}
@@ -13907,7 +13909,6 @@ private void generateOutputsValueSet(FetchedFile f, FetchedResource r, ValueSet
1390713909
db.recordExpansion(vs, exp);
1390813910
if (exp.getValueset() != null) {
1390913911
expansions.add(exp.getValueset());
13910-
1391113912
RenderingContext elrc = lrc.withUniqueLocalPrefix("x").withMode(ResourceRendererMode.END_USER);
1391213913
exp.getValueset().setCompose(null);
1391313914
exp.getValueset().setText(null);
@@ -15212,11 +15213,18 @@ public static void main(String[] args) throws Exception {
1521215213
if (CliParams.hasNamedParam(args, PACKAGE_CACHE_FOLDER_PARAM)) {
1521315214
self.setPackageCacheFolder(CliParams.getNamedParam(args, PACKAGE_CACHE_FOLDER_PARAM));
1521415215
}
15216+
if (CliParams.hasNamedParam(args, "-authorise-non-conformant-tx-servers")) {
15217+
TerminologyClientContext.setAllowNonConformantServers(true);
15218+
}
15219+
TerminologyClientContext.setCanAllowNonConformantServers(true);
1521515220
try {
1521615221
self.execute();
1521715222
if (CliParams.hasNamedParam(args, "-no-errors")) {
1521815223
exitCode = self.countErrs(self.errors) > 0 ? 1 : 0;
1521915224
}
15225+
} catch (ENoDump e) {
15226+
self.log("Publishing Content Failed: "+e.getMessage());
15227+
self.log("");
1522015228
} catch (Exception e) {
1522115229
exitCode = 1;
1522215230
self.log("Publishing Content Failed: "+e.getMessage());

org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/ValidationServices.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,11 @@ public Map<String, String> fetchCanonicalResourceVersionMap(IResourceValidator v
487487
if (!context.isServerSideSystem(cs.getUrl())) {
488488
// ?? res.add(cr.hasVersion() ? cr.getVersion() : "{{unversioned}}");
489489
}
490-
} else {
491-
res.put(cr.hasVersion() ? cr.getVersion() : "{{unversioned}}", cr.getSourcePackage().getVID());
490+
} else {
491+
res.put(cr.hasVersion() ? cr.getVersion() : "{{unversioned}}", cr.hasSourcePackage() ? cr.getSourcePackage().getVID() : null);
492492
}
493493
} else {
494-
res.put(cr.hasVersion() ? cr.getVersion() : "{{unversioned}}", cr.getSourcePackage().getVID());
494+
res.put(cr.hasVersion() ? cr.getVersion() : "{{unversioned}}", cr.hasSourcePackage() ? cr.getSourcePackage().getVID() : null);
495495
}
496496
}
497497
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package org.hl7.fhir.igtools.publisher.utils;
2+
3+
import java.io.File;
4+
import java.io.FileNotFoundException;
5+
import java.io.IOException;
6+
import java.util.ArrayList;
7+
import java.util.HashMap;
8+
import java.util.List;
9+
import java.util.Map;
10+
import java.util.Set;
11+
12+
import org.hl7.fhir.utilities.FileUtilities;
13+
import org.hl7.fhir.utilities.Utilities;
14+
import org.hl7.fhir.utilities.json.model.JsonElement;
15+
import org.hl7.fhir.utilities.json.model.JsonObject;
16+
import org.hl7.fhir.utilities.json.parser.JsonParser;
17+
18+
19+
public class HL7OrgFhirCompareFixer {
20+
21+
private static final int MAX_COMMIT = 200000;
22+
23+
public static void main(String[] args) throws IOException {
24+
File folderRoot = new File("/Users/grahamegrieve/web/www.hl7.org.fhir");
25+
new HL7OrgFhirCompareFixer().execute(folderRoot, folderRoot, true);
26+
}
27+
28+
private int counter;
29+
30+
private void execute(File rootFolder, File folder, boolean root) throws IOException {
31+
for (File f : folder.listFiles()) {
32+
if (f.isDirectory()) {
33+
if (root) {
34+
System.out.println("Process "+f.getAbsolutePath());
35+
}
36+
if (!root || !Utilities.existsInList(f.getName(), "us", "uv")) {
37+
execute(rootFolder, f, false);
38+
}
39+
} else if (f.getName().endsWith(".html")) {
40+
processCompare(rootFolder, f);
41+
}
42+
}
43+
}
44+
45+
private void processCompare(File rootFolder, File f) throws FileNotFoundException, IOException {
46+
String s = FileUtilities.fileToString(f);
47+
if (s.contains("http://services.w3.org/htmldiff?")) {
48+
s = s.replace("http://services.w3.org/htmldiff?doc1=", "https://www5.aptest.com/standards/htmldiff/htmldiff.pl?oldfile=");
49+
s = s.replace("&amp;doc2=", "&amp;newfile=");
50+
FileUtilities.stringToFile(s, f);
51+
counter++;
52+
if (counter >= MAX_COMMIT) {
53+
throw new Error("terminating - max count reached");
54+
}
55+
}
56+
}
57+
}
58+

org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/web/IGRegistryMaintainer.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.hl7.fhir.utilities.json.model.JsonObject;
3434
import org.hl7.fhir.utilities.json.model.JsonString;
3535
import org.hl7.fhir.utilities.json.parser.JsonParser;
36+
import org.hl7.fhir.utilities.npm.PackageList.PackageListEntry;
3637

3738
public class IGRegistryMaintainer {
3839

@@ -72,6 +73,8 @@ public class ImplementationGuideEntry {
7273
private String canonical;
7374
private String title;
7475
private String cibuild;
76+
private boolean withdrawn;
77+
private String withDrawalDate;
7578
private List<PublicationEntry> releases = new ArrayList<>();
7679
private List<PublicationEntry> candidates = new ArrayList<>();
7780
private List<String> products = new ArrayList<>();
@@ -174,6 +177,11 @@ public void seeCiBuild(ImplementationGuideEntry ig, String path, String source)
174177
ig.cibuild = removeTrailingSlash(path);
175178
}
176179

180+
public void withdraw(ImplementationGuideEntry ig, String name, String version, String fhirVersion, String path) {
181+
ig.releases.clear();
182+
ig.withdrawn = true;
183+
}
184+
177185
public void seeRelease(ImplementationGuideEntry ig, String name, String version, String fhirVersion, String path) {
178186
PublicationEntry p = new PublicationEntry(name, version, fhirVersion, path);
179187
ig.releases.add(p);
@@ -203,6 +211,16 @@ public void finish() throws FileNotFoundException, IOException {
203211
for (String s : ig.products) {
204212
ig.entry.forceArray("product").add(s);
205213
}
214+
if (ig.withdrawn) {
215+
ig.entry.set("withdrawn", true);
216+
} else if (ig.entry.has("withdrawn")) {
217+
ig.entry.remove("withdrawn");
218+
}
219+
if (ig.withDrawalDate != null) {
220+
ig.entry.set("withDrawalDate", ig.withDrawalDate);
221+
} else if (ig.entry.has("withDrawalDate")) {
222+
ig.entry.remove("withDrawalDate");
223+
}
206224

207225
JsonArray a = new JsonArray();
208226
ig.entry.add("editions", a);
@@ -287,4 +305,9 @@ public String getPath() {
287305
return path;
288306
}
289307

308+
public void withdraw(ImplementationGuideEntry rc, PackageListEntry plVer) {
309+
rc.withdrawn = true;
310+
rc.withDrawalDate = plVer.date();
311+
}
312+
290313
}

org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/web/IndexMaintainer.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class IGIndexInformation {
4141
private String refLatest;
4242
private String fvLatest;
4343
private String verLatest;
44+
private boolean withdrawn;
4445

4546
public IGIndexInformation(String id) {
4647
this.id = id;
@@ -170,6 +171,8 @@ private String generateSummary() throws IOException {
170171
tr = tbl.tr();
171172
if (ig.dateMilestone == null) {
172173
tr.backgroundColor("#fffce0");
174+
} else if (ig.withdrawn) {
175+
tr.backgroundColor("#eeeeee");
173176
} else if (ig.dateMilestone.isBefore(ig.dateLatest)) {
174177
tr.backgroundColor("#ffebeb");
175178
}
@@ -178,13 +181,19 @@ private String generateSummary() throws IOException {
178181
td.b().tx(ig.name);
179182
td.br();
180183
td.markdown(ig.descMD, "Description for "+ig.name);
181-
td = tr.td();
182-
if (ig.refMilestone != null) {
183-
release(td, ig.dateMilestone, ig.verMilestone, ig.refMilestone, ig.fvMilestone);
184-
}
185-
td = tr.td();
186-
if (ig.dateMilestone == null || ig.dateMilestone.isBefore(ig.dateLatest)) {
187-
release(td, ig.dateLatest, ig.verLatest, ig.refLatest, ig.fvLatest);
184+
if (ig.withdrawn) {
185+
td = tr.td();
186+
td.colspan(2);
187+
td.b().tx("Withdrawn");
188+
} else {
189+
td = tr.td();
190+
if (ig.refMilestone != null) {
191+
release(td, ig.dateMilestone, ig.verMilestone, ig.refMilestone, ig.fvMilestone);
192+
}
193+
td = tr.td();
194+
if (ig.dateMilestone == null || ig.dateMilestone.isBefore(ig.dateLatest)) {
195+
release(td, ig.dateLatest, ig.verLatest, ig.refLatest, ig.fvLatest);
196+
}
188197
}
189198
}
190199
return new XhtmlComposer(false).compose(div);
@@ -216,7 +225,12 @@ private String generateByDate() throws IOException {
216225
tr = tbl.tr();
217226
tr.td().ah(ig.code()+"/history.html").tx(ig.code());
218227
tr.td().tx(ig.name);
219-
if (ig.dateMilestone == null || ig.dateMilestone.isBefore(ig.dateLatest)) {
228+
if (ig.withdrawn) {
229+
tr.backgroundColor("#eeeeee");
230+
tr.td().colspan(2).tx("Withdrawn");
231+
tr.td().tx(fmtDateFUll(ig.dateLatest));
232+
tr.td().tx(Utilities.describeDuration(Duration.between(ig.dateLatest, Instant.now())));
233+
} else if (ig.dateMilestone == null || ig.dateMilestone.isBefore(ig.dateLatest)) {
220234
tr.td().tx(ig.verLatest);
221235
tr.td().tx("Candidate");
222236
tr.td().tx(fmtDateFUll(ig.dateLatest));
@@ -293,11 +307,13 @@ public void updateForPublication(PackageList pl, PackageListEntry plVer, boolean
293307
ig.refLatest = plVer.path();
294308
ig.fvLatest = plVer.version();
295309
ig.verLatest = plVer.version();
310+
ig.withdrawn = plVer.status().equals("withdrawn");
296311
} else if (ig.dateLatest == null || ig.dateLatest.isBefore(plVer.instant())) {
297312
ig.dateLatest = plVer.instant();
298313
ig.refLatest = plVer.path();
299314
ig.fvLatest = plVer.fhirVersion();
300315
ig.verLatest = plVer.version();
316+
ig.withdrawn = plVer.status().equals("withdrawn");
301317
}
302318
}
303319

0 commit comments

Comments
 (0)