Exemplo n.º 1
0
        protected override async Task OnInitializedAsync()
        {
            Patients = await ImportTestHelper.ImportToServerAsync <Patient>(
                TestFhirClient,
                CloudStorageAccount,
                p => SetPatientInfo(p, "Seattle", "Smith", given: "Bea"),
                p => SetPatientInfo(p, "Portland", "Williams"),
                p => SetPatientInfo(p, "Vancouver", "Anderson"),
                p => SetPatientInfo(p, LongString, "Murphy"),
                p => SetPatientInfo(p, "Montreal", "Richard", given: "Bea"),
                p => SetPatientInfo(p, "New York", "Muller"),
                p => SetPatientInfo(p, "Portland", "Müller"),
                p => SetPatientInfo(p, "Moscow", "Richard,Muller"));

            void SetPatientInfo(Patient patient, string city, string family, string given = null)
            {
                patient.Address = new List <Address>()
                {
                    new Address {
                        City = city
                    },
                };

                patient.Name = new List <HumanName>()
                {
                    new HumanName {
                        Family = family, Given = new[] { given }
                    },
                };

                patient.AddTestTag(FixtureTag);
            }
        }
Exemplo n.º 2
0
 protected override async Task OnInitializedAsync()
 {
     await ImportTestHelper.ImportToServerAsync(
         TestFhirClient,
         CloudStorageAccount,
         PatientAddressCityAndFamily.AddTestTag(FixtureTag),
         PatientWithSameCity1.AddTestTag(FixtureTag),
         PatientWithSameCity2.AddTestTag(FixtureTag),
         PatientWithGender.AddTestTag(FixtureTag));
 }
Exemplo n.º 3
0
        protected override async Task OnInitializedAsync()
        {
            await TestFhirClient.CreateResourcesAsync <Patient>(p =>
            {
                p.AddTestTag(FixtureTag);
            });

            Observations = await ImportTestHelper.ImportToServerAsync <Observation>(
                TestFhirClient,
                CloudStorageAccount,
                o => SetObservation(o, cc => cc.Coding.Add(new Coding("system1", "code1"))),
                o => SetObservation(o, cc => cc.Coding.Add(new Coding("system2", "code2"))),
                o => SetObservation(o, cc => cc.Text = "text"),
                o => SetObservation(o, cc => cc.Coding.Add(new Coding("system1", "code2", "text2"))),
                o => SetObservation(o, cc => cc.Coding.Add(new Coding("system3", "code3", "text"))),
                o => SetObservation(o, cc =>
            {
                cc.Text = "text";
                cc.Coding.Add(new Coding("system1", "code1"));
                cc.Coding.Add(new Coding("system3", "code2"));
            }),
                o => SetObservation(o, cc =>
            {
                cc.Coding.Add(new Coding("system2", "code1"));
                cc.Coding.Add(new Coding("system3", "code3", "text2"));
            }),
                o => SetObservation(o, cc => cc.Coding.Add(new Coding(null, "code3"))),
                o =>
            {
                SetObservation(o, cc => { });
                o.Category = new List <CodeableConcept>
                {
                    new CodeableConcept("system", "test"),
                };
            });

            void SetObservation(Observation observation, Action <CodeableConcept> codeableConceptCustomizer)
            {
                observation.AddTestTag(FixtureTag);
                observation.Code   = new CodeableConcept("system", "code");
                observation.Status = ObservationStatus.Registered;

                var codeableConcept = new CodeableConcept();

                codeableConceptCustomizer(codeableConcept);

                observation.Value = codeableConcept;
            }
        }
 protected override async Task OnInitializedAsync()
 {
     Patients = await ImportTestHelper.ImportToServerAsync <Patient>(
         TestFhirClient,
         CloudStorageAccount,
         p => p.AddTestTag(FixtureTag).ManagingOrganization = new ResourceReference("Organization/123"),
         p => p.AddTestTag(FixtureTag).ManagingOrganization = new ResourceReference("Organization/abc"),
         p => p.AddTestTag(FixtureTag).ManagingOrganization = new ResourceReference("ijk"), // type not specified, but known constrained to be Organization
         p => p.AddTestTag(FixtureTag).GeneralPractitioner  = new List <ResourceReference> {
         new ResourceReference("Practitioner/p1")
     },
         p => p.AddTestTag(FixtureTag).GeneralPractitioner = new List <ResourceReference> {
         new ResourceReference("p2")
     });                                                                                                                   // type not specified and not known because it could be Practitioner, Organization, or PractitionerRole
 }
        protected override async Task OnInitializedAsync()
        {
            Observations       = CreateResultDictionary <Observation>(ObservationTestFileNames);
            DocumentReferences = CreateResultDictionary <DocumentReference>(DocumentReferenceTestFiles);

            List <Resource> resources = new List <Resource>();

            resources.AddRange(Observations.Values);
            resources.AddRange(DocumentReferences.Values);

            await ImportTestHelper.ImportToServerAsync(
                TestFhirClient,
                CloudStorageAccount,
                resources.ToArray());
        }
        protected override async Task OnInitializedAsync()
        {
            FixtureTag = Guid.NewGuid().ToString();

            ValueSets = await ImportTestHelper.ImportToServerAsync <ValueSet>(
                TestFhirClient,
                CloudStorageAccount,
                vs => AddValueSet(vs, "http://somewhere.com/test/system"),
                vs => AddValueSet(vs, "urn://localhost/test"),
                vs => AddValueSet(vs, "http://example.org/rdf#54135-9"),
                vs => AddValueSet(vs, "http://example.org/rdf#54135-9-9"));

            void AddValueSet(ValueSet vs, string url)
            {
                vs.Status = PublicationStatus.Active;
                vs.Url    = url;
                vs.AddTestTag(FixtureTag);
            }
        }
