Ejemplo n.º 1
0
        public void TestFhirUpdate()
        {
            ResourceIdentity identity1 = ResourceIdentity.Build("Observation", "2");
            ResourceIdentity identity2 = ResourceIdentity.Build("Observation", "3");

            Observation observation1 = fhirClient.Read <Observation>(identity1);

            observation1.Status = Observation.ObservationStatus.Amended;
            Observation observation2 = fhirClient.Read <Observation>(identity2);

            observation2.Device = new ResourceReference()
            {
                Reference = "Device/4"
            };

            var observation1Entry = fhirClient.Update(observation1);
            var observation2Entry = fhirClient.Update(observation2);

            observation1 = fhirClient.Read <Observation>(identity1);
            observation2 = fhirClient.Read <Observation>(identity2);

            Assert.AreEqual("2", observation1Entry.Id);
            Assert.AreEqual("3", observation2Entry.Id);
            Assert.AreEqual(Observation.ObservationStatus.Amended, observation1Entry.Status);
            Assert.AreEqual("Device/4", observation2Entry.Device.Reference);
            Assert.AreEqual(Observation.ObservationStatus.Amended, observation1Entry.Status);
            Assert.AreEqual("Device/4", observation2Entry.Device.Reference);
            Assert.AreEqual("2", observation1Entry.Meta.VersionId);
            Assert.AreEqual("2", observation2Entry.Meta.VersionId);
        }
        public void TestFhirUpdate()
        {
            ResourceIdentity identity1 = ResourceIdentity.Build("Device", "2");
            ResourceIdentity identity2 = ResourceIdentity.Build("Device", "3");

            Device device1 = fhirClient.Read <Device>(identity1);

            device1.Manufacturer = "Test Industries";
            Device device2 = fhirClient.Read <Device>(identity2);

            device2.Manufacturer = "Test Corp";

            var device1Entry = fhirClient.Update(device1);
            var device2Entry = fhirClient.Update(device2);

            device1 = fhirClient.Read <Device>(identity1);
            device2 = fhirClient.Read <Device>(identity2);

            Assert.AreEqual("2", device1Entry.Id);
            Assert.AreEqual("3", device2Entry.Id);
            Assert.AreEqual("Test Industries", device1Entry.Manufacturer);
            Assert.AreEqual("Test Corp", device2Entry.Manufacturer);
            Assert.AreEqual("Test Industries", device1.Manufacturer);
            Assert.AreEqual("Test Corp", device2.Manufacturer);
            Assert.AreEqual("2", device1Entry.Meta.VersionId);
            Assert.AreEqual("2", device2Entry.Meta.VersionId);
        }
        public void TestFhirUpdate()
        {
            ResourceIdentity identity1 = ResourceIdentity.Build("Patient", "2");
            ResourceIdentity identity2 = ResourceIdentity.Build("Patient", "3");

            Patient patient1 = fhirClient.Read <Patient>(identity1);

            patient1.Gender = AdministrativeGender.Other;
            Patient patient2 = fhirClient.Read <Patient>(identity2);

            patient2.Address = new List <Address>();
            patient2.Active  = false;

            var patient1Entry = fhirClient.Update(patient1);
            var patient2Entry = fhirClient.Update(patient2);

            patient1 = fhirClient.Read <Patient>(identity1);
            patient2 = fhirClient.Read <Patient>(identity2);

            Assert.AreEqual("2", patient1Entry.Id);
            Assert.AreEqual("3", patient2Entry.Id);
            Assert.AreEqual(AdministrativeGender.Other, patient1Entry.Gender);
            Assert.AreEqual(false, patient2.Active);
            Assert.AreEqual(AdministrativeGender.Other, patient1.Gender);
            Assert.AreEqual(false, patient2Entry.Active);
            Assert.AreEqual("2", patient1Entry.Meta.VersionId);
            Assert.AreEqual("2", patient2Entry.Meta.VersionId);
        }
Ejemplo n.º 4
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            string id     = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
            string column = dataGridView1.Columns[e.ColumnIndex].Name.ToString();
            string value  = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();

            switch (e.ColumnIndex)
            {
            case 1:
                FhirDateTime dt = new FhirDateTime(value);
                data[e.RowIndex].Effective = dt;
                _client.Update <Observation>(data[e.RowIndex]);

                //db.updateEffective(dt,ob);
                break;

            case 2:
                Code c = new Code(value);
                Hl7.Fhir.Model.ObservationStatus os = new Hl7.Fhir.Model.ObservationStatus();
                // data[e.RowIndex].Status = c;
                break;

            case 3:
                CodeableConcept cc = new CodeableConcept();
                cc.Text = value;
                data[e.RowIndex].Interpretation = cc;
                _client.Update <Observation>(data[e.RowIndex]);
                break;
            }
            Console.WriteLine(value);
        }
        public void WhenResourceUpdated()
        {
            var createdModel = _fhirClient.Create(_observation);

            createdModel.Text = new Narrative();

            var domainResource = _fhirClient.Update(createdModel);

            Assert.NotNull(domainResource.Text);
        }
        public void WhenHistoryReadForParticularResource_ThenAllVersionsReturned()
        {
            var createdModelOnTheServer = _fhirClient.Create(_resource);

            createdModelOnTheServer.Comment = "This is an update to the observation";
            createdModelOnTheServer         = _fhirClient.Update(createdModelOnTheServer);
            var historyResults = _fhirClient.History($"Observation/{createdModelOnTheServer.Id}");

            Assert.NotNull(historyResults);
            Assert.Equal(2, historyResults.Entry.Count);
            AssertHelper.CheckStatusCode(HttpStatusCode.OK, _fhirClient.LastResult.Status);
        }
