public long DropAllResourceIndexes()
        {
            var dropAllResourceIndexesResult = FHIRbase.Call("fhir.drop_all_resource_indexes")
                                               .Cast <long>();

            return(dropAllResourceIndexesResult);
        }
 public bool IsExists(string resourceName, string id)
 {
     return(FHIRbase.Call("fhir.is_exists")
            .WithText(resourceName)
            .WithText(id)
            .Cast <bool>());
 }
 public bool IsDeleted(ResourceKey key)
 {
     return(FHIRbase.Call("fhir.is_deleted")
            .WithText(key.TypeName)
            .WithText(key.ResourceId)
            .Cast <bool>());
 }
        /// <summary>
        /// Generate tables for DSTU2 resources
        /// </summary>
        /// <returns></returns>
        public string GenerateTables()
        {
            var result = FHIRbase.Call("fhir.generate_tables")
                         .Cast <string>();

            return(result);
        }
        public string[] IndexAllResources()
        {
            var indexAllResourcesResult = FHIRbase.Call("fhir.index_all_resources")
                                          .Cast <string[]>();

            return(indexAllResourcesResult);
        }
Exemple #6
0
        public void Test_Create()
        {
            var createdPatient = (Patient)FHIRbase.Create(SimplePatient);

            Assert.That(createdPatient, Is.Not.Null);
            Assert.That(createdPatient.Id, Is.Not.Null.Or.Empty);
            Assert.That(createdPatient.HasVersionId, Is.True);
            Assert.That(createdPatient.Name.First().Family.First(), Is.EqualTo("Hello"));
            Assert.That(createdPatient.Name.First().Given.First(), Is.EqualTo("World"));
            Assert.That(createdPatient.Telecom.First().Value, Is.EqualTo("123456789"));

            FHIRbase.Delete(createdPatient);

            var createdpatient1 = FHIRbase.Create(CommonPatient);

            Assert.That(createdpatient1, Is.Not.Null);
            Assert.That(createdpatient1.Id, Is.Not.Null.Or.Empty);
            Assert.That(createdpatient1.HasVersionId, Is.True);

            var readCreated = FHIRbase.Read(createdpatient1);

            Assert.That(readCreated, Is.Not.Null);
            Assert.That(readCreated.Id, Is.Not.Null.Or.Empty);
            Assert.That(readCreated.HasVersionId, Is.True);

            FHIRbase.Delete(createdpatient1);
        }
        /// <summary>
        /// Create FHIR-conformance
        /// </summary>
        /// <param name="cfg"></param>
        /// <returns>JSON with conformance</returns>
        public Conformance Conformance(string cfg = "{}")
        {
            var conformanceResult = FHIRbase.Call("fhir.conformance")
                                    .WithJsonb(cfg)
                                    .Cast <string>();

            return((Conformance)FHIRbaseHelper.JsonToFhirResource(conformanceResult));
        }
        public string AdminDiskUsageTop(int limit)
        {
            var adminDiskUsageTopResult = FHIRbase.Call("fhir.admin_disk_usage_top")
                                          .WithInt(limit)
                                          .Cast <string>();

            return(adminDiskUsageTopResult);
        }
        /// <summary>
        /// Generate tables for resources
        /// </summary>
        /// <param name="resources"></param>
        /// <returns></returns>
        public string GenerateTables(params string[] resources)
        {
            var result = FHIRbase.Call("fhir.generate_tables")
                         .WithTextArray(resources)
                         .Cast <string>();

            return(result);
        }
        public long DropResourceIndexes(string resource)
        {
            var dropResourceIndexesResult = FHIRbase.Call("fhir.drop_resource_indexes")
                                            .WithText(resource)
                                            .Cast <long>();

            return(dropResourceIndexesResult);
        }
        public string[] IndexResource(string resource)
        {
            var indexResiurceResult = FHIRbase.Call("fhir.index_resource")
                                      .WithText(resource)
                                      .Cast <string[]>();

            return(indexResiurceResult);
        }
        public StructureDefinition StructureDefinition(string resourceName, string cfg = "{}")
        {
            var sdResult = FHIRbase.Call("fhir.structuredefinition")
                           .WithJsonb(cfg)
                           .WithText(resourceName)
                           .Cast <string>();

            return((StructureDefinition)FHIRbaseHelper.JsonToFhirResource(sdResult));
        }
        public Resource Create(Resource entry)
        {
            var resourceJson = FHIRbaseHelper.FhirResourceToJson(entry);
            var resource     = FHIRbase.Call("fhir.create")
                               .WithJsonb(resourceJson)
                               .Cast <string>();

            return(FHIRbaseHelper.JsonToFhirResource(resource));
        }
        public Bundle Transaction(Bundle bundle)
        {
            var transactionJson = FHIRbaseHelper.FhirResourceToJson(bundle);
            var fhirbaseResult  = FHIRbase.Call("fhir.transaction")
                                  .WithJsonb(transactionJson)
                                  .Cast <string>();

            return(FHIRbaseHelper.JsonToBundle(fhirbaseResult));
        }
        public string IndexSearchParam(string resource, string name)
        {
            var indexSearchParamsResult = FHIRbase.Call("fhir.index_search_param")
                                          .WithText(resource)
                                          .WithText(name)
                                          .Cast <string>();

            return(indexSearchParamsResult);
        }
        public Resource Delete(ResourceKey key)
        {
            var deletedResponse = FHIRbase.Call("fhir.delete")
                                  .WithText(key.TypeName)
                                  .WithText(key.ResourceId)
                                  .Cast <string>();

            return(FHIRbaseHelper.JsonToFhirResource(deletedResponse));
        }
        public Resource Update(Resource resource)
        {
            var resourceJson   = FHIRbaseHelper.FhirResourceToJson(resource);
            var updateResponse = FHIRbase.Call("fhir.update")
                                 .WithJsonb(resourceJson)
                                 .Cast <string>();

            return(FHIRbaseHelper.JsonToFhirResource(updateResponse));
        }
        public Resource Read(ResourceKey key)
        {
            var readedResponse = FHIRbase.Call("fhir.read")
                                 .WithText(key.TypeName)
                                 .WithText(key.ResourceId)
                                 .Cast <string>();

            return(FHIRbaseHelper.JsonToFhirResource(readedResponse));
        }
        public long DropIndexSearchParams(string resource, string name)
        {
            var dropIndexSearchParamsResult = FHIRbase.Call("fhir.drop_index_search_param")
                                              .WithText(resource)
                                              .WithText(name)
                                              .Cast <long>();

            return(dropIndexSearchParamsResult);
        }
        public bool IsLatest(ResourceKey key)
        {
            var result = FHIRbase.Call("fhir.is_latest")
                         .WithText(key.TypeName)
                         .WithText(key.ResourceId)
                         .WithText(key.VersionId)
                         .Cast <bool>();

            return(result);
        }
