Ejemplo n.º 1
0
        public void CreateFixPropertiesTest()
        {
            List <FHIRProperty> fixedProperties = new List <FHIRProperty>();
            var o = FHIRTranslator.CreateInstance("Hl7.Fhir.Model.Observation");

            fixedProperties.Add(new FHIRProperty()
            {
                ResourcePath      = "Code/Text",
                Value             = "Test",
                ResourcePathTypes = "CodeableConcept/String"
            });
            FHIRParser.CreateFixProperties(o, fixedProperties);

            Assert.AreEqual((o as Observation).Code.Text, "Test");
        }
Ejemplo n.º 2
0
        public void Parse_Test1()
        {
            FHIRParser parser       = new FHIRParser();
            var        propMapping1 = new FHIRPropertyMapping()
            {
                ColumnIndex       = 1,
                ResourceId        = "001001",
                ResourceBaseType  = "Observation",
                ResourcePath      = "Observation/Value/Value",
                ResourcePathTypes = "Observation/SimpleQuantity/Decimal",
                FixedProperties   = new List <FHIRProperty>()
                {
                    new FHIRProperty()
                    {
                        ResourcePath      = "Observation/Code/Text",
                        ResourcePathTypes = "Observation/CodeableConcept/String",
                        Value             = "Code1"
                    },
                    new FHIRProperty()
                    {
                        ResourcePath      = "Observation/Issued",
                        ResourcePathTypes = "Observation/DateTimeOffset",
                        Value             = "GETDATE"
                    }
                }
            };



            parser.Parse(null, "001", propMapping1, new CSVRow()
            {
                new CSVColumn()
                {
                    ColumnIndex = 1, Value = "1"
                }
            });

            var res = parser.GetResource("001001001");

            Assert.IsNotNull(res);

            Assert.AreEqual(((res as Observation).Value as SimpleQuantity).Value, 1);
        }
Ejemplo n.º 3
0
        public void FHIRDataset_Test1()
        {
            var           mapping = CreateTestMapping();
            DummFHIRStore store   = new DummFHIRStore();
            var           file    = @".\TestData\data.csv";
            var           parser  = new FHIRParser(store);

            var dataset = CSVLoader.LoadCSV(file, true, ',');

            parser.Parse(mapping, dataset);
            parser.Flush();

            var resource = parser.GetResource("00126030000001001");

            Assert.IsNotNull(resource);
            Assert.IsTrue(resource is ResearchSubject);

            store.SaveJson("test.json");


            mapping.ToJson("mapping.json");
        }