Ejemplo n.º 7
0
        public void UpdateProcedureByProcedureId(string Id)
        {
            var labRequest = GetLabRequestById(Id);

            labRequest.Status = RequestStatus.Completed;
            var result = FhirClientObj.Update <ProcedureRequest>(labRequest);
        }
Ejemplo n.º 8
0
        public ActionResult <string> UpdatePatient()
        {
            FhirClient fhirClient      = _client.ConfigureBasicClient("http://fhir.hl7fundamentals.org/r4/");
            Resource   patientResource = fhirClient.Update(_fhirServices.CreatePatient());

            return(Ok(patientResource.ToJson()));
        }
Ejemplo n.º 9
0
        public static Patient UpdatePatientBirthDate(Patient patient, DateTime birthDate)
        {
            Patient responsePatient = new Patient();

            patient.BirthDate = birthDate.ToFhirDate();

            try
            {
                LogToFile("Update Patient");

                LogToFile("Request: ");
                var patientXml = FhirSerializer.SerializeResourceToXml(patient);
                LogToFile(XDocument.Parse(patientXml).ToString());

                FhirClient fhirClient = new FhirClient(FhirClientEndPoint);
                responsePatient = fhirClient.Update(patient);

                LogToFile("Response: ");
                var responsePatientXml = FhirSerializer.SerializeResourceToXml(responsePatient);
                LogToFile(XDocument.Parse(responsePatientXml).ToString());
            }
            catch (Exception ex)
            {
                LogToFile(ex.ToString());
            }

            return(responsePatient);
        }
Ejemplo n.º 10
0
        public ActionResult EditObservation([Bind] EditObservation observation, string patientID)        //TODO: czy tu nie trzeba exclude czasem?
        {
            bool   status  = false;
            string Message = "";

            //SPRAWDZENIE MODELU
            if (ModelState.IsValid)
            {
                //PODŁĄCZENIE DO KLIENTA
                var client = new FhirClient("http://localhost:8080/baseR4");
                client.PreferredFormat = ResourceFormat.Json;

                //PRZEKAZANIE DANYCH
                Observation original = client.Read <Observation>("Observation/" + observation.ID);
                original.Code.Text = observation.Reason;
                original.Status    = observation.Status;


                //UPDATE
                client.Update(original);
                Message = "Your item successfully UPDATE";
                status  = true;
            }
            else
            {
                Message = "You haven't got right model";
            }

            ViewBag.ID      = patientID;
            ViewBag.Status  = status;
            ViewBag.Message = Message;
            return(View(observation));
        }
Ejemplo n.º 11
0
        public ActionResult EditMedicationRequest([Bind] EditMedicationRequest request, string patientID)
        {
            bool   status  = false;
            string Message = "";

            //SPRAWDZENIE DANYCH
            if (ModelState.IsValid)
            {
                //PODŁĄCZENIE KLIENTA
                var client = new FhirClient("http://localhost:8080/baseR4");
                client.PreferredFormat = ResourceFormat.Json;

                //PRZEKAZANIE DANYCH
                MedicationRequest original = client.Read <MedicationRequest>("MedicationRequest/" + request.ID);
                (original.Medication as CodeableConcept).Text = request.Reason;
                Dosage dosage = new Dosage();
                dosage.Text = request.Instruction;
                original.DosageInstruction.Add(dosage);

                //UPDATE
                client.Update(original);
                Message = "Your item successfully UPDATE";
                status  = true;
            }
            else
            {
                Message = "You haven't got right model";
            }

            ViewBag.ID      = patientID;
            ViewBag.Status  = status;
            ViewBag.Message = Message;
            return(View(request));
        }
Ejemplo n.º 12
0
        public void CreateEditDelete()
        {
            FhirClient client = new FhirClient(testEndpoint);

            client.OnBeforeRequest += Compression_OnBeforeRequestZipOrDeflate;
            // client.CompressRequestBody = true;

            var pat = client.Read <Patient>("Patient/example");

            pat.Id = null;
            pat.Identifier.Clear();
            pat.Identifier.Add(new Identifier("http://hl7.org/test/2", "99999"));

            var fe = client.Create(pat); // Create as we are not providing the ID to be used.

            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);

            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read <Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch (FhirOperationException ex)
            {
                Assert.AreEqual(HttpStatusCode.Gone, ex.Status); //"410"
            }
        }
Ejemplo n.º 13
0
        public void CreateEditDelete()
        {
            var furore = new Organization
            {
                Name       = "Furore",
                Identifier = new List <Identifier> {
                    new Identifier("http://hl7.org/test/1", "3141")
                },
                Telecom = new List <Contact> {
                    new Contact {
                        System = Contact.ContactSystem.Phone, Value = "+31-20-3467171"
                    }
                }
            };

            FhirClient client = new FhirClient(testEndpoint);
            var        tags   = new List <Tag> {
                new Tag("http://nu.nl/testname", "TestCreateEditDelete")
            };

            var fe = client.Create(furore, tags);

            Assert.IsNotNull(furore);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.SelfLink);
            Assert.AreNotEqual(fe.Id, fe.SelfLink);
            Assert.IsNotNull(fe.Tags);
            Assert.AreEqual(1, fe.Tags.Count());
            Assert.AreEqual(fe.Tags.First(), tags[0]);
            createdTestOrganization = fe.Id;

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));

            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
            Assert.IsNotNull(fe2.Tags);
            Assert.AreEqual(1, fe2.Tags.Count());
            Assert.AreEqual(fe2.Tags.First(), tags[0]);

            client.Delete(fe2.Id);

            try
            {
                fe = client.Read <Organization>(ResourceLocation.GetIdFromResourceId(fe.Id));
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
            }

            Assert.IsNull(fe);
        }