Exemple #21
0
        public void Test_TearDown()
        {
            foreach (var searchPatient in SearchPatients)
            {
                FHIRbase.Delete(searchPatient);
            }

            foreach (var entryComponent in RemovedPatient.Entry)
            {
                FHIRbase.Create(entryComponent.Resource);
            }
        }
Exemple #22
0
        public void Test_Search()
        {
            var search1 = FHIRbase.Search("Patient", Search.By("family", "Hello"));

            Assert.That(search1.Entry, Is.Not.Null);
            Assert.That(search1.Entry.Count, Is.EqualTo(3));

            var search2 = FHIRbase.Search("Patient", Search.By("identifier.value", "12345"));

            Assert.That(search2.Entry, Is.Not.Null);
            Assert.That(search2.Entry.Count, Is.EqualTo(7));
        }
        public Bundle History(HistoryParameters parameters = null)
        {
            if (parameters == null)
            {
                parameters = new HistoryParameters();
            }

            var historyResponse = FHIRbase.Call("fhir.history")
                                  .WithText(parameters.ToString())
                                  .Cast <string>();

            return(FHIRbaseHelper.JsonToBundle(historyResponse));
        }
        public Bundle Search(string resource, SearchParameters parameters)
        {
            if (parameters == null)
            {
                parameters = new SearchParameters();
            }

            var searchQuery  = parameters.ToString();
            var searchResult = FHIRbase.Call("fhir.search")
                               .WithText(resource)
                               .WithText(searchQuery)
                               .Cast <string>();

            return(FHIRbaseHelper.JsonToBundle(searchResult));
        }
Exemple #25
0
        public void Test_ReadLastVersion()
        {
            var createdPatient  = (Patient)FHIRbase.Create(SimplePatient);
            var updatedPatient1 = (Patient)FHIRbase.Update(createdPatient);
            var updatedPatient2 = (Patient)FHIRbase.Update(updatedPatient1);

            var history = FHIRbase.History(createdPatient.TypeName, createdPatient.Id);

            Assert.That(history, Is.Not.Null);
            Assert.That(history.Entry, Is.Not.Null);
            Assert.That(history.Entry.Count, Is.EqualTo(3));

            var lastPatientVersion = (Patient)FHIRbase.ReadLastVersion(createdPatient);

            Assert.That(lastPatientVersion, Is.Not.Null);
            Assert.That(lastPatientVersion.VersionId, Is.EqualTo(updatedPatient2.VersionId));

            FHIRbase.Delete(createdPatient);

            Assert.That(FHIRbase.IsDeleted(createdPatient), Is.True);
            Assert.That(FHIRbase.IsExists(createdPatient), Is.False);
        }
Exemple #26
0
        public void Test_Search_StructureDefinition()
        {
            var search = FHIRbase.Search("StructureDefinition");

            Assert.That(search.Entry, Is.Not.Null);
        }