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
048  public static String refToVS(String url) {
049    if (url == null)
050      return null;
051    if (url.equals("http://www.genenames.org"))
052      return "http://hl7.org/fhir/ValueSet/genenames";
053    else if (url.equals("http://varnomen.hgvs.org/"))
054      return "http://hl7.org/fhir/ValueSet/variants";
055    else if (url.equals("http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore"))
056      return "http://hl7.org/fhir/ValueSet/ref-sequences";
057    else if (url.equals("http://www.ensembl.org/"))
058      return "http://hl7.org/fhir/ValueSet/ensembl";
059    else if (url.equals("http://www.ncbi.nlm.nih.gov/clinvar/variation"))
060      return "http://hl7.org/fhir/ValueSet/clinvar";
061    else if (url.equals("http://cancer.sanger.ac.uk/cancergenome/projects/cosmic/"))
062      return "http://hl7.org/fhir/ValueSet/cosmic";
063    else if (url.equals("http://www.ncbi.nlm.nih.gov/projects/SNP/"))
064      return "http://hl7.org/fhir/ValueSet/bbsnp";
065    else if (url.equals("http://www.sequenceontology.org/"))
066      return "http://hl7.org/fhir/ValueSet/sequenceontology";
067    else if (url.equals("http://www.ebi.ac.uk/"))
068      return "http://hl7.org/fhir/ValueSet/allelename";
069    else if (url.equals("https://www.iso.org/iso-4217-currency-codes.html"))
070      return "http://hl7.org/fhir/ValueSet/currencies";
071    else if (url.equals("http://www.rfc-editor.org/bcp/bcp13.txt"))
072      return "http://hl7.org/fhir/ValueSet/mimetypes";
073    else
074      return url;
075  }
076
077  public static String vsToRef(String url) {
078    if (url == null)
079      return null;
080    if (url.equals("http://hl7.org/fhir/ValueSet/genenames"))
081      return "http://www.genenames.org";
082    else if (url.equals("http://hl7.org/fhir/ValueSet/variants"))
083      return "http://varnomen.hgvs.org/";
084    else if (url.equals("http://hl7.org/fhir/ValueSet/ref-sequences"))
085      return "http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore";
086    else if (url.equals("http://hl7.org/fhir/ValueSet/ensembl"))
087      return "http://www.ensembl.org/";
088    else if (url.equals("http://hl7.org/fhir/ValueSet/clinvar"))
089      return "http://www.ncbi.nlm.nih.gov/clinvar/variation";
090    else if (url.equals("http://hl7.org/fhir/ValueSet/cosmic"))
091      return "http://cancer.sanger.ac.uk/cancergenome/projects/cosmic/";
092    else if (url.equals("http://hl7.org/fhir/ValueSet/bbsnp"))
093      return "http://www.ncbi.nlm.nih.gov/projects/SNP/";
094    else if (url.equals("http://hl7.org/fhir/ValueSet/sequenceontology"))
095      return "http://www.sequenceontology.org/";
096    else if (url.equals("http://hl7.org/fhir/ValueSet/allelename"))
097      return "http://www.ebi.ac.uk/";
098    else if (url.equals("http://hl7.org/fhir/ValueSet/currencies"))
099      return "https://www.iso.org/iso-4217-currency-codes.html";
100    else if (url.equals("http://hl7.org/fhir/ValueSet/mimetypes"))
101      return "http://www.rfc-editor.org/bcp/bcp13.txt";
102    else
103      return null;
104  }
105}