public void InvokeExpandExistingValueSet()
 {
     var client = new FhirClient(testEndpoint);
     var vs = client.ExpandValueSet(ResourceIdentity.Build("ValueSet","administrative-gender"));
     
     Assert.IsTrue(vs.Expansion.Contains.Any());
 }
Beispiel #2
0
        public void InvokeExpandExistingValueSet()
        {
            var client = new FhirClient(FhirClientTests.TerminologyEndpoint);
            var vs     = client.ExpandValueSet(ResourceIdentity.Build("ValueSet", "administrative-gender"));

            Assert.IsTrue(vs.Expansion.Contains.Any());
        }
Beispiel #3
0
        public void InvokeExpandParameterValueSet()
        {
            var client = new FhirClient(FhirClientTests.TerminologyEndpoint);

            var vs  = client.Read <ValueSet>("ValueSet/administrative-gender");
            var vsX = client.ExpandValueSet(vs);

            Assert.IsTrue(vsX.Expansion.Contains.Any());
        }
        public void InvokeExpandParameterValueSet()
        {
            var client = new FhirClient(testEndpoint);

            var vs = client.Read<ValueSet>("ValueSet/administrative-gender");

            var vsX = client.ExpandValueSet(vs);

            Assert.IsTrue(vs.Expansion.Contains.Any());
        }
Beispiel #5
0
        public void InvokeExpandParameterValueSet()
        {
            var client = new FhirClient(testEndpoint);

            var vs = client.Read <ValueSet>("ValueSet/101");

            var vsX = client.ExpandValueSet(vs);

            Assert.IsTrue(vs.Expansion.Contains.Any());
        }
Beispiel #6
0
        private List <string> GenerateDrugFilter()
        {
            var          ecl         = textBox2.Text;
            const string Endpoint    = "https://ontoserver.csiro.au/stu3-latest";
            string       ValueSetURL = "http://snomed.info/sct?fhir_vs=ecl/" + ecl;

            //ExpandECL for Box2
            var client = new FhirClient(Endpoint);
            var url    = new FhirUri(ValueSetURL);
            var result = client.ExpandValueSet(url);

            var ids = new List <string>();

            foreach (var item in result.Expansion.Contains)
            {
                ids.Add(item.Code);
            }

            var translations = new List <string>();

            foreach (var id in ids)
            {
                //Reverse Translate
                var revsertTranslateParameters = new Parameters
                {
                    Parameter = new List <Parameters.ParameterComponent>
                    {
                        new Parameters.ParameterComponent
                        {
                            Name  = "url",
                            Value = new FhirUri("http://snomed.info/sct?fhir_cm=281000036105")
                        },
                        new Parameters.ParameterComponent
                        {
                            Name  = "system",
                            Value = new FhirUri("http://snomed.info/sct")
                        },
                        new Parameters.ParameterComponent
                        {
                            Name  = "code",
                            Value = new FhirString(id)
                        },
                        new Parameters.ParameterComponent
                        {
                            Name  = "target",
                            Value = new FhirUri("http://snomed.info/sct")
                        },
                        new Parameters.ParameterComponent
                        {
                            Name  = "reverse",
                            Value = new FhirBoolean(true)
                        }
                    }
                };


                var transResult = (Parameters)client.TypeOperation <ConceptMap>("translate", revsertTranslateParameters);
                //if there's a map
                //if (transResult.Parameter[0].Value.Equals("true"))
                //{
                foreach (var match in transResult.Parameter.Where <Parameters.ParameterComponent>(e => e.Name == "match"))
                {
                    //var coding = match.Part.Where<Parameters.ParameterComponent>(e => e.Name == "concept");
                    //This workds
                    //var coding1 = match.Part[1].Value;
                    var valueCoding = match.Part.Where <Parameters.ParameterComponent>(p => p.Name.Equals("concept")).FirstOrDefault();

                    var coding = (Coding)valueCoding.Value;

                    translations.Add(coding.Code);
                }
                //}
            }

            //Expand the AMT ingredients
            string AMT_ecl = "http://snomed.info/sct?fhir_vs=ecl/<<30425011000036101:<<762951001=(";


            foreach (var item in translations)
            {
                AMT_ecl = AMT_ecl + item + " OR ";
            }
            //close the expression
            AMT_ecl = AMT_ecl + "123456 OR 123456)";

            var AMT_url = new FhirUri(AMT_ecl);
            var AMTs    = client.ExpandValueSet(AMT_url);

            var filtered = new List <string>();

            foreach (var item in AMTs.Expansion.Contains)
            {
                filtered.Add(item.Code);
            }


            return(filtered);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var client = new FhirClient(Endpoint);
            //var filter = new FhirString("inr");
            var url    = new FhirUri(ValueSetURL);
            var result = client.ExpandValueSet(url);

            Console.WriteLine(result.Expansion.Total + " results total");
            Console.WriteLine(result.Expansion.Contains.FirstOrDefault().Display);

            //var dict = VStoDictionary(result);


            Console.WriteLine("Let's try translate!");
            #region TRANSLATE
            var revsertTranslateParameters = new Parameters
            {
                Parameter = new List <Parameters.ParameterComponent>
                {
                    new Parameters.ParameterComponent
                    {
                        Name  = "url",
                        Value = new FhirUri("http://snomed.info/sct?fhir_cm=281000036105")
                    },
                    new Parameters.ParameterComponent
                    {
                        Name  = "system",
                        Value = new FhirUri("http://snomed.info/sct")
                    },
                    new Parameters.ParameterComponent
                    {
                        Name  = "code",
                        Value = new FhirString("419442005")
                    },
                    new Parameters.ParameterComponent
                    {
                        Name  = "target",
                        Value = new FhirUri("http://snomed.info/sct")
                    },
                    new Parameters.ParameterComponent
                    {
                        Name  = "reverse",
                        Value = new FhirBoolean(true)
                    }
                }
            };

            var transResult = (Parameters)client.TypeOperation <ConceptMap>("translate", revsertTranslateParameters);

            //
            Console.WriteLine(transResult.Parameter.First().Name + " : " + transResult.Parameter.First().Value.ToString());

            foreach (var match in transResult.Parameter.Where <Parameters.ParameterComponent>(e => e.Name == "match"))
            {
                //var coding = match.Part.Where<Parameters.ParameterComponent>(e => e.Name == "concept");
                //This workds
                //var coding1 = match.Part[1].Value;
                var valueCoding = match.Part.Where <Parameters.ParameterComponent>(p => p.Name.Equals("concept")).FirstOrDefault();

                var coding = (Coding)valueCoding.Value;

                Console.WriteLine(coding.Code + " " + coding.Display);
            }
            #endregion TRANSLATE

            #region search
            var substanceECL    = "http://snomed.info/sct?fhir_vs=ecl/<<105590001";
            var resultSizeLimit = 5;
            var searchFilter    = "morphi";


            var Newresult = client.ExpandValueSet(new FhirUri(substanceECL), new FhirString(searchFilter));

            var x = Newresult.Expansion.Contains;
            foreach (var item in x)
            {
                Console.WriteLine(item.Code + " | " + item.Display);
            }


            #endregion search

            Console.WriteLine("Done");



            Console.ReadKey();
        }