Ejemplo n.º 14
0
        public void CreateEditDelete()
        {
            var pat = (Patient)FhirParser.ParseResourceFromXml(File.ReadAllText(@"TestData\TestPatient.xml"));
            var key = new Random().Next();

            pat.Id = "NetApiCRUDTestPatient" + key;

            FhirClient client = new FhirClient(testEndpoint);

            var fe = client.Create(pat);

            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);

            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read <Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResult.Status == HttpStatusCode.Gone.ToString());
            }
        }
Ejemplo n.º 15
0
        public void CreateEditDelete()
        {
            FhirClient client = new FhirClient(testEndpoint);
            var        pat    = client.Read <Patient>("Patient/example");

            pat.Id = null;
            pat.Identifier.Clear();
            pat.Identifier.Add(new Identifier("http://hl7.org/test/2", "99999"));

            var fe = client.Create(pat); // Create as we are not providing the ID to be used.

            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);

            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read <Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch
            {
                Assert.AreEqual("410", client.LastResult.Status);
            }
        }
Ejemplo n.º 16
0
        public void TestSearchByPersonaCode()
        {
            var client = new FhirClient(testEndpoint);

            var pats =
                client.Search <Patient>(
                    new[] { string.Format("identifier={0}|{1}", "http://hl7.org/fhir/sid/us-ssn", "444222222") });
            var pat = (Patient)pats.Entry.First().Resource;

            client.Update <Patient>(pat);
        }
Ejemplo n.º 17
0
        public void ClientForPPT()
        {
            var client = new FhirClient(new Uri("http://hl7connect.healthintersections.com.au/svc/fhir/patient/"));

            // Note patient is a ResourceEntry<Patient>, not a Patient
            var patEntry = client.Read<Patient>("1");
            var pat = patEntry.Resource;

            pat.Name.Add(HumanName.ForFamily("Kramer").WithGiven("Ewout"));

            client.Update<Patient>(patEntry);
        }
Ejemplo n.º 18
0
        public void ClientForPPT()
        {
            var client = new FhirClient(new Uri("http://hl7connect.healthintersections.com.au/svc/fhir/patient/"));

            // Note patient is a ResourceEntry<Patient>, not a Patient
            var patEntry = client.Read <Patient>("1");
            var pat      = patEntry.Resource;

            pat.Name.Add(HumanName.ForFamily("Kramer").WithGiven("Ewout"));

            client.Update <Patient>(patEntry);
        }
Ejemplo n.º 19
0
    IEnumerator SendData(int weight, string postfix)
    {
        yield return(new WaitForSeconds(0.1f));

        var client = new FhirClient("http://hapi.fhir.org/baseR4");

        Debug.Log("TOAN111: DEVICEINFO:" + DEVICEINFO.ID.STR);
        Device device = client.Read <Device>("http://hapi.fhir.org/baseR4/Device/" + DEVICEINFO.ID.STR);

        if (device != null)
        {
            Debug.Log("TOAN113: DEVICEINFO:" + DEVICEINFO.ID.STR);
            //Quantity quantityValue = new Quantity();
            Quantity quantityValue;
            if (device.Property.Count > 0 && device.Property[0].ValueQuantity.Count > 0)
            {
                quantityValue = device.Property[0].ValueQuantity[0];
            }
            else
            {
                quantityValue = new Quantity();
            }

            quantityValue.Value  = (decimal)(weight * 0.005f);
            quantityValue.System = ("http://unitsofmeasure.org");
            quantityValue.Code   = postfix;

            Coding weightCoding = new Coding("http://loinc.org", "29463-7", "Body Weight");
            Device.PropertyComponent weightProperty = new Device.PropertyComponent();
            CodeableConcept          code           = new CodeableConcept();
            code.Coding.Add(weightCoding);
            weightProperty.Type = code;
            weightProperty.ValueQuantity.Add(quantityValue);

            if (device.Property.Count == 0)
            {
                device.Property.Add(weightProperty);
            }
            else
            {
                device.Property[0] = weightProperty;
            }
            var result = client.Update(device);
            TW.I.AddWarning("", "Updated ID " + result.Id);
        }
        else
        {
            Debug.Log("TOAN112: DEVICEINFO:" + DEVICEINFO.ID.STR);
        }
    }
        public ActionResult SavePatient(PatientEdit patient)
        {
            var conn = new FhirClient("http://localhost:8080/baseR4");

            conn.PreferredFormat = ResourceFormat.Json;

            Patient patientNew = conn.Read <Patient>("Patient/" + patient.id);

            patientNew.Name[0].Family     = patient.surname;
            patientNew.BirthDate          = patient.birthDate;
            patientNew.MaritalStatus.Text = patient.mStatus;
            conn.Update(patientNew);
            return(View());
        }
