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