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