Exemplo n.º 1
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "extensional-case-2";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Extensional case #2";
            this.valueSet.Description  = new Markdown("an enumeration of codes defined by LOINC");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";
            this.valueSet.Copyright    = new Markdown("This content LOINC is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ComposeComponent   comp = new ValueSet.ComposeComponent();
            ValueSet.ExpansionComponent es   = new ValueSet.ExpansionComponent();

            ValueSet.ConceptSetComponent csc = new ValueSet.ConceptSetComponent {
                System = FhirLoinc.URI, Version = FhirLoinc.CURRENT_VERSION
            };

            if (string.IsNullOrEmpty(version) || version == this.valueSet.Version)
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>
                {
                    { "11378-7", "Systolic blood pressure at First encounter" },
                    { "8493-9", "Systolic blood pressure 10 hour minimum" },
                    { "8494-7", "Systolic blood pressure 12 hour minimum" },
                    { "8495-4", "Systolic blood pressure 24 hour minimum" },
                    { "8450-9", "Systolic blood pressure--expiration" },
                    { "8451-7", "Systolic blood pressure--inspiration" },
                    { "8452-5", "Systolic blood pressure.inspiration - expiration" },
                    { "8459-0", "Systolic blood pressure--sitting" },
                    { "8460-8", "Systolic blood pressure--standing" },
                    { "8461-6", "Systolic blood pressure--supine" },
                    { "8479-8", "Systolic blood pressure by palpation" },
                    { "8480-6", "Systolic blood pressure" },
                    { "8481-4", "Systolic blood pressure 1 hour maximum" },
                    { "8482-2", "Systolic blood pressure 8 hour maximum" },
                    { "8483-0", "Systolic blood pressure 10 hour maximum" },
                    { "8484-8", "Systolic blood pressure 12 hour maximum" },
                    { "8485-5", "Systolic blood pressure 24 hour maximum" },
                    { "8486-3", "Systolic blood pressure 1 hour mean" },
                    { "8487-1", "Systolic blood pressure 8 hour mean" },
                    { "8488-9", "Systolic blood pressure 10 hour mean" },
                    { "8489-7", "Systolic blood pressure 12 hour mean" },
                    { "8490-5", "Systolic blood pressure 24 hour mean" },
                    { "8491-3", "Systolic blood pressure 1 hour minimum" },
                    { "8492-1", "Systolic blood pressure 8 hour minimum" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc.System
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    comp.Include.Add(csc);
                    this.valueSet.Compose = comp;
                }
            }
        }
Exemplo n.º 2
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "extensional-case-3";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-3";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Extensional case #3";
            this.valueSet.Description  = new Markdown("an enumeration of codes defined by SNOMED CT");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";
            this.valueSet.Copyright    = new Markdown("This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ComposeComponent   comp = new ValueSet.ComposeComponent();
            ValueSet.ExpansionComponent es   = new ValueSet.ExpansionComponent();

            ValueSet.ConceptSetComponent csc = new ValueSet.ConceptSetComponent {
                System = FhirSnomed.URI
            };

            if (string.IsNullOrEmpty(version) || version == this.valueSet.Version)
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>
                {
                    { "371037005", "Systolic dysfunction" },
                    { "56218007", "Systolic hypertension" },
                    { "271657009", "Systolic cardiac thrill" },
                    { "429457004", "Systolic essential hypertension" },
                    { "417996009", "Systolic heart failure" },
                    { "44623008", "Systolic ejection sound" },
                    { "248677002", "Systolic flow murmur" },
                    { "31574009", "Systolic murmur" },
                    { "120871000119108", "Systolic heart failure stage B" },
                    { "120851000119104", "Systolic heart failure stage D" },
                    { "120861000119102", "Systolic heart failure stage C" },
                    { "609556008", "Systolic heart failure stage A" },
                    { "61926008", "Basal systolic thrill" },
                    { "248672008", "Soft systolic murmur" },
                    { "65254001", "Late systolic murmur" },
                    { "89985004", "Early systolic murmur" },
                    { "248692001", "Mid-systolic click" },
                    { "248678007", "Mitral late systolic murmur" },
                    { "443254009", "Acute systolic heart failure" },
                    { "441481004", "Chronic systolic heart failure" },
                    { "48965007", "Single non-ejection systolic click" },
                    { "68519006", "Multiple non-ejection systolic clicks" },
                    { "134401001", "Left ventricular systolic dysfunction" },
                    { "416158002", "Right ventricular systolic dysfunction" },
                    { "68494000", "Mid-systolic murmur" },
                    { "442304009", "Combined systolic and diastolic dysfunction" },
                    { "18352002", "Abnormal systolic arterial pressure" },
                    { "407596008", "Echocardiogram shows left ventricular systolic dysfunction" },
                    { "371857005", "Normal left ventricular systolic function and wall motion" },
                    { "430396006", "Chronic systolic dysfunction of left ventricle" },
                    { "12929001", "Normal systolic arterial pressure" },
                    { "275285009", "On examination - systolic murmur" },
                    { "443253003", "Acute on chronic systolic heart failure" },
                    { "371862006", "Depression of left ventricular systolic function" },
                    { "81010002", "Decreased systolic arterial pressure" },
                    { "163030003", "On examination - Systolic BP reading" },
                    { "163069009", "On examination - systolic cardiac thrill" },
                    { "18050000", "Increased systolic arterial pressure" },
                    { "163094005", "On examination - pulmonary systolic murmur" },
                    { "426263006", "Congestive heart failure due to left ventricular systolic dysfunction" },
                    { "417081007", "Systolic anterior movement of mitral valve" },
                    { "248679004", "Mitral pansystolic murmur" },
                    { "248687003", "Presystolic mitral murmur" },
                    { "248688008", "Presystolic tricuspid murmur" },
                    { "71201008", "Pansystolic murmur" },
                    { "23795000", "Presystolic murmur" },
                    { "248680001", "Tricuspid inspiratory pansystolic murmur" },
                    { "248681002", "Left parasternal pansystolic murmur" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc.System
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    comp.Include.Add(csc);
                    this.valueSet.Compose = comp;
                }
            }
        }
