001package org.hl7.fhir.convertors;
002
003import org.hl7.fhir.r5.renderers.QuestionnaireRenderer;
004import org.hl7.fhir.r5.utils.ToolingExtensions;
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012    
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033 */
034
035
036public class VersionConvertorConstants {
037
038  public final static String IG_DEPENDSON_PACKAGE_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ImplementationGuide.dependsOn.packageId";
039  public final static String IG_DEPENDSON_VERSION_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ImplementationGuide.dependsOn.version";
040  public final static String MODIFIER_REASON_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.isModifierReason";
041  public final static String MODIFIER_TAKEN = "http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationStatment.taken";
042  public final static String MODIFIER_REASON_LEGACY = "No Modifier Reason provideed in previous versions of FHIR";
043  public final static String PROFILE_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.type.profile";
044  public final static String IG_CONFORMANCE_MESSAGE_EVENT = "http://hl7.org/fhir/1.0/StructureDefinition/extension-Conformance.messaging.event";
045  public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
046  public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name";
047  public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = ToolingExtensions.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL;
048  public static final String EXT_NAMINGSYSTEM_TITLE = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title";
049  public static final String EXT_NAMINGSYSTEM_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.url";
050  public static final String EXT_NAMINGSYSTEM_VERSION = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.version";
051  public static final String EXT_OPDEF_ORIGINAL_TYPE = "http://hl7.org/fhir/4.0/StructureDefinition/extension-OperationDefinition.parameter.type";
052
053  public static String refToVS(String url) {
054    if (url == null)
055      return null;
056    if (url.equals("http://www.genenames.org"))
057      return "http://hl7.org/fhir/ValueSet/genenames";
058    else if (url.equals("http://varnomen.hgvs.org/"))
059      return "http://hl7.org/fhir/ValueSet/variants";
060    else if (url.equals("http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore"))
061      return "http://hl7.org/fhir/ValueSet/ref-sequences";
062    else if (url.equals("http://www.ensembl.org/"))
063      return "http://hl7.org/fhir/ValueSet/ensembl";
064    else if (url.equals("http://www.ncbi.nlm.nih.gov/clinvar/variation"))
065      return "http://hl7.org/fhir/ValueSet/clinvar";
066    else if (url.equals("http://cancer.sanger.ac.uk/cancergenome/projects/cosmic/"))
067      return "http://hl7.org/fhir/ValueSet/cosmic";
068    else if (url.equals("http://www.ncbi.nlm.nih.gov/projects/SNP/"))
069      return "http://hl7.org/fhir/ValueSet/bbsnp";
070    else if (url.equals("http://www.sequenceontology.org/"))
071      return "http://hl7.org/fhir/ValueSet/sequenceontology";
072    else if (url.equals("http://www.ebi.ac.uk/"))
073      return "http://hl7.org/fhir/ValueSet/allelename";
074    else if (url.equals("https://www.iso.org/iso-4217-currency-codes.html"))
075      return "http://hl7.org/fhir/ValueSet/currencies";
076    else if (url.equals("http://www.rfc-editor.org/bcp/bcp13.txt"))
077      return "http://hl7.org/fhir/ValueSet/mimetypes";
078    else
079      return url;
080  }
081
082  public static String vsToRef(String url) {
083    if (url == null)
084      return null;
085    if (url.equals("http://hl7.org/fhir/ValueSet/genenames"))
086      return "http://www.genenames.org";
087    else if (url.equals("http://hl7.org/fhir/ValueSet/variants"))
088      return "http://varnomen.hgvs.org/";
089    else if (url.equals("http://hl7.org/fhir/ValueSet/ref-sequences"))
090      return "http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore";
091    else if (url.equals("http://hl7.org/fhir/ValueSet/ensembl"))
092      return "http://www.ensembl.org/";
093    else if (url.equals("http://hl7.org/fhir/ValueSet/clinvar"))
094      return "http://www.ncbi.nlm.nih.gov/clinvar/variation";
095    else if (url.equals("http://hl7.org/fhir/ValueSet/cosmic"))
096      return "http://cancer.sanger.ac.uk/cancergenome/projects/cosmic/";
097    else if (url.equals("http://hl7.org/fhir/ValueSet/bbsnp"))
098      return "http://www.ncbi.nlm.nih.gov/projects/SNP/";
099    else if (url.equals("http://hl7.org/fhir/ValueSet/sequenceontology"))
100      return "http://www.sequenceontology.org/";
101    else if (url.equals("http://hl7.org/fhir/ValueSet/allelename"))
102      return "http://www.ebi.ac.uk/";
103    else if (url.equals("http://hl7.org/fhir/ValueSet/currencies"))
104      return "https://www.iso.org/iso-4217-currency-codes.html";
105    else if (url.equals("http://hl7.org/fhir/ValueSet/mimetypes"))
106      return "http://www.rfc-editor.org/bcp/bcp13.txt";
107    else
108      return null;
109  }
110}