private void FillValues(string version, string nzmpCode) { this.conceptMap = new ConceptMap(); this.conceptMap.Id = "NZMP_SCT"; this.conceptMap.Url = ServerCapability.TERMINZ_CANONICAL + "/ConceptMap/NzMp_Sct"; this.conceptMap.Name = this.conceptMap.Id; this.conceptMap.Title = "NZMT medicinal product to SNOMED CT map"; this.conceptMap.Description = new Markdown("A mapping between NZMT Medicinal Products and SNOMED CT, published by NZMT in May 2018."); this.conceptMap.Version = "20180501"; this.conceptMap.Status = PublicationStatus.Draft; this.conceptMap.Experimental = true; this.conceptMap.Publisher = "Ministry of Health"; this.conceptMap.Date = new FhirDateTime(2018, 05, 1).Value; this.conceptMap.Purpose = new Markdown("To begin alignment between NZMT and SNOMED CT"); this.conceptMap.Copyright = new Markdown("© 2018+ New Zealand Crown Copyright"); ContactPoint cp = new ContactPoint { System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**" }; ContactDetail cd = new ContactDetail(); cd.Telecom.Add(cp); cd.Name = "Patients First Ltd"; this.conceptMap.Contact.Add(cd); string sourceCodeSystemUri = NzMt.URI; string sourceValueSetUri = @"http://itp.patientsfirst.org.nz/ValueSet/NzulmMp"; string targetCodeSystemUri = FhirSnomed.URI; string targetValueSetUri = @"http://snomed.info/sct?fhir_vs"; this.conceptMap.Source = new FhirUri(sourceValueSetUri); this.conceptMap.Target = new FhirUri(targetValueSetUri); if ((string.IsNullOrEmpty(version) || version == this.conceptMap.Version)) { List <Coding> map = SnomedCtSearch.GetConceptMap_NZ(REFSET_ID, nzmpCode); ConceptMap.GroupComponent gc = new ConceptMap.GroupComponent(); gc.Source = sourceCodeSystemUri; gc.Target = targetCodeSystemUri; foreach (Coding mv in map) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Equivalent; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = mv.Version, Display = mv.System }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = mv.Code, Equivalence = cme, Display = mv.Display }; sec.Target.Add(tec); gc.Element.Add(sec); } this.conceptMap.Group.Add(gc); } }
private void FillValues(string version, string sctid) { this.conceptMap = new ConceptMap(); this.conceptMap.Id = "SCT_NZREAD"; this.conceptMap.Url = ServerCapability.TERMINZ_CANONICAL + "/ConceptMap/Sct_NzRead"; //this.conceptMap.Identifier = new Identifier { System = "urn:ietf:rfc:3986", Value = "urn:uuid:53cd62ee-033e-414c-9f58-3ca97b5ffc3b" }; this.conceptMap.Name = this.conceptMap.Id; this.conceptMap.Title = "SNOMED CT to NZ Read Codes"; string caveat = string.Empty; if (string.IsNullOrEmpty(sctid)) { caveat = " Definition only - complete map too large to download (over 100k elements)."; } this.conceptMap.Description = new Markdown("A mapping between SNOMED CT and the NZ Read Codes, published by NHS Digital and augmented for use in NZ." + caveat); this.conceptMap.Version = "20190501"; this.conceptMap.Status = PublicationStatus.Draft; this.conceptMap.Experimental = true; this.conceptMap.Publisher = "Ministry of Health"; this.conceptMap.Date = new FhirDateTime(2019, 05, 01).Value; this.conceptMap.Purpose = new Markdown("Used by the NZ Ministry of Social Development to help process SNOMED - coded work capacity medical certificates."); this.conceptMap.Copyright = new Markdown("© 2010+ New Zealand Crown Copyright"); ContactPoint cp = new ContactPoint { System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**" }; ContactDetail cd = new ContactDetail(); cd.Telecom.Add(cp); cd.Name = "Patients First Ltd"; this.conceptMap.Contact.Add(cd); string sourceCodeSystemUri = FhirSnomed.URI; string sourceValueSetUri = @"http://snomed.info/sct?fhir_vs"; string targetCodeSystemUri = @"http://health.govt.nz/read-codes"; string targetValueSetUri = @"http://health.govt.nz/read-codes/fhir_vs"; this.conceptMap.Source = new FhirUri(sourceValueSetUri); this.conceptMap.Target = new FhirUri(targetValueSetUri); if ((string.IsNullOrEmpty(version) || version == this.conceptMap.Version) && !string.IsNullOrEmpty(sctid)) { List <Coding> map = SnomedCtSearch.GetConceptMap_NZ(REFSET_ID, sctid); ConceptMap.GroupComponent gc = new ConceptMap.GroupComponent(); gc.Source = sourceCodeSystemUri; gc.Target = targetCodeSystemUri; foreach (Coding mv in map) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Equivalent; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = mv.Version, Display = mv.System }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = mv.Code, Equivalence = cme, Display = mv.Display }; sec.Target.Add(tec); gc.Element.Add(sec); } this.conceptMap.Group.Add(gc); } }
private void FillValues(string version, string readcode) { this.conceptMap = new ConceptMap(); this.conceptMap.Id = "NZREAD_SCT"; this.conceptMap.Url = ServerCapability.TERMINZ_CANONICAL + "/ConceptMap/NzRead_Sct"; //this.conceptMap.Identifier = new Identifier { System = "urn:ietf:rfc:3986", Value = "urn:uuid:53cd62ee-033e-414c-9f58-3ca97b5ffc3b" }; this.conceptMap.Name = this.conceptMap.Id; this.conceptMap.Title = "NZ Read Codes to SNOMED CT"; string caveat = string.Empty; if (string.IsNullOrEmpty(readcode)) { caveat = " Definition only - complete map too large to download (over 100k elements)."; } this.conceptMap.Description = new Markdown("A mapping between the NZ Read Codes and SNOMED CT, published by NHS Digital and augmented for use in NZ." + caveat); this.conceptMap.Version = "20190501"; this.conceptMap.Status = PublicationStatus.Draft; this.conceptMap.Experimental = true; this.conceptMap.Publisher = "Ministry of Health"; this.conceptMap.Date = new FhirDateTime(2019, 05, 01).Value; this.conceptMap.Purpose = new Markdown("To help primary care facilities translate legacy Read Codes"); this.conceptMap.Copyright = new Markdown("© 2010+ New Zealand Crown Copyright"); ContactPoint cp = new ContactPoint { System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**" }; ContactDetail cd = new ContactDetail(); cd.Telecom.Add(cp); cd.Name = "Patients First Ltd"; this.conceptMap.Contact.Add(cd); string sourceCodeSystemUri = @"http://health.govt.nz/read-codes"; string sourceValueSetUri = @"http://health.govt.nz/read-codes/fhir_vs"; string targetCodeSystemUri = FhirSnomed.URI; string targetValueSetUri = @"http://snomed.info/sct?fhir_vs"; this.conceptMap.Source = new FhirUri(sourceValueSetUri); this.conceptMap.Target = new FhirUri(targetValueSetUri); if ((string.IsNullOrEmpty(version) || version == this.conceptMap.Version) && !string.IsNullOrEmpty(readcode)) { // add any missing periods to end of code and default Term ID of '00' //readcode = readcode.PadRight(5, '.'); //readcode = readcode + (readcode.Length == 5 ? "00" : ""); List <Coding> map = SnomedCtSearch.GetConceptMap_NZ(REFSET_ID, readcode); ConceptMap.GroupComponent gc = new ConceptMap.GroupComponent(); gc.Source = sourceCodeSystemUri; gc.Target = targetCodeSystemUri; foreach (Coding mv in map) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Equivalent; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = mv.Version, Display = mv.System }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = mv.Code, Equivalence = cme, Display = mv.Display }; sec.Target.Add(tec); gc.Element.Add(sec); } this.conceptMap.Group.Add(gc); } }
private void FillValues(string version, string ethcode, string sourceSystem, string targetSystem) { this.conceptMap = new ConceptMap(); this.conceptMap.Id = "NZ_ETHNICITY"; this.conceptMap.Url = ServerCapability.TERMINZ_CANONICAL + "/ConceptMap/NzEthnicityLevels"; this.conceptMap.Name = this.conceptMap.Id; this.conceptMap.Title = "NZ Ethnicity Level (2-4) Mappings"; this.conceptMap.Description = new Markdown("Mappings between NZ Ethnicity Levels 2, 3 and 4."); this.conceptMap.Version = "20161209"; this.conceptMap.Status = PublicationStatus.Draft; this.conceptMap.Experimental = true; this.conceptMap.Publisher = "Ministry of Health"; this.conceptMap.Date = new FhirDateTime(2016, 10, 26).Value; this.conceptMap.Purpose = new Markdown("To aid conversions of Ethnicity Codes held at different levels."); this.conceptMap.Copyright = new Markdown("© 2010+ New Zealand Crown Copyright"); ContactPoint cp = new ContactPoint { System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**" }; ContactDetail cd = new ContactDetail(); cd.Telecom.Add(cp); cd.Name = "Patients First Ltd"; this.conceptMap.Contact.Add(cd); this.conceptMap.Source = new FhirUri(sourceSystem); this.conceptMap.Target = new FhirUri(targetSystem); // determine which maps have been requested or all bool allMaps = true; string mapping = string.Empty; string levels = "234"; string sourceLevel = sourceSystem.Substring(sourceSystem.Length - 1, 1); string targetLevel = targetSystem.Substring(targetSystem.Length - 1, 1); if (levels.Contains(sourceLevel) && levels.Contains(targetLevel)) { mapping = sourceLevel + targetLevel; allMaps = false; } // get ValueSets for Levels 2-4 NameValueCollection queryParams = new NameValueCollection(); ValueSet vsL2 = (ValueSet)TerminologyValueSet.PerformOperation("NzEthnicityL2", "$expand", queryParams); ValueSet vsL3 = (ValueSet)TerminologyValueSet.PerformOperation("NzEthnicityL3", "$expand", queryParams); ValueSet vsL4 = (ValueSet)TerminologyValueSet.PerformOperation("NzEthnicityL4", "$expand", queryParams); // Level 2-3 mappings Dictionary <string, string> mapVals23 = new Dictionary <string, string>(); mapVals23.Add("10", "100"); mapVals23.Add("11", "111"); mapVals23.Add("12", "129"); mapVals23.Add("21", "211"); mapVals23.Add("30", "300"); mapVals23.Add("31", "311"); mapVals23.Add("32", "321"); mapVals23.Add("33", "331"); mapVals23.Add("34", "341"); mapVals23.Add("35", "351"); mapVals23.Add("36", "361"); mapVals23.Add("37", "371"); mapVals23.Add("40", "400"); mapVals23.Add("41", "414"); mapVals23.Add("42", "421"); mapVals23.Add("43", "431"); mapVals23.Add("44", "444"); mapVals23.Add("51", "511"); mapVals23.Add("52", "521"); mapVals23.Add("53", "531"); mapVals23.Add("61", "611"); mapVals23.Add("94", "944"); mapVals23.Add("95", "955"); mapVals23.Add("96", "966"); mapVals23.Add("97", "977"); mapVals23.Add("98", "988"); mapVals23.Add("99", "999"); ConceptMap.GroupComponent gc23 = new ConceptMap.GroupComponent(); gc23.Source = NzEthnicityL2.URI; gc23.Target = NzEthnicityL3.URI; foreach (KeyValuePair <string, string> mapVal in mapVals23) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Narrower; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = mapVal.Key, Display = GetCodeDisplay(vsL2, mapVal.Key) }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = mapVal.Value, Equivalence = cme, Display = GetCodeDisplay(vsL3, mapVal.Value) }; sec.Target.Add(tec); gc23.Element.Add(sec); } if (allMaps || mapping == "23") { this.conceptMap.Group.Add(gc23); } // Level 2-4 mappings Dictionary <string, string> mapVals24 = new Dictionary <string, string>(); mapVals24.Add("10", "10000"); mapVals24.Add("11", "11111"); mapVals24.Add("12", "12999"); mapVals24.Add("21", "21111"); mapVals24.Add("30", "30000"); mapVals24.Add("31", "31111"); mapVals24.Add("32", "32100"); mapVals24.Add("33", "33111"); mapVals24.Add("34", "34111"); mapVals24.Add("35", "35111"); mapVals24.Add("36", "36111"); mapVals24.Add("37", "37199"); mapVals24.Add("40", "40000"); mapVals24.Add("41", "41499"); mapVals24.Add("42", "42199"); mapVals24.Add("43", "43199"); mapVals24.Add("44", "44499"); mapVals24.Add("51", "51199"); mapVals24.Add("52", "52199"); mapVals24.Add("53", "53199"); mapVals24.Add("61", "61199"); mapVals24.Add("94", "94444"); mapVals24.Add("95", "95555"); mapVals24.Add("96", "96666"); mapVals24.Add("97", "97777"); mapVals24.Add("98", "98888"); mapVals24.Add("99", "99999"); ConceptMap.GroupComponent gc24 = new ConceptMap.GroupComponent(); gc24.Source = NzEthnicityL2.URI; gc24.Target = NzEthnicityL4.URI; foreach (KeyValuePair <string, string> mapVal in mapVals24) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Narrower; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = mapVal.Key, Display = GetCodeDisplay(vsL2, mapVal.Key) }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = mapVal.Value, Equivalence = cme, Display = GetCodeDisplay(vsL4, mapVal.Value) }; sec.Target.Add(tec); gc24.Element.Add(sec); } if (allMaps || mapping == "24") { this.conceptMap.Group.Add(gc24); } // Level 3 to 4 ConceptMap.GroupComponent gc34 = new ConceptMap.GroupComponent(); gc34.Source = NzEthnicityL3.URI; gc34.Target = NzEthnicityL4.URI; foreach (ValueSet.ContainsComponent ec in vsL3.Expansion.Contains) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Narrower; string targetCode = ec.Code + ec.Code.Substring(2, 1) + ec.Code.Substring(2, 1); ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = ec.Code, Display = ec.Display }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = targetCode, Equivalence = cme, Display = GetCodeDisplay(vsL4, targetCode) }; sec.Target.Add(tec); gc34.Element.Add(sec); } if (allMaps || mapping == "34") { this.conceptMap.Group.Add(gc34); } // Level 3 to 2 ConceptMap.GroupComponent gc32 = new ConceptMap.GroupComponent(); gc32.Source = NzEthnicityL3.URI; gc32.Target = NzEthnicityL2.URI; foreach (ValueSet.ContainsComponent ec in vsL3.Expansion.Contains) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Wider; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = ec.Code, Display = ec.Display }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = ec.Code.Substring(0, 2), Equivalence = cme, Display = GetCodeDisplay(vsL2, ec.Code.Substring(0, 2)) }; sec.Target.Add(tec); gc32.Element.Add(sec); } if (allMaps || mapping == "32") { this.conceptMap.Group.Add(gc32); } // Level 4 to 3 ConceptMap.GroupComponent gc43 = new ConceptMap.GroupComponent(); gc43.Source = NzEthnicityL4.URI; gc43.Target = NzEthnicityL3.URI; foreach (ValueSet.ContainsComponent ec in vsL4.Expansion.Contains) { string targetCode = (ec.Code == "61118") ? "111" : ec.Code.Substring(0, 3); ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Wider; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = ec.Code, Display = ec.Display }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = targetCode, Equivalence = cme, Display = GetCodeDisplay(vsL3, targetCode) }; sec.Target.Add(tec); gc43.Element.Add(sec); } if (allMaps || mapping == "43") { this.conceptMap.Group.Add(gc43); } // Level 4 to 2 ConceptMap.GroupComponent gc42 = new ConceptMap.GroupComponent(); gc42.Source = NzEthnicityL4.URI; gc42.Target = NzEthnicityL2.URI; foreach (ValueSet.ContainsComponent ec in vsL4.Expansion.Contains) { string targetCode = (ec.Code == "61118") ? "11" : ec.Code.Substring(0, 2); ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Wider; ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = ec.Code, Display = ec.Display }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = targetCode, Equivalence = cme, Display = GetCodeDisplay(vsL2, targetCode) }; sec.Target.Add(tec); gc42.Element.Add(sec); } if (allMaps || mapping == "42") { this.conceptMap.Group.Add(gc42); } }
private void FillValues(string version) { this.conceptMap = new ConceptMap(); this.conceptMap.Id = "101"; this.conceptMap.Url = "http://hl7.org/fhir/ConceptMap/101"; this.conceptMap.Identifier = new Identifier { System = "urn:ietf:rfc:3986", Value = "urn:uuid:53cd62ee-033e-414c-9f58-3ca97b5ffc3b" }; this.conceptMap.Name = this.conceptMap.Id; this.conceptMap.Title = "FHIR/v3 Address Use Mapping"; this.conceptMap.Description = new Markdown("A mapping between the FHIR and HL7 v3 AddressUse Code systems"); this.conceptMap.Version = "R4"; this.conceptMap.Status = PublicationStatus.Draft; this.conceptMap.Experimental = true; this.conceptMap.Publisher = "HL7, Inc"; this.conceptMap.Date = new FhirDateTime(2012, 6, 13).Value; this.conceptMap.Purpose = new Markdown("To help implementers map from HL7 v3/CDA to FHIR"); this.conceptMap.Copyright = new Markdown("Creative Commons 0"); ContactPoint cp = new ContactPoint { System = ContactPoint.ContactPointSystem.Other, Value = "http://hl7.org/fhir" }; ContactDetail cd = new ContactDetail(); cd.Telecom.Add(cp); cd.Name = "FHIR project team (example)"; this.conceptMap.Contact.Add(cd); string sourceUri = @"http://hl7.org/fhir/ValueSet/address-use"; string targetUri = @"http://terminology.hl7.org/ValueSet/v3-AddressUse"; this.conceptMap.Source = new FhirUri(sourceUri); // Value Set this.conceptMap.Target = new FhirUri(targetUri); // Value Set Dictionary <string, string> mapVals = new Dictionary <string, string>(); mapVals.Add("home", "H"); mapVals.Add("work", "WP"); mapVals.Add("temp", "TMP"); mapVals.Add("old", "BAD"); if (string.IsNullOrEmpty(version) || version == this.conceptMap.Version) { ConceptMap.GroupComponent gc = new ConceptMap.GroupComponent(); gc.Source = "http://hl7.org/fhir/address-use"; // Code System gc.Target = "http://terminology.hl7.org/CodeSystem/v3-AddressUse"; // Code System foreach (KeyValuePair <string, string> mapVal in mapVals) { ConceptMap.ConceptMapEquivalence cme = ConceptMap.ConceptMapEquivalence.Equivalent; string comments = ""; string display = mapVal.Value.Replace("H", "home address").Replace("WP", "work place").Replace("TMP", "temporary address"); if (mapVal.Key == "old") { cme = ConceptMap.ConceptMapEquivalence.Disjoint; comments = "In the HL7 v3 AD, old is handled by the usablePeriod element, but you have to provide a time, there's no simple equivalent of flagging an address as old"; display = "bad address"; } ConceptMap.SourceElementComponent sec = new ConceptMap.SourceElementComponent { Code = mapVal.Key, Display = mapVal.Key }; ConceptMap.TargetElementComponent tec = new ConceptMap.TargetElementComponent { Code = mapVal.Value, Display = display, Equivalence = cme, Comment = comments }; sec.Target.Add(tec); gc.Element.Add(sec); } this.conceptMap.Group.Add(gc); } else { throw new Exception(TerminologyConceptMap.UNSUPPORTED_VERSION); } }