Exemplo n.º 3
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "extensional-case-4";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-4";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Extensional case #4";
            this.valueSet.Description  = new Markdown("A mixed enumeration of codes from FHIR, and from V2 administrative gender code");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ComposeComponent   comp = new ValueSet.ComposeComponent();
            ValueSet.ExpansionComponent es   = new ValueSet.ExpansionComponent();

            ValueSet.ConceptSetComponent csc = new ValueSet.ConceptSetComponent {
                System = "http://hl7.org/fhir/administrative-gender"
            };
            ValueSet.ConceptSetComponent csc2 = new ValueSet.ConceptSetComponent {
                System = "http://terminology.hl7.org/CodeSystem/v2-0001"
            };

            if (string.IsNullOrEmpty(version) || version == this.valueSet.Version)
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>
                {
                    { "male", "Male" },
                    { "female", "Female" },
                    { "other", "Other" },
                    { "unknown", "Unknown" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc.System
                        });
                    }
                }

                Dictionary <string, string> codeVals2 = new Dictionary <string, string>
                {
                    { "A", "Ambiguous" },
                    { "M", "Male" },
                    { "F", "Female" },
                    { "N", "Not applicable" },
                    { "O", "Other" },
                    { "U", "Unknown" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals2)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc2.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc2.System
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    comp.Include.Add(csc);
                    this.valueSet.Compose = comp;
                }
            }
        }
