Esempio n. 1
0
        public Task <Bundle> SystemHistory(ModelBaseInputs request, DateTimeOffset?since, DateTimeOffset?Till, int?Count, SummaryType summary)
        {
            Bundle result = new Bundle();

            result.Meta             = new Meta();
            result.Meta.LastUpdated = DateTime.Now;
            result.Id   = new Uri("urn:uuid:" + Guid.NewGuid().ToString("n")).OriginalString;
            result.Type = Bundle.BundleType.History;

            var parser = new Fhir.Serialization.FhirXmlParser();
            var files  = System.IO.Directory.EnumerateFiles(DirectorySystemService.Directory);

            foreach (var filename in files)
            {
                var resource = parser.Parse <Resource>(System.IO.File.ReadAllText(filename));
                result.AddResourceEntry(resource,
                                        ResourceIdentity.Build(request.BaseUri,
                                                               resource.ResourceType.ToString(),
                                                               resource.Id,
                                                               resource.Meta.VersionId).OriginalString);
            }
            result.Total = result.Entry.Count;

            // also need to set the page links

            return(System.Threading.Tasks.Task.FromResult(result));
        }
        public System.Threading.Tasks.Task <Bundle> Search(IEnumerable <KeyValuePair <string, string> > parameters, int?Count, SummaryType summary)
        {
            Bundle result = new Bundle();

            result.Meta = new Meta()
            {
                LastUpdated = DateTime.Now
            };
            result.Id   = new Uri("urn:uuid:" + Guid.NewGuid().ToString("n")).OriginalString;
            result.Type = Bundle.BundleType.Searchset;

            var parser = new Fhir.Serialization.FhirXmlParser();
            var files  = System.IO.Directory.EnumerateFiles(DirectorySystemService.Directory, $"{ResourceName}.*.xml");

            foreach (var filename in files)
            {
                // TODO: actually filter!
                var resource = parser.Parse <Resource>(System.IO.File.ReadAllText(filename));
                result.AddResourceEntry(resource,
                                        ResourceIdentity.Build(RequestDetails.BaseUri,
                                                               resource.ResourceType.ToString(),
                                                               resource.Id,
                                                               resource.Meta.VersionId).OriginalString);
            }
            result.Total = result.Entry.Count;

            // also need to set the page links

            return(System.Threading.Tasks.Task.FromResult(result));
        }
Esempio n. 3
0
        public List <FederationMember> Members()
        {
            List <FederationMember> members = new List <FederationMember>();

            // read these from the file system
            var parser = new Fhir.Serialization.FhirXmlParser();
            var files  = System.IO.Directory.EnumerateFiles(DirectorySystemService.Directory, $"Endpoint.*.xml").ToList();

            files.Sort();
            foreach (var filename in files)
            {
                var resource = parser.Parse <Endpoint>(System.IO.File.ReadAllText(filename));
                members.Add(new FederationMember(resource));
            }

            return(members);
        }