Exemplo n.º 7
0
        protected override async Task OnInitializedAsync()
        {
            Observations = await ImportTestHelper.ImportToServerAsync <Observation>(
                TestFhirClient,
                CloudStorageAccount,
                p => SetObservation(p, "1979-12-31"),              // 1979-12-31T00:00:00.0000000 <-> 1979-12-31T23:59:59.9999999
                p => SetObservation(p, "1980"),                    // 1980-01-01T00:00:00.0000000 <-> 1980-12-31T23:59:59.9999999
                p => SetObservation(p, "1980-05"),                 // 1980-05-01T00:00:00.0000000 <-> 1980-05-31T23:59:59.9999999
                p => SetObservation(p, "1980-05-11"),              // 1980-05-11T00:00:00.0000000 <-> 1980-05-11T23:59:59.9999999
                p => SetObservation(p, "1980-05-11T16:32:15"),     // 1980-05-11T16:32:15.0000000 <-> 1980-05-11T16:32:15.9999999
                p => SetObservation(p, "1980-05-11T16:32:15.500"), // 1980-05-11T16:32:15.5000000 <-> 1980-05-11T16:32:15.5000000
                p => SetObservation(p, "1981-01-01"));             // 1981-01-01T00:00:00.0000000 <-> 1981-12-31T23:59:59.9999999

            void SetObservation(Observation observation, string date)
            {
                observation.Status = ObservationStatus.Final;
                observation.AddTestTag(FixtureTag);
                observation.Effective = new FhirDateTime(date);
            }
        }
        protected override async Task OnInitializedAsync()
        {
            Observations = await ImportTestHelper.ImportToServerAsync <Observation>(
                TestFhirClient,
                CloudStorageAccount,
                o => SetObservation(o, 0.002m, "unit1", "system1"),
                o => SetObservation(o, 1.0m, "unit1", "system1"),
                o => SetObservation(o, 3.12m, "unit1", "system2"),
                o => SetObservation(o, 4.0m, "unit1", "system1"),
                o => SetObservation(o, 5.0m, "unit1", "system1"),
                o => SetObservation(o, 5.0m, "unit2", "system2"),
                o => SetObservation(o, 6.0m, "unit2", "system2"),
                o => SetObservation(o, 8.95m, "unit2", "system1"),
                o => SetObservation(o, 10.0m, "unit1", "system1"));

            void SetObservation(Observation observation, decimal quantity, string unit, string system)
            {
                observation.Code   = new CodeableConcept("system", "code");
                observation.Status = ObservationStatus.Registered;
                observation.AddTestTag(FixtureTag);
                observation.Value = new Quantity(quantity, unit, system);
            }
        }
        protected override async Task OnInitializedAsync()
        {
            RiskAssessments = await ImportTestHelper.ImportToServerAsync <RiskAssessment>(
                TestFhirClient,
                CloudStorageAccount,
                i => SetRiskAssessment(i, 1),
                i => SetRiskAssessment(i, 4),
                i => SetRiskAssessment(i, 5),
                i => SetRiskAssessment(i, 6),
                i => SetRiskAssessment(i, 100));

            void SetRiskAssessment(RiskAssessment riskAssessment, int probability)
            {
                riskAssessment.Status  = ObservationStatus.Final;
                riskAssessment.Subject = new ResourceReference("Patient/123");
                riskAssessment.AddTestTag(FixtureTag);
                riskAssessment.Prediction = new List <RiskAssessment.PredictionComponent>
                {
                    new RiskAssessment.PredictionComponent {
                        Probability = new FhirDecimal(probability)
                    },
                };
            }
        }