Exemplo n.º 4
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "NzEthnicityL2";
            this.codeSystem.Id = "NzEthnicityL2";

            this.codeSystem.CaseSensitive = true;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.Complete;
            this.codeSystem.Experimental  = true;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            this.valueSet.Url   = ServerCapability.TERMINZ_CANONICAL + "/ValueSet/NzEthnicityL2";
            this.codeSystem.Url = NzEthnicityL2.URI;

            this.codeSystem.ValueSet = this.valueSet.Url;

            this.valueSet.Title   = "NZ Ethnicity Level 2";
            this.codeSystem.Title = "NZ Ethnicity Level 2";

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown("Value Set of all NZ Ethnicity Level 2 Codes");
            this.codeSystem.Description = new Markdown("NZ Ethnicity Level 2 Codes");

            this.valueSet.Version   = "1.0.1";
            this.codeSystem.Version = "1.0.1";

            this.valueSet.Experimental = false;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Ministry of Health";

            this.valueSet.Copyright   = new Markdown("© 2010+ New Zealand Crown Copyright");
            this.codeSystem.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);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version))
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>();

                codeVals.Add("10", "European NFD");
                codeVals.Add("11", "NZ European");
                codeVals.Add("12", "Other European");
                codeVals.Add("21", "NZ Māori");
                codeVals.Add("30", "Pacific Island NFD");
                codeVals.Add("31", "Samoan");
                codeVals.Add("32", "Cook Island Māori");
                codeVals.Add("33", "Tongan");
                codeVals.Add("34", "Niuean");
                codeVals.Add("35", "Tokelauan");
                codeVals.Add("36", "Fijian");
                codeVals.Add("37", "Other Pacific Island");
                codeVals.Add("40", "Asian NFD");
                codeVals.Add("41", "Southeast Asian");
                codeVals.Add("42", "Chinese");
                codeVals.Add("43", "Indian");
                codeVals.Add("44", "Other Asian");
                codeVals.Add("51", "Middle Eastern");
                codeVals.Add("52", "Latin American / Hispanic");
                codeVals.Add("53", "African");
                codeVals.Add("54", "Other (retired on 1/07/2009)");
                codeVals.Add("61", "Other Ethnicity");
                codeVals.Add("94", "Don't Know");
                codeVals.Add("95", "Refused to Answer");
                codeVals.Add("96", "Repeated Value");
                codeVals.Add("97", "Response Unidentifiable");
                codeVals.Add("98", "Response Outside Scope");
                codeVals.Add("99", "Not Stated");

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 5
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "NzRegion";
            this.codeSystem.Id = "NzRegion";

            this.codeSystem.CaseSensitive = true;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.Complete;
            this.codeSystem.Experimental  = true;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            this.valueSet.Url   = ServerCapability.HL7_FHIR_CANONICAL + "/ValueSet/NzRegion";
            this.codeSystem.Url = NzRegion.URI;

            this.codeSystem.ValueSet = this.valueSet.Url;

            this.valueSet.Title   = "NZ Region";
            this.codeSystem.Title = "NZ Region";

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown("Value Set of all NZ DHB Regional Codes");
            this.codeSystem.Description = new Markdown("NZ DHB Regional Codes");

            this.valueSet.Version   = "1.0.1";
            this.codeSystem.Version = "1.0.1";

            this.valueSet.Experimental = true;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Draft;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Patients First Ltd";

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version))
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>();

                codeVals.Add("NORTH", "Northern");
                codeVals.Add("MIDLAND", "Midland");
                codeVals.Add("CENTRAL", "Central");
                codeVals.Add("SOUTH", "Southern");

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 6
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "NzEthnicityL1";
            this.codeSystem.Id = "NzEthnicityL1";

            this.codeSystem.CaseSensitive = true;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.Complete;
            this.codeSystem.Experimental  = true;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            this.valueSet.Url   = ServerCapability.TERMINZ_CANONICAL + "/ValueSet/NzEthnicityL1";
            this.codeSystem.Url = NzEthnicityL1.URI;

            this.codeSystem.ValueSet = this.valueSet.Url;

            this.valueSet.Title   = "NZ Ethnicity Level 1";
            this.codeSystem.Title = "NZ Ethnicity Level 1";

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown("Value Set of all NZ Ethnicity Level 1 Codes");
            this.codeSystem.Description = new Markdown("NZ Ethnicity Level 1 Codes");

            this.valueSet.Version   = "1.0.1";
            this.codeSystem.Version = "1.0.1";

            this.valueSet.Experimental = false;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Ministry of Health";

            this.valueSet.Copyright   = new Markdown("© 2010+ New Zealand Crown Copyright");
            this.codeSystem.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);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version))
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>();

                codeVals.Add("1", "European");
                codeVals.Add("2", "Māori");
                codeVals.Add("3", "Pacific Peoples");
                codeVals.Add("4", "Asian");
                codeVals.Add("5", "Middle Eastern/Latin American/African");
                codeVals.Add("6", "Other Ethnicity");
                codeVals.Add("9", "Residual Categories");

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 7
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "NzEthnicityL4";
            this.codeSystem.Id = "NzEthnicityL4";

            this.codeSystem.CaseSensitive = true;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.Complete;
            this.codeSystem.Experimental  = true;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            this.valueSet.Url   = ServerCapability.TERMINZ_CANONICAL + "/ValueSet/NzEthnicityL4";
            this.codeSystem.Url = NzEthnicityL4.URI;

            this.codeSystem.ValueSet = this.valueSet.Url;

            this.valueSet.Title   = "NZ Ethnicity Level 4";
            this.codeSystem.Title = "NZ Ethnicity Level 4";

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown("Value Set of all NZ Ethnicity Level 4 Codes");
            this.codeSystem.Description = new Markdown("NZ Ethnicity Level 4 Codes");

            this.valueSet.Version   = "1.0.1";
            this.codeSystem.Version = "1.0.1";

            this.valueSet.Experimental = false;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Ministry of Health";

            this.valueSet.Copyright   = new Markdown("© 2010+ New Zealand Crown Copyright");
            this.codeSystem.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);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version))
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>();

                codeVals.Add("10000", "European NFD");
                codeVals.Add("11111", "New Zealand European");
                codeVals.Add("12100", "British NFD");
                codeVals.Add("12111", "Celtic");
                codeVals.Add("12112", "Channel Islander");
                codeVals.Add("12113", "Cornish");
                codeVals.Add("12114", "English");
                codeVals.Add("12115", "Gaelic");
                codeVals.Add("12116", "Irish");
                codeVals.Add("12117", "Manx");
                codeVals.Add("12118", "Orkney Islander");
                codeVals.Add("12119", "Scottish (Scots)");
                codeVals.Add("12120", "Shetland Islander");
                codeVals.Add("12121", "Welsh");
                codeVals.Add("12199", "British NEC");
                codeVals.Add("12211", "Dutch/Netherlands");
                codeVals.Add("12311", "Greek (including Greek Cypriot)");
                codeVals.Add("12411", "Polish");
                codeVals.Add("12500", "South Slav (formerly Yugoslav groups) NFD");
                codeVals.Add("12511", "Croat/Croatian");
                codeVals.Add("12512", "Dalmatian");
                codeVals.Add("12513", "Macedonian");
                codeVals.Add("12514", "Serb/Serbian");
                codeVals.Add("12515", "Slovene/Slovenian");
                codeVals.Add("12516", "Bosnian");
                codeVals.Add("12599", "South Slav (formerly Yugoslav groups) NEC");
                codeVals.Add("12611", "Italian");
                codeVals.Add("12711", "German");
                codeVals.Add("12811", "Australian");
                codeVals.Add("12911", "Albanian");
                codeVals.Add("12912", "Armenian");
                codeVals.Add("12913", "Austrian");
                codeVals.Add("12914", "Belgian");
                codeVals.Add("12915", "Bulgarian");
                codeVals.Add("12916", "Belorussian");
                codeVals.Add("12917", "Corsican");
                codeVals.Add("12918", "Cypriot Unspecified");
                codeVals.Add("12919", "Czech");
                codeVals.Add("12920", "Danish");
                codeVals.Add("12921", "Estonian");
                codeVals.Add("12922", "Finnish");
                codeVals.Add("12923", "Flemish");
                codeVals.Add("12924", "French");
                codeVals.Add("12925", "Greenlander");
                codeVals.Add("12926", "Hungarian");
                codeVals.Add("12927", "Icelander");
                codeVals.Add("12928", "Latvian");
                codeVals.Add("12929", "Lithuanian");
                codeVals.Add("12930", "Maltese");
                codeVals.Add("12931", "Norwegian");
                codeVals.Add("12932", "Portuguese");
                codeVals.Add("12933", "Romanian / Rumanian");
                codeVals.Add("12934", "Romany / Gypsy");
                codeVals.Add("12935", "Russian");
                codeVals.Add("12936", "Sardinian");
                codeVals.Add("12937", "Slavic / Slav");
                codeVals.Add("12938", "Slovak");
                codeVals.Add("12939", "Spanish");
                codeVals.Add("12940", "Swedish");
                codeVals.Add("12941", "Swiss");
                codeVals.Add("12942", "Ukrainian");
                codeVals.Add("12943", "American (US)");
                codeVals.Add("12944", "Burgher");
                codeVals.Add("12945", "Canadian");
                codeVals.Add("12946", "Falkland Islander / Kelper");
                codeVals.Add("12947", "New Caledonian");
                codeVals.Add("12948", "South African");
                codeVals.Add("12949", "Afrikaner");
                codeVals.Add("12950", "Zimbabwean");
                codeVals.Add("12999", "European NEC");
                codeVals.Add("21111", "Māori");
                codeVals.Add("30000", "Pacific peoples NFD");
                codeVals.Add("31111", "Samoan");
                codeVals.Add("32100", "Cook Island Māori NFD");
                codeVals.Add("32111", "Aitutaki Islander");
                codeVals.Add("32112", "Atiu Islander");
                codeVals.Add("32113", "Mangaia Islander");
                codeVals.Add("32114", "Manihiki Islander");
                codeVals.Add("32115", "Mauke Islander");
                codeVals.Add("32116", "Mitiaro Islander");
                codeVals.Add("32117", "Palmerston Islander");
                codeVals.Add("32118", "Penrhyn Islander");
                codeVals.Add("32119", "Pukapuka Islander");
                codeVals.Add("32120", "Rakahanga Islander");
                codeVals.Add("32121", "Rarotongan");
                codeVals.Add("33111", "Tongan");
                codeVals.Add("34111", "Niuean");
                codeVals.Add("35111", "Tokelauan");
                codeVals.Add("36111", "Fijian (except Fiji Indian / Indo-Fijian)");
                codeVals.Add("37111", "Admiralty Islander");
                codeVals.Add("37112", "Australian Aboriginal");
                codeVals.Add("37113", "Austral Islander");
                codeVals.Add("37114", "Belau / Palau Islander");
                codeVals.Add("37115", "Bismark Archipelagoan");
                codeVals.Add("37116", "Bougainvillean");
                codeVals.Add("37117", "Caroline Islander");
                codeVals.Add("37118", "Easter Islander");
                codeVals.Add("37119", "Gambier Islander");
                codeVals.Add("37120", "Guadalcanalian");
                codeVals.Add("37121", "Guam Islander / Chamorro");
                codeVals.Add("37122", "Hawaiian");
                codeVals.Add("37123", "Kanaka / Kanak");
                codeVals.Add("37124", "I-Kiribati / Gilbertese");
                codeVals.Add("37125", "Malaitian");
                codeVals.Add("37126", "Manus Islander");
                codeVals.Add("37127", "Marianas Islander");
                codeVals.Add("37128", "Marquesas Islander");
                codeVals.Add("37129", "Marshall Islander");
                codeVals.Add("37130", "Nauru Islander");
                codeVals.Add("37131", "New Britain Islander");
                codeVals.Add("37132", "New Georgian");
                codeVals.Add("37133", "New Irelander");
                codeVals.Add("37134", "Ocean Islander / Banaban");
                codeVals.Add("37135", "Papuan / New Guinean / Irian Jayan");
                codeVals.Add("37136", "Phoenix Islander");
                codeVals.Add("37137", "Pitcairn Islander");
                codeVals.Add("37138", "Rotuman / Rotuman Islander");
                codeVals.Add("37139", "Santa Cruz Islander");
                codeVals.Add("37140", "Society Islander (including Tahitian)");
                codeVals.Add("37141", "Solomon Islander");
                codeVals.Add("37142", "Torres Strait Islander / Thursday Islander");
                codeVals.Add("37143", "Tuamotu Islander");
                codeVals.Add("37144", "Tuvalu Islander / Ellice Islander");
                codeVals.Add("37145", "Vanuatu Islander / New Hebridean");
                codeVals.Add("37146", "Wake Islander");
                codeVals.Add("37147", "Wallis Islander");
                codeVals.Add("37148", "Yap Islander");
                codeVals.Add("37199", "Other Pacific peoples NEC");
                codeVals.Add("40000", "Asian NFD");
                codeVals.Add("41000", "Southeast Asian NFD");
                codeVals.Add("41111", "Filipino");
                codeVals.Add("41211", "Khmer / Kampuchean / Cambodian");
                codeVals.Add("41311", "Vietnamese");
                codeVals.Add("41411", "Burmese");
                codeVals.Add("41412", "Indonesian (including Javanese / Sundanese / Sumatran)");
                codeVals.Add("41413", "Lao / Laotian");
                codeVals.Add("41414", "Malay / Malayan");
                codeVals.Add("41415", "Thai / Tai / Siamese");
                codeVals.Add("41499", "Other Southeast Asian NEC");
                codeVals.Add("42100", "Chinese NFD");
                codeVals.Add("42111", "Hong Kong Chinese");
                codeVals.Add("42112", "Kampuchean Chinese");
                codeVals.Add("42113", "Malaysian Chinese");
                codeVals.Add("42114", "Singaporean Chinese");
                codeVals.Add("42115", "Vietnamese Chinese");
                codeVals.Add("42116", "Taiwanese Chinese");
                codeVals.Add("42199", "Chinese NEC");
                codeVals.Add("43100", "Indian NFD");
                codeVals.Add("43111", "Bengali");
                codeVals.Add("43112", "Fijian Indian / Indo-Fijian");
                codeVals.Add("43113", "Gujarati");
                codeVals.Add("43114", "Tamil");
                codeVals.Add("43115", "Punjabi");
                codeVals.Add("43116", "Sikh");
                codeVals.Add("43117", "Anglo Indian");
                codeVals.Add("43199", "Indian NEC");
                codeVals.Add("44100", "Sri Lankan NFD");
                codeVals.Add("44111", "Sinhalese");
                codeVals.Add("44112", "Sri Lankan Tamil");
                codeVals.Add("44199", "Sri Lankan NEC");
                codeVals.Add("44211", "Japanese");
                codeVals.Add("44311", "Korean");
                codeVals.Add("44411", "Afghani");
                codeVals.Add("44412", "Bangladeshi");
                codeVals.Add("44413", "Nepalese");
                codeVals.Add("44414", "Pakistani");
                codeVals.Add("44415", "Tibetan");
                codeVals.Add("44416", "Eurasian");
                codeVals.Add("44499", "Other Asian NEC");
                codeVals.Add("51100", "Middle Eastern NFD");
                codeVals.Add("51111", "Algerian");
                codeVals.Add("51112", "Arab");
                codeVals.Add("51113", "Assyrian");
                codeVals.Add("51114", "Egyptian");
                codeVals.Add("51115", "Iranian / Persian");
                codeVals.Add("51116", "Iraqi");
                codeVals.Add("51117", "Israeli / Jewish / Hebrew");
                codeVals.Add("51118", "Jordanian");
                codeVals.Add("51119", "Kurd");
                codeVals.Add("51120", "Lebanese");
                codeVals.Add("51121", "Libyan");
                codeVals.Add("51122", "Moroccan");
                codeVals.Add("51123", "Omani");
                codeVals.Add("51124", "Palestinian");
                codeVals.Add("51125", "Syrian");
                codeVals.Add("51126", "Tunisian");
                codeVals.Add("51127", "Turkish (including Turkish Cypriot)");
                codeVals.Add("51128", "Yemeni");
                codeVals.Add("51199", "Middle Eastern NEC");
                codeVals.Add("52100", "Latin American / Hispanic NFD");
                codeVals.Add("52111", "Argentinian");
                codeVals.Add("52112", "Bolivian");
                codeVals.Add("52113", "Brazilian");
                codeVals.Add("52114", "Chilean");
                codeVals.Add("52115", "Colombian");
                codeVals.Add("52116", "Costa Rican");
                codeVals.Add("52117", "Creole (Latin America)");
                codeVals.Add("52118", "Ecuadorian");
                codeVals.Add("52119", "Guatemalan");
                codeVals.Add("52120", "Guyanese");
                codeVals.Add("52121", "Honduran");
                codeVals.Add("52122", "Malvinian (Spanish-speaking Falkland Islander)");
                codeVals.Add("52123", "Mexican");
                codeVals.Add("52124", "Nicaraguan");
                codeVals.Add("52125", "Panamanian");
                codeVals.Add("52126", "Paraguayan");
                codeVals.Add("52127", "Peruvian");
                codeVals.Add("52128", "Puerto Rican");
                codeVals.Add("52129", "Uruguayan");
                codeVals.Add("52130", "Venezuelan");
                codeVals.Add("52199", "Latin American / Hispanic NEC");
                codeVals.Add("53100", "African NFD");
                codeVals.Add("53112", "Creole (US)");
                codeVals.Add("53113", "Jamaican");
                codeVals.Add("53114", "Kenyan");
                codeVals.Add("53115", "Nigerian");
                codeVals.Add("53116", "African American");
                codeVals.Add("53117", "Ugandan");
                codeVals.Add("53118", "West Indian / Caribbean");
                codeVals.Add("53119", "Somali");
                codeVals.Add("53120", "Eritrean");
                codeVals.Add("53121", "Ethiopian");
                codeVals.Add("53122", "Ghanaian");
                codeVals.Add("53199", "Other African NEC");
                codeVals.Add("61111", "Central American Indian");
                codeVals.Add("61112", "Inuit / Eskimo");
                codeVals.Add("61113", "North American Indian");
                codeVals.Add("61114", "South American Indian");
                codeVals.Add("61115", "Mauritian");
                codeVals.Add("61116", "Seychelles Islander");
                codeVals.Add("61117", "South African Coloured");
                codeVals.Add("61118", "New Zealander");
                codeVals.Add("61199", "Other NEC");
                codeVals.Add("94444", "Don't know");
                codeVals.Add("95555", "Refused to answer");
                codeVals.Add("96666", "Repeated Value");
                codeVals.Add("97777", "Response unidentifiable");
                codeVals.Add("98888", "Response Outside Scope");
                codeVals.Add("99999", "Not stated");

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 8
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "NzEthnicityL3";
            this.codeSystem.Id = "NzEthnicityL3";

            this.codeSystem.CaseSensitive = true;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.Complete;
            this.codeSystem.Experimental  = true;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            this.valueSet.Url   = ServerCapability.TERMINZ_CANONICAL + "/ValueSet/NzEthnicityL3";
            this.codeSystem.Url = NzEthnicityL3.URI;

            this.codeSystem.ValueSet = this.valueSet.Url;

            this.valueSet.Title   = "NZ Ethnicity Level 3";
            this.codeSystem.Title = "NZ Ethnicity Level 3";

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown("Value Set of all NZ Ethnicity Level 3 Codes");
            this.codeSystem.Description = new Markdown("NZ Ethnicity Level 3 Codes");

            this.valueSet.Version   = "1.0.1";
            this.codeSystem.Version = "1.0.1";

            this.valueSet.Experimental = false;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Ministry of Health";

            this.valueSet.Copyright   = new Markdown("© 2010+ New Zealand Crown Copyright");
            this.codeSystem.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);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version))
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>();

                codeVals.Add("100", "European NFD");
                codeVals.Add("111", "New Zealand European");
                codeVals.Add("120", "Other European NFD");
                codeVals.Add("121", "British and Irish");
                codeVals.Add("122", "Dutch");
                codeVals.Add("123", "Greek (including Greek Cypriot)");
                codeVals.Add("124", "Polish");
                codeVals.Add("125", "South Slav (formerly Yugoslav)");
                codeVals.Add("126", "Italian");
                codeVals.Add("127", "German");
                codeVals.Add("128", "Australian");
                codeVals.Add("129", "Other European");
                codeVals.Add("211", "Māori");
                codeVals.Add("300", "Pacific Peoples NFD");
                codeVals.Add("311", "Samoan");
                codeVals.Add("321", "Cook Island Māori");
                codeVals.Add("331", "Tongan");
                codeVals.Add("341", "Niuean");
                codeVals.Add("351", "Tokelauan");
                codeVals.Add("361", "Fijian");
                codeVals.Add("371", "Other Pacific Peoples");
                codeVals.Add("400", "Asian NFD");
                codeVals.Add("410", "Southeast Asian NFD");
                codeVals.Add("411", "Filipino");
                codeVals.Add("412", "Khmer / Kampuchean / Cambodian");
                codeVals.Add("413", "Vietnamese");
                codeVals.Add("414", "Other Southeast Asian");
                codeVals.Add("421", "Chinese");
                codeVals.Add("431", "Indian");
                codeVals.Add("441", "Sri Lankan");
                codeVals.Add("442", "Japanese");
                codeVals.Add("443", "Korean");
                codeVals.Add("444", "Other Asian");
                codeVals.Add("511", "Middle Eastern");
                codeVals.Add("521", "Latin American / Hispanic");
                codeVals.Add("531", "African(or cultural group of African origin)");
                codeVals.Add("611", "Other Ethnicity");
                codeVals.Add("944", "Don't Know");
                codeVals.Add("955", "Refused to Answer");
                codeVals.Add("966", "Repeated value");
                codeVals.Add("977", "Response unidentifiable");
                codeVals.Add("988", "Response outside scope");
                codeVals.Add("999", "Not stated");


                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 9
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, string identifier, int offsetNo, int countNo, string useContext)
        {
            //if(!string.IsNullOrEmpty(code) && char.IsLetter(code[0]))
            if (!string.IsNullOrEmpty(code) && code.StartsWith("LL"))
            {
                throw new Exception(UNSUPPORTED_ANSWER_LIST);
            }

            // determine if filter contains a LOINC property-related query
            string loincProperty = string.Empty;
            string loincValue    = string.Empty;

            // Look for property filter & place code in filter e.g. SYSTEM=Arterial System
            int component_Filter  = identifier.IndexOf("/COMPONENT=");
            int property_Filter   = identifier.IndexOf("/PROPERTY=");
            int time_aspct_Filter = identifier.IndexOf("/TIME_ASPCT=");
            int system_Filter     = identifier.IndexOf("/SYSTEM=");
            int scale_typ_Filter  = identifier.IndexOf("/SCALE_TYP=");
            int method_typ_Filter = identifier.IndexOf("/METHOD_TYP=");

            //int consumer_name_Filter = identifier.IndexOf("/CONSUMER_NAME=");
            int class_Filter     = identifier.IndexOf("/CLASS=");
            int classType_Filter = identifier.IndexOf("/CLASSTYPE=");
            int order_obs_Filter = identifier.IndexOf("/ORDER_OBS=");

            if (component_Filter > 0)
            {
                loincProperty = "COMPONENT";
                loincValue    = identifier.Substring(component_Filter + 11);
            }
            else if (property_Filter > 0)
            {
                loincProperty = "PROPERTY";
                loincValue    = identifier.Substring(property_Filter + 10);
            }
            else if (time_aspct_Filter > 0)
            {
                loincProperty = "TIME_ASPCT";
                loincValue    = identifier.Substring(time_aspct_Filter + 12);
            }
            else if (system_Filter > 0)
            {
                loincProperty = "SYSTEM";
                loincValue    = identifier.Substring(system_Filter + 8);
            }
            else if (scale_typ_Filter > 0)
            {
                loincProperty = "SCALE_TYP";
                loincValue    = identifier.Substring(scale_typ_Filter + 11);
            }
            else if (method_typ_Filter > 0)
            {
                loincProperty = "METHOD_TYP";
                loincValue    = identifier.Substring(method_typ_Filter + 12);
            }
            else if (order_obs_Filter > 0)
            {
                loincProperty = "ORDER_OBS";
                loincValue    = identifier.Substring(order_obs_Filter + 11);
            }
            else if (classType_Filter > 0)
            {
                loincProperty = "CLASSTYPE";
                loincValue    = identifier.Substring(classType_Filter + 11);
            }
            else if (class_Filter > 0)
            {
                loincProperty = "CLASS";
                loincValue    = identifier.Substring(class_Filter + 7);
            }
            //else if (consumer_name_Filter > 0)
            //{
            //    loincProperty = "CONSUMER_NAME";
            //    loincValue = identifier.Substring(consumer_name_Filter + 15);
            //}

            string description = "All LOINC Codes Filtered By: " + filter;
            string title       = "LOINC";
            string idSuffix    = filter.Replace(" ", "_");

            if (!string.IsNullOrEmpty(loincProperty) && !string.IsNullOrEmpty(loincValue))
            {
                description = "LOINC codes where " + loincProperty + " = " + loincValue;
                title       = "LOINC Codes: " + loincProperty + "=" + loincValue;
                idSuffix    = loincValue.Replace(" ", "_");
            }

            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "fhir_loinc_vs_" + idSuffix;
            this.codeSystem.Id = "LOINC";

            this.codeSystem.CaseSensitive    = true;
            this.codeSystem.Content          = CodeSystem.CodeSystemContentMode.NotPresent;
            this.codeSystem.Experimental     = false;
            this.codeSystem.Compositional    = false;
            this.codeSystem.VersionNeeded    = false;
            this.codeSystem.HierarchyMeaning = CodeSystem.CodeSystemHierarchyMeaning.PartOf;

            // Code System filters

            List <FilterOperator?> fops = new List <FilterOperator?>();

            fops.Add(FilterOperator.Equal);
            this.codeSystem.Filter.Add(new CodeSystem.FilterComponent {
                Code = "property", Description = "Allows the selection of a set of LOINC codes with a common property value.", Value = "A LOINC Code", Operator = fops.AsEnumerable()
            });


            this.valueSet.Url   = ServerCapability.TERMINZ_CANONICAL + "/ValueSet/loinc/" + idSuffix;
            this.codeSystem.Url = FhirLoinc.URI;

            this.codeSystem.ValueSet = "http://loinc.org/vs";

            this.valueSet.Title   = title;
            this.codeSystem.Title = FhirLoinc.TITLE;

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;


            this.valueSet.Description   = new Markdown(description);
            this.codeSystem.Description = new Markdown(FhirLoinc.DESCRIPTION);

            this.valueSet.Version   = FhirLoinc.CURRENT_VERSION;
            this.codeSystem.Version = FhirLoinc.CURRENT_VERSION;

            this.valueSet.Experimental = true;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Regenstrief Institute, Inc.";

            this.valueSet.Copyright   = new Markdown("This content LOINC is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use");
            this.codeSystem.Copyright = this.valueSet.Copyright;

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version) && termOp != TerminologyOperation.define_cs)
            {
                List <Coding> codeVals = new List <Coding>();

                if (termOp != TerminologyOperation.define_vs)
                {
                    if (!string.IsNullOrEmpty(loincProperty) && !string.IsNullOrEmpty(loincValue))
                    {
                        codeVals = LoincSearch.GetConceptsByProperty(loincProperty, loincValue);
                    }
                    else if (!string.IsNullOrEmpty(code))
                    {
                        // returning Parameters Resource with False appears to be preferred to OperationOutcome failure
                        //if (!Utilities.IsDigitsOnly(code))
                        //{
                        //    throw new Exception(TerminologyValueSet.INVALID_CODE);
                        //}
                        if (termOp == TerminologyOperation.find_matches)
                        {
                            codeVals = LoincSearch.GetPropertiesByCode(code, "ALL");
                        }
                        else if (code.StartsWith("LP"))
                        {
                            codeVals = LoincSearch.GetConceptByPartCode(code);
                        }
                        else if (code.StartsWith("LA"))
                        {
                            codeVals = LoincSearch.GetConceptByAnswerStringId(code);
                        }
                        else
                        {
                            codeVals = LoincSearch.GetConceptByCode(code);
                        }
                    }
                    else if (!string.IsNullOrEmpty(filter))
                    {
                        if (filter.Length < 3)
                        {
                            throw new Exception(TerminologyValueSet.INVALID_FILTER);
                        }
                        codeVals = LoincSearch.GetConceptsByTerm(filter);
                    }
                    else // can't pass LOINC in its entirety!
                    {
                        throw new Exception(TerminologyValueSet.MISSING_FILTER);
                    }

                    if (codeVals.Count > 9999)
                    {
                        throw new Exception(TerminologyValueSet.MAX_VALUES_EXCEEDED);
                    }
                }

                // filtering performed at DB Layer, so add all returned concepts
                foreach (Coding codeVal in codeVals)
                {
                    if (useContext == "CONSUMER_NAME" && !string.IsNullOrEmpty(codeVal.System))
                    {
                        codeVal.Display = codeVal.Version;
                    }
                    cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                        Code = codeVal.Code, Display = codeVal.Display
                    });
                    es.Contains.Add(new ValueSet.ContainsComponent {
                        Code = codeVal.Code, Display = codeVal.Display, System = cs.System
                    });
                    this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                        Code = codeVal.Code, Display = codeVal.Display
                    });
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 10
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "intensional-case-2";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/intensional-case-2";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Intensional case #2";
            this.valueSet.Description  = new Markdown("All Snomed codes that are subsumed by 38341003 (Hypertensive disorder, systemic arterial)");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";
            this.valueSet.Copyright    = new Markdown("This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            cs.System  = FhirSnomed.URI;
            cs.Version = FhirSnomed.CURRENT_VERSION;
            cs.Filter.Add(new ValueSet.FilterComponent {
                Property = "concept", Op = FilterOperator.IsA, Value = "38341003"
            });

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if (string.IsNullOrEmpty(version) || version == cs.Version)
            {
                if (string.IsNullOrEmpty(version) || version == cs.Version)
                {
                    if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                    {
                        List <Coding> codeVals = new List <Coding>();
                        codeVals = SnomedCtSearch.GetSubsumedCodes("38341003", true);
                        ValueSet.ExpansionComponent es = new ValueSet.ExpansionComponent();
                        foreach (Coding codeVal in codeVals)
                        {
                            if (TerminologyValueSet.MatchValue(codeVal.Code, codeVal.Display, code, filter))
                            {
                                es.Contains.Add(new ValueSet.ContainsComponent {
                                    Code = codeVal.Code, Display = codeVal.Display, System = cs.System
                                });
                            }
                        }
                        this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                    }
                    else
                    {
                        this.valueSet.Compose = new ValueSet.ComposeComponent();
                        this.valueSet.Compose.Include.Add(cs);
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet     = new ValueSet();
            this.valueSet.Id  = "intensional-case-1";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/intensional-case-1";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Intensional case #1";
            this.valueSet.Description  = new Markdown("All loinc codes for system = Arterial system");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";
            this.valueSet.Copyright    = new Markdown("This content LOINC is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            cs.System  = FhirLoinc.URI;
            cs.Version = FhirLoinc.CURRENT_VERSION;
            cs.Filter.Add(new ValueSet.FilterComponent {
                Property = "SYSTEM", Op = FilterOperator.Equal, Value = "Arterial System"
            });

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if (string.IsNullOrEmpty(version) || version == cs.Version)
            {
                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    List <Coding> codeVals = new List <Coding>();
                    codeVals = LoincSearch.GetConceptsByProperty(cs.Filter[0].Property, cs.Filter[0].Value);
                    ValueSet.ExpansionComponent es = new ValueSet.ExpansionComponent();
                    foreach (Coding codeVal in codeVals)
                    {
                        if (TerminologyValueSet.MatchValue(codeVal.Code, codeVal.Display, code, filter))
                        {
                            es.Contains.Add(new ValueSet.ContainsComponent {
                                Code = codeVal.Code, Display = codeVal.Display, System = cs.System
                            });
                        }
                    }
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 12
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, string vsIdentifier, int offsetNo, int countNo)
        {
            this.GetVsProperties(vsIdentifier);

            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = this.vsId;
            this.codeSystem.Id = "NZMT";

            this.codeSystem.CaseSensitive = false;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.NotPresent;
            this.codeSystem.Experimental  = false;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            // Code System properties
            this.codeSystem.Property.Add(new CodeSystem.PropertyComponent {
                Code = "substance", Description = "The Generic Substance (Medicinal Product) & ingredient data relating to this Code.", Type = CodeSystem.PropertyType.Code
            });

            // there is no Value Set that contains the whole of NZMT
            //this.codeSystem.ValueSet = "http://nzmt.org.nz/vs";

            this.valueSet.Url   = this.vsURL;
            this.codeSystem.Url = NzMt.URI;

            this.valueSet.Title   = this.vsTitle;
            this.codeSystem.Title = NzMt.TITLE;

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown(this.vsDescription);
            this.codeSystem.Description = new Markdown(NzMt.DESCRIPTION);

            this.valueSet.Version   = NzMt.CURRENT_VERSION;
            this.codeSystem.Version = NzMt.CURRENT_VERSION;

            this.valueSet.Experimental = true;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "nzulm.org.nz";

            this.valueSet.Copyright   = new Markdown("© 2010+ New Zealand Crown Copyright");
            this.codeSystem.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);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            if (!string.IsNullOrEmpty(vsIdentifier))
            {
                cs.Filter.Add(new ValueSet.FilterComponent {
                    Property = "TermType", Op = FilterOperator.Equal, Value = vsIdentifier
                });
            }

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version) && termOp != TerminologyOperation.define_cs)
            {
                if (termOp != TerminologyOperation.define_vs)
                {
                    List <Coding> codeVals = new List <Coding>();

                    if (termOp == TerminologyOperation.lookup || termOp == TerminologyOperation.validate_code)
                    {
                        codeVals = NzUlmSearch.GetNzmtCombinedByCode(code);
                        if (codeVals.Count > 0 || termOp == TerminologyOperation.validate_code)
                        {
                            // create filter as need to subsequently check that it belongs in the passed Value Set
                            filter = codeVals[0].Display;
                        }
                    }

                    if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                    {
                        if (vsId.StartsWith("NZULM-PT-"))
                        {
                            codeVals = NzUlmSearch.GetNZULMPrescribingTerms(filter, vsId.Replace("NZULM-PT-", "").ToLower());
                        }
                        else if (vsId == "NZULM-CTPP")
                        {
                            codeVals = NzUlmSearch.GetContaineredTradeProductPackByTerm(filter);
                        }
                        else if (vsId == "NZULM-MP")
                        {
                            codeVals = NzUlmSearch.GetMedicinalProductByTerm(filter);
                        }
                        else if (vsId == "NZULM-MPP")
                        {
                            codeVals = NzUlmSearch.GetMedicinalProductPackByTerm(filter);
                        }
                        else if (vsId == "NZULM-MPUU")
                        {
                            codeVals = NzUlmSearch.GetMedicinalProductUnitOfUseByTerm(filter);
                        }
                        else if (vsId == "NZULM-TP")
                        {
                            codeVals = NzUlmSearch.GetTradeProductByTerm(filter);
                        }
                        else if (vsId == "NZULM-TPP")
                        {
                            codeVals = NzUlmSearch.GetTradeProductPackByTerm(filter);
                        }
                        else if (vsId == "NZULM-TPUU")
                        {
                            codeVals = NzUlmSearch.GetTradeProductUnitOfUseByTerm(filter);
                        }
                        else
                        {
                            throw new Exception(TerminologyValueSet.UNFOUND_VALUESET);
                        }
                    }

                    // filtering performed at DB Layer, so add all returned concepts
                    foreach (Coding codeVal in codeVals)
                    {
                        ValueSet.DesignationComponent desig = new ValueSet.DesignationComponent {
                            ElementId = "NZULM", Value = codeVal.Version
                        };
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Code, Display = codeVal.Display
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Code, Display = codeVal.Display, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Code, Display = codeVal.Display, Definition = codeVal.Version, ElementId = codeVal.ElementId
                        });
                    }

                    if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                    {
                        this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                    }
                    else if (termOp == TerminologyOperation.define_vs)
                    {
                        this.valueSet.Compose = new ValueSet.ComposeComponent();
                        this.valueSet.Compose.Include.Add(cs);
                    }
                }
                else
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
Exemplo n.º 13
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, string vsIdentifier, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            string idSuffix = filter.Replace(" ", "_");

            this.valueSet.Id   = "fhir_rxnorm_vs_" + idSuffix;
            this.codeSystem.Id = "RXNORM";

            this.codeSystem.CaseSensitive = false;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.NotPresent;
            this.codeSystem.Experimental  = false;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            // Code System properties
            //this.codeSystem.Property.Add(new CodeSystem.PropertyComponent { Code = "substance", Description = "The Generic Substance (Medicinal Product) & ingredient data relating to this Code.", Type = CodeSystem.PropertyType.Code });

            // Value Set that contains all RxNorm CUIs
            this.codeSystem.ValueSet = "http://www.nlm.nih.gov/research/umls/rxnorm/vs";

            this.valueSet.Url   = ServerCapability.TERMINZ_CANONICAL + "/ValueSet/rxnorm/" + idSuffix;
            this.codeSystem.Url = FhirRxNorm.URI;

            this.valueSet.Title   = FhirRxNorm.TITLE;
            this.codeSystem.Title = FhirRxNorm.TITLE;

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown(FhirRxNorm.DESCRIPTION);
            this.codeSystem.Description = new Markdown(FhirRxNorm.DESCRIPTION);

            this.valueSet.Version   = FhirRxNorm.CURRENT_VERSION;
            this.codeSystem.Version = FhirRxNorm.CURRENT_VERSION;

            this.valueSet.Experimental = true;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Active;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "http://www.nlm.nih.gov/";

            this.valueSet.Copyright   = new Markdown("Unified Medical Language System® (UMLS®)");
            this.codeSystem.Copyright = new Markdown("Unified Medical Language System® (UMLS®)");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            //if (!string.IsNullOrEmpty(vsIdentifier))
            //{
            //    cs.Filter.Add(new ValueSet.FilterComponent { Property = "TTY", Op = FilterOperator.Equal, Value = vsIdentifier });
            //}

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version) && termOp != TerminologyOperation.define_cs)
            {
                if (termOp != TerminologyOperation.define_vs)
                {
                    List <Coding> codeVals = new List <Coding>();

                    if (termOp == TerminologyOperation.lookup || termOp == TerminologyOperation.validate_code)
                    {
                        codeVals = RxNormSearch.GetConceptByCode(code);
                        if (codeVals.Count > 0 || termOp == TerminologyOperation.validate_code)
                        {
                            // create filter as need to subsequently check that it belongs in the passed Value Set
                            filter = codeVals[0].Display;
                        }
                    }

                    if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                    {
                        codeVals = RxNormSearch.GetConceptsByTerm(filter);
                    }

                    // filtering performed at DB Layer, so add all returned concepts
                    foreach (Coding codeVal in codeVals)
                    {
                        ValueSet.DesignationComponent desig = new ValueSet.DesignationComponent {
                            ElementId = "RXNORM", Value = codeVal.Version
                        };
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Code, Display = codeVal.Display
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Code, Display = codeVal.Display, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Code, Display = codeVal.Display, Definition = codeVal.Version, ElementId = codeVal.ElementId
                        });
                    }

                    if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                    {
                        this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                    }
                    else if (termOp == TerminologyOperation.define_vs)
                    {
                        this.valueSet.Compose = new ValueSet.ComposeComponent();
                        this.valueSet.Compose.Include.Add(cs);
                    }
                }
                else
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            filter = EclHandler.EclExpressionFormatter("390802008|Goal achieved| OR << 390801001|Goal not achieved|");

            this.valueSet = new ValueSet();

            this.valueSet.Id  = "SctIntensionalExpressionTest";
            this.valueSet.Url = ServerCapability.TERMINZ_CANONICAL + "ValueSet/SctIntensionalExpressionTest";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "SCT Intensional Expression Test";
            this.valueSet.Description  = new Markdown("Test for creating Intensional Value Sets filtered by SCT Expression Constraints");
            this.valueSet.Version      = "1.0.1";
            this.valueSet.Status       = PublicationStatus.Draft;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Peter Jordan";
            this.valueSet.Copyright    = new Markdown("This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            cs.System  = FhirSnomed.URI;
            cs.Version = FhirSnomed.CURRENT_VERSION;
            cs.Filter.Add(new ValueSet.FilterComponent {
                Property = "constraint", Op = FilterOperator.Equal, Value = filter
            });

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if (string.IsNullOrEmpty(version) || version == cs.Version)
            {
                if (string.IsNullOrEmpty(version) || version == cs.Version)
                {
                    if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                    {
                        List <Coding> codeVals = new List <Coding>();
                        codeVals = EclHandler.ExecuteEclQuery(filter);
                        ValueSet.ExpansionComponent es = new ValueSet.ExpansionComponent();
                        foreach (Coding codeVal in codeVals)
                        {
                            es.Contains.Add(new ValueSet.ContainsComponent {
                                Code = codeVal.Code, Display = codeVal.Display, System = cs.System
                            });
                        }
                        this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                    }
                    else
                    {
                        this.valueSet.Compose = new ValueSet.ComposeComponent();
                        this.valueSet.Compose.Include.Add(cs);
                    }
                }
            }
        }