Ejemplo n.º 21
0
        public void CreateEditDelete()
        {
            var furore = new Organization
            {
                Name = "Furore",
                Identifier = new List<Identifier> { new Identifier("http://hl7.org/test/1", "3141") },
                Telecom = new List<Contact> { new Contact { System = Contact.ContactSystem.Phone, Value = "+31-20-3467171" } }
            };

            FhirClient client = new FhirClient(testEndpoint);
            var tags = new List<Tag> { new Tag("http://nu.nl/testname", Tag.FHIRTAGNS, "TestCreateEditDelete") };

            var fe = client.Create(furore,tags);

            Assert.IsNotNull(furore);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.SelfLink);
            Assert.AreNotEqual(fe.Id,fe.SelfLink);
            Assert.IsNotNull(fe.Tags);
            Assert.AreEqual(1, fe.Tags.Count());
            Assert.AreEqual(fe.Tags.First(), tags[0]);
            createdTestOrganization = fe.Id;

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));

            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
            Assert.IsNotNull(fe2.Tags);
            Assert.AreEqual(1, fe2.Tags.Count());
            Assert.AreEqual(fe2.Tags.First(), tags[0]);

            client.Delete(fe2.Id);

            try
            {
                fe = client.Read<Organization>(ResourceLocation.GetIdFromResourceId(fe.Id));
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
            }

            Assert.IsNull(fe);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Update a patient to add more information
        /// </summary>
        /// <param name="fhirClient"></param>
        /// <param name="patient"></param>
        static Patient UpdatePatient(
            FhirClient fhirClient,
            Patient patient)
        {
            patient.Telecom.Add(new ContactPoint()
            {
                System = ContactPoint.ContactPointSystem.Phone,
                Value  = "555.555.5555",
                Use    = ContactPoint.ContactPointUse.Home,
            });

            patient.Gender = AdministrativeGender.Unknown;

            return(fhirClient.Update <Patient>(patient));
        }
Ejemplo n.º 23
0
        public void UpdateTagsOnUpdate()
        {
            if (original == null)
            {
                TestResult.Skipped();
            }

            // Update one tag, add another
            var tags = new List <Tag>()
            {
                new Tag(NUTAG, Tag.FHIRTAGNS, "readTagTest2"),
                new Tag(OTHERTAG, Tag.FHIRTAGNS, "dummy")
            };

            HttpTests.AssertSuccess(client, () => latest = client.Fetch <Patient>(original.Id));

            latest.Tags = tags;

            HttpTests.AssertSuccess(client, () => client.Update <Patient>(latest));

            var read = client.Fetch <Patient>(latest.Id);

            if (read.Tags == null)
            {
                TestResult.Fail("fetch after update did not return any tags");
            }

            if (read.Tags.Count() != 2)
            {
                TestResult.Fail(String.Format("Wrong number of tags after update: {0}, expected 2", read.Tags.Count()));
            }
            var nutags = read.Tags.FindByTerm(NUTAG, Tag.FHIRTAGNS);

            if (nutags.Count() != 1 || nutags.First().Label != "readTagTest2")
            {
                TestResult.Fail("update did not replace value in tag");
            }
            var othertags = read.Tags.FindByTerm(OTHERTAG, Tag.FHIRTAGNS);

            if (othertags.Count() != 1 || othertags.First().Label != "dummy")
            {
                TestResult.Fail("update failed to add new tag");
            }

            latest = read;
        }
Ejemplo n.º 24
0
        public void CallsCallbacks()
        {
            FhirClient client = new FhirClient(testEndpoint);

            client.ParserSettings.AllowUnrecognizedEnums = true;

            bool           calledBefore = false;
            HttpStatusCode?status       = null;

            byte[] body    = null;
            byte[] bodyOut = null;

            client.OnBeforeRequest += (sender, e) =>
            {
                calledBefore = true;
                bodyOut      = e.Body;
            };

            client.OnAfterResponse += (sender, e) =>
            {
                body   = e.Body;
                status = e.RawResponse.StatusCode;
            };

            var pat = client.Read <Patient>("Patient/example");

            Assert.IsTrue(calledBefore);
            Assert.IsNotNull(status);
            Assert.IsNotNull(body);

            var bodyText = HttpToEntryExtensions.DecodeBody(body, Encoding.UTF8);

            Assert.IsTrue(bodyText.Contains("<Patient"));

            calledBefore = false;
            client.Update(pat); // create cannot be called with an ID (which was retrieved)
            Assert.IsTrue(calledBefore);
            Assert.IsNotNull(bodyOut);

            bodyText = HttpToEntryExtensions.DecodeBody(body, Encoding.UTF8);
            Assert.IsTrue(bodyText.Contains("<Patient"));
        }
