Fix broken LOINC link

This commit is contained in:
Grahame Grieve 2022-11-19 03:39:35 -03:00
parent 14a8c388fd
commit 8e3833f58a
10 changed files with 32 additions and 16 deletions

View File

@ -150,6 +150,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
import org.hl7.fhir.utilities.Utilities;
@ -2421,7 +2422,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (cc.getSystem().equals("http://snomed.info/sct"))
return "http://snomed.info/sct/"+cc.getCode();
if (cc.getSystem().equals("http://loinc.org"))
return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
return LoincLinker.getLinkForCode(cc.getCode());
return null;
}

View File

@ -154,6 +154,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
import org.hl7.fhir.utilities.Utilities;
@ -2482,7 +2483,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (cc.getSystem().equals("http://snomed.info/sct"))
return "http://snomed.info/sct/"+cc.getCode();
if (cc.getSystem().equals("http://loinc.org"))
return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
return LoincLinker.getLinkForCode(cc.getCode());
return null;
}

View File

@ -184,6 +184,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.exceptions.TerminologyServiceException;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
import org.hl7.fhir.utilities.Utilities;
@ -3093,7 +3094,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
else if ("http://snomed.info/sct".equals(system)) {
td.ah("http://browser.ihtsdotools.org/?perspective=full&conceptId1="+code).addText(code);
} else if ("http://loinc.org".equals(system)) {
td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
td.ah(LoincLinker.getLinkForCode(code)).addText(code);
} else
td.addText(code);
} else {
@ -3220,7 +3221,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (cc.getSystem().equals("http://snomed.info/sct"))
return "http://snomed.info/sct/"+cc.getCode();
if (cc.getSystem().equals("http://loinc.org"))
return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
return LoincLinker.getLinkForCode(cc.getCode());
return null;
}

View File

@ -74,6 +74,7 @@ import org.hl7.fhir.r4.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext;
import org.hl7.fhir.r4.utils.LiquidEngine.LiquidDocument;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
import org.hl7.fhir.utilities.TerminologyServiceOptions;
@ -3263,7 +3264,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
else if ("http://snomed.info/sct".equals(system)) {
td.ah(sctLink(code)).addText(code);
} else if ("http://loinc.org".equals(system)) {
td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
td.ah(LoincLinker.getLinkForCode(code)).addText(code);
} else
td.addText(code);
} else {
@ -3500,7 +3501,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (cc.getSystem().equals("http://snomed.info/sct"))
return "http://snomed.info/sct/"+cc.getCode();
if (cc.getSystem().equals("http://loinc.org"))
return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
return LoincLinker.getLinkForCode(cc.getCode());
return null;
}

View File

@ -25,6 +25,7 @@ import org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r4b.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r4b.terminologies.CodeSystemUtilities.CodeSystemNavigator;
import org.hl7.fhir.r4b.utils.ToolingExtensions;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -534,7 +535,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
if (cc.getSystem().equals("http://snomed.info/sct"))
return "http://snomed.info/sct/"+cc.getCode();
if (cc.getSystem().equals("http://loinc.org"))
return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
return LoincLinker.getLinkForCode(cc.getCode())+".html";
return null;
}

View File

@ -47,6 +47,7 @@ import org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r4b.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r4b.utils.ToolingExtensions;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -717,7 +718,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
else if ("http://snomed.info/sct".equals(system)) {
td.ah(sctLink(code)).addText(code);
} else if ("http://loinc.org".equals(system)) {
td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
td.ah(LoincLinker.getLinkForCode(code)).addText(code);
} else
td.addText(code);
} else {

View File

@ -25,6 +25,7 @@ import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities.CodeSystemNavigator;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -547,7 +548,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
if (cc.getSystem().equals("http://snomed.info/sct"))
return "http://snomed.info/sct/"+cc.getCode();
if (cc.getSystem().equals("http://loinc.org"))
return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
return LoincLinker.getLinkForCode(cc.getCode());
return null;
}

View File

@ -1129,25 +1129,25 @@ public class DataRenderer extends Renderer {
if (ii.hasType()) {
if (ii.getType().hasText())
s = ii.getType().getText()+": "+s;
s = ii.getType().getText()+": "+s;
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasDisplay())
s = ii.getType().getCoding().get(0).getDisplay()+": "+s;
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasCode())
s = lookupCode(ii.getType().getCoding().get(0).getSystem(), ii.getType().getCoding().get(0).getVersion(), ii.getType().getCoding().get(0).getCode())+": "+s;
} else {
s = "id: "+s;
s = "id: "+s;
}
if (ii.hasUse() || ii.hasPeriod()) {
s = s + "(";
s = s + " (";
if (ii.hasUse()) {
s = s + "use: "+ii.getUse().toString();
s = s + "use: "+ii.getUse().toString();
}
if (ii.hasUse() && ii.hasPeriod()) {
s = s + ", ";
s = s + ", ";
}
if (ii.hasPeriod()) {
s = s + "period: "+displayPeriod(ii.getPeriod());
s = s + "period: "+displayPeriod(ii.getPeriod());
}
s = s + ")";
}

View File

@ -45,6 +45,7 @@ import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.LoincLinker;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row;
@ -835,7 +836,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
else if ("http://snomed.info/sct".equals(system)) {
td.ah(sctLink(code)).addText(code);
} else if ("http://loinc.org".equals(system)) {
td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
td.ah(LoincLinker.getLinkForCode(code)).addText(code);
} else
td.addText(code);
} else {

View File

@ -0,0 +1,8 @@
package org.hl7.fhir.utilities;
public class LoincLinker {
public static String getLinkForCode(String code) {
return "https://loinc.org/"+code+"/";
}
}