private static CodeSystem GetCodeSystem(TerminologyOperation termOp, string systemURL, NameValueCollection queryParam)
        {
            CodeSystem codeSys = new CodeSystem();

            string codeVal     = Utilities.GetQueryValue("code", queryParam);
            string versionVal  = Utilities.GetQueryValue("version", queryParam);
            string languageVal = Utilities.GetQueryValue("displayLanguage", queryParam);

            // NB: these won't be passed in a GET request & the POST processing places the atomic elements in the queryParam collection
            //string codingVal = Utilities.GetQueryValue("coding", queryParam);
            //string codeableConceptVal = Utilities.GetQueryValue("codeableConcept", queryParam)

            if (string.IsNullOrEmpty(systemURL))
            {
                throw new Exception(MISSING_CODESYSTEM);
            }
            else if (string.IsNullOrEmpty(codeVal))
            {
                throw new Exception(MISSING_CODE_CODING);
            }
            else if (!string.IsNullOrEmpty(languageVal) && languageVal != "en-NZ")
            {
                throw new Exception(UNSUPPORTED_DISPLAY_LANGUAGE);
            }

            if (systemURL == NzRegion.URI)
            {
                NzRegion nzr = new NzRegion(termOp, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzr.codeSystem;
            }
            else if (systemURL == NzEthnicityL1.URI)
            {
                NzEthnicityL1 nzEth1 = new NzEthnicityL1(termOp, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth1.codeSystem;
            }
            else if (systemURL == NzEthnicityL2.URI)
            {
                NzEthnicityL2 nzEth2 = new NzEthnicityL2(termOp, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth2.codeSystem;
            }
            else if (systemURL == NzEthnicityL3.URI)
            {
                NzEthnicityL3 nzEth3 = new NzEthnicityL3(termOp, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth3.codeSystem;
            }
            else if (systemURL == NzEthnicityL4.URI)
            {
                NzEthnicityL4 nzEth4 = new NzEthnicityL4(termOp, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth4.codeSystem;
            }
            else if (systemURL == NzMt.URI)
            {
                NzMt nzmt = new NzMt(termOp, versionVal, codeVal, string.Empty, string.Empty, -1, -1);
                codeSys = nzmt.codeSystem;
            }
            else if (systemURL == FhirLoinc.URI)
            {
                FhirLoinc loinc = new FhirLoinc(termOp, versionVal, codeVal, string.Empty, string.Empty, -1, -1, string.Empty);
                codeSys = loinc.codeSystem;
            }
            else if (systemURL == FhirRxNorm.URI)
            {
                FhirRxNorm rxnorm = new FhirRxNorm(termOp, versionVal, codeVal, string.Empty, string.Empty, -1, -1);
                codeSys = rxnorm.codeSystem;
            }
            else if (FhirSnomed.IsValidURI(systemURL))
            {
                FhirSnomed snomed = new FhirSnomed(termOp, versionVal, codeVal, string.Empty, string.Empty, -1, -1, string.Empty, string.Empty);
                codeSys = snomed.codeSystem;
            }
            else
            {
                throw new Exception(UNSUPPORTED_CODESYSTEM);
            }

            return(codeSys);
        }
        private static Resource GetRequest(string identifier, string systemURL, NameValueCollection queryParam)
        {
            if (string.IsNullOrEmpty(identifier) && string.IsNullOrEmpty(systemURL))
            {
                throw new Exception(MISSING_CODESYSTEM);
            }

            string resourceFilePath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath) + @"\Test Files\";

            CodeSystem codeSys = new CodeSystem();

            string codeVal    = Utilities.GetQueryValue("code", queryParam);
            string versionVal = Utilities.GetQueryValue("version", queryParam);

            if (identifier == "NzRegion" || systemURL == NzRegion.URI)
            {
                NzRegion nzr = new NzRegion(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzr.codeSystem;
            }
            else if (identifier == "NzEthnicityL1" || systemURL == NzEthnicityL1.URI)
            {
                NzEthnicityL1 nzEth1 = new NzEthnicityL1(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth1.codeSystem;
            }
            else if (identifier == "NzEthnicityL2" || systemURL == NzEthnicityL2.URI)
            {
                NzEthnicityL2 nzEth2 = new NzEthnicityL2(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth2.codeSystem;
            }
            else if (identifier == "NzEthnicityL3" || systemURL == NzEthnicityL3.URI)
            {
                NzEthnicityL3 nzEth3 = new NzEthnicityL3(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth3.codeSystem;
            }
            else if (identifier == "NzEthnicityL4" || systemURL == NzEthnicityL4.URI)
            {
                NzEthnicityL4 nzEth4 = new NzEthnicityL4(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, -1, -1);
                codeSys = nzEth4.codeSystem;
            }
            else if (identifier == "LOINC" || systemURL == FhirLoinc.URI)
            {
                FhirLoinc loinc = new FhirLoinc(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, string.Empty, -1, -1, string.Empty);
                codeSys = loinc.codeSystem;
            }
            else if (identifier == "SNOMEDCT" || systemURL == FhirSnomed.URI)
            {
                FhirSnomed snomed = new FhirSnomed(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, string.Empty, -1, -1, string.Empty, string.Empty);
                codeSys = snomed.codeSystem;
            }
            else if (identifier == "NZMT" || systemURL == NzMt.URI)
            {
                NzMt nzmt = new NzMt(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, string.Empty, -1, -1);
                codeSys = nzmt.codeSystem;
            }
            else if (identifier == "RXNORM" || systemURL == FhirRxNorm.URI)
            {
                FhirRxNorm rxnorm = new FhirRxNorm(TerminologyOperation.define_cs, versionVal, codeVal, string.Empty, string.Empty, -1, -1);
                codeSys = rxnorm.codeSystem;
            }
            else if (identifier == "bundle-type" || systemURL == "http://hl7.org/fhir/bundle-type")
            {
                FhirJsonParser jsp = new FhirJsonParser();
                codeSys = jsp.Parse <CodeSystem>(File.ReadAllText(resourceFilePath + "BundleType.json"));
            }
            else if (identifier == "bundle-type-german" || systemURL == "http://hl7.org/fhir/bundle-type-de")
            {
                FhirJsonParser jsp = new FhirJsonParser();
                codeSys = jsp.Parse <CodeSystem>(File.ReadAllText(resourceFilePath + "BundleTypeGerman.json"));
            }
            else
            {
                throw new Exception(UNSUPPORTED_CODESYSTEM);
            }

            AddNarrative(codeSys);

            return(codeSys);
        }