Ejemplo n.º 25
0
        public override async Tasks.Task <OperationResultEnum> Execute()
        {
            IEnumerable <Resource> resources = null;

            _logger.LogInformation($"Uploading resources to endpoint: '{_arguments.FhirBaseUrl}'");

            var clientMessageHandler = new HttpClientEventHandler();

            clientMessageHandler.OnBeforeRequest += fhirClient_BeforeRequest;
            FhirClient fhirClient = new FhirClient(_arguments.FhirBaseUrl.Uri, FhirClientSettings.CreateDefault(), clientMessageHandler);

            foreach (Resource resource in resources)
            {
                Resource resource2;
                if (resource is Questionnaire && !string.IsNullOrWhiteSpace(resource.Id))
                {
                    Questionnaire questionnaire = resource as Questionnaire;
                    questionnaire.Url = $"{_arguments.ProxyBaseUrl}Questionnaire/{resource.Id}";
                }
                if (string.IsNullOrWhiteSpace(resource.Id))
                {
                    _logger.LogInformation($"Creating new resource of type: '{resource.TypeName}'");
                    resource2 = fhirClient.Create(resource);
                }
                else
                {
                    _logger.LogInformation($"Updating resource with Id: '{resource.Id}' of type: '{resource.TypeName}'");
                    resource2 = fhirClient.Update(resource);
                }

                _logger.LogInformation($"Resource was assigned the Id: '{resource2.Id}'");
                _logger.LogInformation($"Resource can be accessed at: '{fhirClient.Endpoint.AbsoluteUri}{ResourceType.Questionnaire.GetLiteral()}/{resource2.Id}'");
            }

            _logger.LogInformation($"Successfully uploaded resources to endpoint: {_arguments.FhirBaseUrl}");

            return(await Tasks.Task.FromResult(_issues.Any(issue => issue.Severity == IssueSeverityEnum.Error)
                                               ?OperationResultEnum.Failed
                                               : OperationResultEnum.Succeeded));
        }
Ejemplo n.º 26
0
        public IActionResult Edit(JsonTextModel json)
        {
            if (string.IsNullOrWhiteSpace(json.JsonText_))
            {
                return(View(json));
            }
            var parser = new FhirJsonParser();

            try
            {
                var        res      = parser.Parse <Resource>(json.JsonText_);
                FhirClient client   = new FhirClient(url);
                var        resEntry = client.Update(res);
                json.Status_ = JsonTextModel.UPDATED;
            }

            catch (Exception e)
            {
                json.Status_ = JsonTextModel.FAILED;
                return(View(json));
            }
            return(View(json));
        }
Ejemplo n.º 27
0
        public ActionResult EditPatient([Bind] EditPatient patient)
        {
            bool   status  = false;
            string Message = "";

            //SPRAWDZENIE MODELU
            if (ModelState.IsValid)
            {
                //PODŁĄCZENIE KLIENTA
                var client = new FhirClient("http://localhost:8080/baseR4");
                client.PreferredFormat = ResourceFormat.Json;

                //PRZEKAZANIE DANYCH
                Patient   original = client.Read <Patient>("Patient/" + patient.ID);
                HumanName name     = new HumanName();
                name.WithGiven(patient.Name).AndFamily(patient.Surname);
                original.Name.Add(name);
                Address address = new Address();
                address.Text = patient.Address;
                original.Address.Add(address);

                //UPDATE
                client.Update(original);
                Message = "Your item successfully UPDATE";
                status  = true;
            }
            else
            {
                Message = "You haven't got right model";
            }

            ViewBag.ID      = patient.ID;
            ViewBag.Status  = status;
            ViewBag.Message = Message;
            return(View(patient));
        }
Ejemplo n.º 28
0
        public void TestSearchByPersonaCode()
        {
            var client = new FhirClient(testEndpoint);

            var pats =
              client.Search<Patient>(
                new[] { string.Format("identifier={0}|{1}", "http://hl7.org/fhir/sid/us-ssn", "444222222") });
            var pat = (Patient)pats.Entry.First().Resource;
            client.Update<Patient>(pat);
        }
Ejemplo n.º 29
0
        public void CreateEditDelete()
        {
            var pat = (Patient)FhirParser.ParseResourceFromXml(File.ReadAllText(@"TestData\TestPatient.xml"));
            var key = new Random().Next();
            pat.Id = "NetApiCRUDTestPatient" + key;

            FhirClient client = new FhirClient(testEndpoint);

            var fe = client.Create(pat);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);
            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read<Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResult.Status == HttpStatusCode.Gone.ToString());
            }
        }
