001package org.hl7.fhir.r5.utils; 002 003import org.hl7.fhir.r5.context.IWorkerContext; 004import org.hl7.fhir.r5.model.ServiceRequest; 005import org.hl7.fhir.r5.model.StringType; 006import org.hl7.fhir.utilities.Utilities; 007import org.hl7.fhir.utilities.VersionUtilities; 008 009 010public class PublicationHacker { 011 012 // this routine fixes up broken binding descriptions from past FHIR publications. All of them will be or are fixed in a later version, 013 // but fixing old versions is procedurally very difficult. Hence, these work around fixes here 014 015 public static StringType fixBindingDescriptions(IWorkerContext context, StringType s) { 016 StringType res = s.copy(); 017 018 // ServiceRequest.code 019 if (res.getValue().contains("LOINC is (preferred)[http://build.fhir.org/terminologies.html#preferred]")) { 020 res.setValue(res.getValue().replace("LOINC is (preferred)[http://build.fhir.org/terminologies.html#preferred]", "LOINC is [preferred]("+Utilities.pathURL(VersionUtilities.getSpecUrl(context.getVersion()), "terminologies.html#preferred)"))); 021 } 022 if (res.getValue().contains("[here](valueset-diagnostic-requests.html)")) { 023 res.setValue(res.getValue().replace("[here](valueset-diagnostic-requests.html)", "here")); 024 } 025 return res; 026 } 027 028}