Ejemplo n.º 30
0
        public void CreateEditDelete()
        {
            FhirClient client = new FhirClient(testEndpoint);
            var pat = client.Read<Patient>("Patient/example");
            pat.Id = null;
            pat.Identifier.Clear();
            pat.Identifier.Add(new Identifier("http://hl7.org/test/2", "99999"));

            var fe = client.Create(pat);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);
            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read<Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResult.Status == "410");
            }
        }
        static void Main()
        {
            var qDødsmelding = new Hl7.Fhir.Model.Questionnaire
            {
                Id          = "7",
                Title       = "Dødsmelding",
                Name        = "doedsmelding_nb_01",
                Description = new Markdown("Melding som rapporterer dødsfall til Folkeregisteret"),
                Purpose     = new Markdown("Melding som skal fylles ut av lege ved dødsfall"),
                Publisher   = "Direktoratet for e-helse",
                Date        = "2017",
                Status      = PublicationStatus.Draft,
                Version     = "1",
                Url         = "http://nde-fhir-ehelse.azurewebsites.net/fhir/Questionnaire/7",
                Language    = "nb-NO",
                Meta        = new Meta()
                {
                    Tag = new List <Coding>()
                    {
                        new Coding()
                        {
                            System  = "https://sarepta.ehelse.no/FHIR/Questionnaire_doedsmelding",
                            Version = "1.0",
                        },
                        new Coding()
                        {
                            System  = "urn:ietf:bcp:47",
                            Code    = "nb-NO",
                            Display = "Norsk (bokmål)"
                        }
                    },
                    Profile = new List <string>()
                    {
                        "https://sarepta.ehelse.no/FHIR/StructureDefinition/SDF-Questionnaire"
                    }
                },
                SubjectType = new List <ResourceType?>()
                {
                    ResourceType.Person
                },
                Item = new List <Hl7.Fhir.Model.Questionnaire.ItemComponent>()
                {
                    new Hl7.Fhir.Model.Questionnaire.ItemComponent()
                    {
                        LinkId       = "deceasedPerson",
                        Text         = "Personidentifikator til den avdøde",
                        Required     = true,
                        Repeats      = false,
                        Type         = Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType.Text,
                        FhirComments = new List <string>()
                        {
                            "PersonPicker"
                        },
                    },
                    new Hl7.Fhir.Model.Questionnaire.ItemComponent()
                    {
                        LinkId   = "timeOfDeath",
                        Text     = "Dødstidspunkt (dd.mm.åååå)",
                        Required = true,
                        Repeats  = false,
                        Type     = Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType.DateTime
                    },
                    new Hl7.Fhir.Model.Questionnaire.ItemComponent()
                    {
                        LinkId     = "confirmation",
                        EnableWhen = new List <Hl7.Fhir.Model.Questionnaire.EnableWhenComponent>()
                        {
                            new Hl7.Fhir.Model.Questionnaire.EnableWhenComponent()
                            {
                                Question  = "timeOfDeath",
                                HasAnswer = true
                            }
                        },
                        Text     = "Bekreftelse",
                        Required = true,
                        Repeats  = false,
                        Type     = Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType.Boolean
                    }
                }
            };


            const string fhirServer = "http://nde-fhir-ehelse.azurewebsites.net/fhir";
            //const string fhirServer = "http://vonk.furore.com";
            var client = new FhirClient(fhirServer);

            try
            {
                //var resCreate = client.Create(qDødsmelding);

                var resCreate = client.Update(qDødsmelding);
                Console.WriteLine($"Questionnaire ID: {resCreate.Id}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("Finished...");
        }
Ejemplo n.º 32
0
        public void CreateEditDelete()
        {
            var furore = new Organization
            {
                Name       = "Furore",
                Identifier = new List <Identifier> {
                    new Identifier("http://hl7.org/test/1", "3141")
                },
                Telecom = new List <Contact> {
                    new Contact {
                        System = Contact.ContactSystem.Phone, Value = "+31-20-3467171"
                    }
                }
            };

            FhirClient client = new FhirClient(testEndpoint);
            var        tags   = new List <Tag> {
                new Tag("http://nu.nl/testname", Tag.FHIRTAGSCHEME_GENERAL, "TestCreateEditDelete")
            };

            var fe = client.Create <Organization>(furore, tags: tags, refresh: true);

            Assert.IsNotNull(furore);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.SelfLink);
            Assert.AreNotEqual(fe.Id, fe.SelfLink);
            Assert.IsNotNull(fe.Tags);
            Assert.AreEqual(1, fe.Tags.Count(), "Tag count on new organization record don't match");
            Assert.AreEqual(fe.Tags.First(), tags[0]);
            createdTestOrganizationUrl = fe.Id;

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe, refresh: true);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
            Assert.AreEqual(2, fe2.Resource.Identifier.Count);

            Assert.IsNotNull(fe2.Tags);
            Assert.AreEqual(1, fe2.Tags.Count(), "Tag count on updated organization record don't match");
            Assert.AreEqual(fe2.Tags.First(), tags[0]);

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe2.Id, fe.Resource, refresh: true);

            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Resource.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read <Organization>(new ResourceIdentity(fe.Id));
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Try to post the data
        /// </summary>
        /// <param name="data"></param>
        /// <returns>True if successfull</returns>
        public JsonResult PostData(CreatedDataContainer data, string endpoint)
        {
            //establish client
            var fhirClient = new FhirClient(endpoint);

            int patUpdSuccess  = 0;
            int obsUpdSuccess  = 0;
            int condUpdSuccess = 0;
            int patUpdFail     = 0;
            int obsUpdFail     = 0;
            int condUpdFail    = 0;


            //add the patients
            foreach (var patient in data.Patients)
            {
                try
                {
                    fhirClient.Update(patient);
                    patUpdSuccess++;
                }
                catch (Exception ex)
                {
                    patUpdFail++;
                }
            }

            //add the observations
            foreach (var observation in data.Observations)
            {
                try
                {
                    fhirClient.Update(observation);
                    obsUpdSuccess++;
                }
                catch (Exception ex)
                {
                    obsUpdFail++;
                }
            }

            //add the conditions
            foreach (var condition in data.Conditions)
            {
                try
                {
                    fhirClient.Update(condition);
                    condUpdSuccess++;
                }
                catch (Exception ex)
                {
                    condUpdFail++;
                }
            }

            string resultsString = "Patient Updates S:" + patUpdSuccess + " F:" + patUpdFail + Environment.NewLine
                                   + "Observation Updates S:" + obsUpdSuccess + " F:" + obsUpdFail + Environment.NewLine
                                   + "Condition Updates S:" + condUpdSuccess + " F:" + condUpdFail + Environment.NewLine;

            return(Json(resultsString));
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Executes the specified arguments.
        /// </summary>
        /// <param name="arguments">The arguments.</param>
        /// <returns>System.Int32.</returns>
        /// <remarks>N/A</remarks>
        public override int Execute(Arguments arguments)
        {
            // Get us the needed parameters first
            //
            var url = arguments["url"];
            var id  = arguments["id"];

            var name      = arguments["name"];
            var firstname = arguments["firstname"];
            var gender    = arguments["gender"];
            var dob       = arguments["dob"];
            var phone     = arguments["phone"];
            var email     = arguments["email"];


            // Try to retrieve patient from server and update it
            try
            {
                // Get patient representation from server
                //
                #region retrieve patient
                var client   = new FhirClient(url);
                var identity = ResourceIdentity.Build("Patient", id);
                var entry    = client.Read(identity) as ResourceEntry <Patient>;

                var patient = entry.Resource as Patient;
                if (patient == null)
                {
                    Console.WriteLine("Could not retrieve patient {0} from server {1}", id, url);
                    return(1);
                }
                #endregion

                // We have the patient now modify local representation
                //
                #region prepare patient update
                if (!(String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(firstname)))
                {
                    patient.Name = new List <HumanName>();
                    patient.Name.Add(HumanName.ForFamily(name).WithGiven(firstname));
                }

                if (!String.IsNullOrEmpty(gender))
                {
                    patient.Gender = new CodeableConcept("http://dummy.org/gender", gender, gender);
                }

                if (!String.IsNullOrEmpty(dob))
                {
                    var birthdate = DateTime.ParseExact(dob, "dd/MM/yyyy", new CultureInfo("en-US"));
                    patient.BirthDate = birthdate.ToString("s");
                }

                patient.Telecom = new List <Contact>();
                if (!String.IsNullOrEmpty(phone))
                {
                    patient.Telecom.Add(new Contact()
                    {
                        Value  = phone,
                        System = Contact.ContactSystem.Phone,
                        Use    = Contact.ContactUse.Home
                    });
                }

                if (!String.IsNullOrEmpty(email))
                {
                    patient.Telecom.Add(new Contact()
                    {
                        Value  = email,
                        System = Contact.ContactSystem.Email,
                        Use    = Contact.ContactUse.Home
                    });
                }
                #endregion

                // Finally send the update to the server
                //
                #region do patient update
                entry.Resource = patient;
                client.Update(entry, false);
                Console.WriteLine("Patient {0} updated on server {1}", id, url);
                return(0);

                #endregion
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(1);
            }
        }
Ejemplo n.º 35
0
        public void CreateEditDelete()
        {
            var furore = new Organization
            {
                Name = "Furore",
                Identifier = new List<Identifier> { new Identifier("http://hl7.org/test/1", "3141") },
                Telecom = new List<Contact> { new Contact { System = Contact.ContactSystem.Phone, Value = "+31-20-3467171" } }
            };

            FhirClient client = new FhirClient(testEndpoint);
            var tags = new List<Tag> { new Tag("http://nu.nl/testname", Tag.FHIRTAGSCHEME_GENERAL, "TestCreateEditDelete") };

            var fe = client.Create<Organization>(furore, tags:tags, refresh: true);

            Assert.IsNotNull(furore);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.SelfLink);
            Assert.AreNotEqual(fe.Id, fe.SelfLink);
			Assert.IsNotNull(fe.Tags);
			Assert.AreEqual(1, fe.Tags.Count(), "Tag count on new organization record don't match");
			Assert.AreEqual(fe.Tags.First(), tags[0]);
			createdTestOrganizationUrl = fe.Id;

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe, refresh: true);
            
            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
            Assert.AreEqual(2, fe2.Resource.Identifier.Count);

            Assert.IsNotNull(fe2.Tags);
			Assert.AreEqual(1, fe2.Tags.Count(), "Tag count on updated organization record don't match");
            Assert.AreEqual(fe2.Tags.First(), tags[0]);

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe2.Id, fe.Resource, refresh: true);
            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Resource.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read<Organization>(new ResourceIdentity(fe.Id));
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
            }
        }
        public void Test_DeleteHistoryIndexes()
        {
            FhirClient clientFhir = new FhirClient(StaticTestData.FhirEndpoint(), false);

            clientFhir.Timeout = 1000 * 720; // give the call a while to execute (particularly while debugging).

            string PatientOneResourceId   = Guid.NewGuid().ToString();
            string PatientOneMRNIdentifer = Guid.NewGuid().ToString();

            //Add a Patient resource by Create
            Patient PatientOne = new Patient();

            PatientOne.Id = PatientOneResourceId;
            PatientOne.Name.Add(HumanName.ForFamily("TestPatient").WithGiven("Test"));
            PatientOne.BirthDateElement = new Date("1979-09-30");
            PatientOne.Identifier.Add(new Identifier(StaticTestData.TestIdentiferSystem, PatientOneMRNIdentifer));
            PatientOne.Gender = AdministrativeGender.Unknown;

            Patient PatientResult = null;

            try
            {
                PatientResult = clientFhir.Update <Patient>(PatientOne);
            }
            catch (Exception Exec)
            {
                Assert.True(false, "Exception thrown on Patient resource Update: " + Exec.Message);
            }
            Assert.NotNull(PatientResult, "Resource create by Updated returned resource of null");

            PatientResult = null;

            //Update the patient again to ensure there are History indexes to delete
            try
            {
                PatientResult = clientFhir.Update <Patient>(PatientOne);
            }
            catch (Exception Exec)
            {
                Assert.True(false, "Exception thrown on Patient resource Update: " + Exec.Message);
            }
            Assert.NotNull(PatientResult, "Resource create by Updated returned resource of null");

            //------------------------------------------------------------------------------------
            // ------------ Base Operation, limited types by parameters --------------------------
            //------------------------------------------------------------------------------------

            //Now setup to use the base operation $delete-history-indexes
            //Parameter Resource
            Parameters ParametersIn = new Parameters();

            //ParametersIn.Id = Guid.NewGuid().ToString();
            ParametersIn.Parameter = new List <Parameters.ParameterComponent>();
            var ParamOne = new Parameters.ParameterComponent();

            ParametersIn.Parameter.Add(ParamOne);
            ParamOne.Name  = "ResourceType";
            ParamOne.Value = new FhirString(FHIRAllTypes.Patient.GetLiteral());

            Parameters ParametersResult = null;

            try
            {
                var ResourceResult = clientFhir.WholeSystemOperation(OperationName, ParametersIn);
                ParametersResult = ResourceResult as Parameters;
            }
            catch (Exception Exec)
            {
                Assert.True(false, $"Exception thrown on Operation call to ${OperationName}: " + Exec.Message);
            }
            Assert.NotNull(ParametersResult, "Resource create by Updated returned resource of null");
            Assert.NotNull(ParametersResult.Parameter, "ParametersResult.Parameter is null");
            Assert.AreEqual(ParametersResult.Parameter.Count(), 1, "ParametersResult.Parameter contains more than one parameter.");
            Assert.AreEqual(ParametersResult.Parameter[0].Name, $"{FHIRAllTypes.Patient.GetLiteral()}_TotalIndexesDeletedCount", "ParametersResult.Parameter.Name not as expected.");
            Assert.IsInstanceOf <FhirDecimal>(ParametersResult.Parameter[0].Value, "ParametersResult.Parameter.Value expected FhirDecimal.");
            Assert.Greater((ParametersResult.Parameter[0].Value as FhirDecimal).Value, 0, "ParametersResult.Parameter.Value expected to be greater than 0.");
            ParametersResult = null;


            //------------------------------------------------------------------------------------
            // ------------ Resource Base Operation ALL resource ResourceType = *----------------------------------------------
            //------------------------------------------------------------------------------------

            //Now setup to use the base operation $delete-history-indexes
            //Parameter Resource
            ParametersIn           = new Parameters();
            ParametersIn.Id        = Guid.NewGuid().ToString();
            ParametersIn.Parameter = new List <Parameters.ParameterComponent>();
            ParamOne = new Parameters.ParameterComponent();
            ParametersIn.Parameter.Add(ParamOne);
            ParamOne.Name  = "ResourceType";
            ParamOne.Value = new FhirString("*");

            ParametersResult = null;
            try
            {
                var ResourceResult = clientFhir.WholeSystemOperation(OperationName, ParametersIn);
                ParametersResult = ResourceResult as Parameters;
            }
            catch (Exception Exec)
            {
                Assert.True(false, $"Exception thrown on Operation call to ${OperationName}: " + Exec.Message);
            }
            Assert.NotNull(ParametersResult, "Resource create by Updated returned resource of null");
            Assert.NotNull(ParametersResult.Parameter, "ParametersResult.Parameter is null");
            Assert.AreEqual(ParametersResult.Parameter.Count(), ModelInfo.SupportedResources.Count, "ParametersResult.Parameter.Count Not equal to Supported resource total.");
            ParametersResult = null;

            //------------------------------------------------------------------------------------
            // ------------ Resource Type Operation ----------------------------------------------
            //------------------------------------------------------------------------------------

            //Update the patient again to ensure there are History indexes to delete
            PatientResult = null;
            try
            {
                PatientResult = clientFhir.Update <Patient>(PatientOne);
            }
            catch (Exception Exec)
            {
                Assert.True(false, "Exception thrown on Patient resource Update: " + Exec.Message);
            }
            Assert.NotNull(PatientResult, "Resource create by Updated returned resource of null");

            ParametersIn    = new Parameters();
            ParametersIn.Id = Guid.NewGuid().ToString();

            ParametersResult = null;
            try
            {
                var ResourceResult = clientFhir.TypeOperation <Patient>(OperationName, ParametersIn);
                ParametersResult = ResourceResult as Parameters;
            }
            catch (Exception Exec)
            {
                Assert.True(false, $"Exception thrown on Operation call to ${OperationName}: " + Exec.Message);
            }
            Assert.NotNull(ParametersResult, "Resource create by Updated returned resource of null");
            Assert.NotNull(ParametersResult.Parameter, "ParametersResult.Parameter is null");
            Assert.AreEqual(ParametersResult.Parameter.Count(), 1, "ParametersResult.Parameter contains more than one parameter.");
            Assert.AreEqual(ParametersResult.Parameter[0].Name, $"{FHIRAllTypes.Patient.GetLiteral()}_TotalIndexesDeletedCount", "ParametersResult.Parameter.Name not as expected.");
            Assert.IsInstanceOf <FhirDecimal>(ParametersResult.Parameter[0].Value, "ParametersResult.Parameter.Value expected FhirDecimal.");
            Assert.Greater((ParametersResult.Parameter[0].Value as FhirDecimal).Value, 0, "ParametersResult.Parameter.Value expected to be greater than 0.");

            //--- Clean Up ---------------------------------------------------------
            //Clean up by deleting all Test Patients
            SearchParams sp = new SearchParams().Where($"identifier={StaticTestData.TestIdentiferSystem}|");

            try
            {
                clientFhir.Delete("Patient", sp);
            }
            catch (Exception Exec)
            {
                Assert.True(false, "Exception thrown on conditional delete of resource Patient: " + Exec.Message);
            }
        }