예제 #1
0
 public Pager(IFhirStore store, ISnapshotStore snapshotstore, ILocalhost localhost, Transfer transfer)
 {
     this.store = store;
     this.snapshotstore = snapshotstore;
     this.localhost = localhost;
     this.transfer = transfer;
 }
예제 #2
0
 public Import(ILocalhost localhost, IGenerator generator)
 {
     this.localhost = localhost;
     this.generator = generator;
     mapper = new Mapper<Key, Key>();
     interactions = new List<Interaction>();
 }
예제 #3
0
파일: Pager.cs 프로젝트: Condeti/spark
 public Pager(IFhirStore fhirStore, ISnapshotStore snapshotstore, ILocalhost localhost, Transfer transfer, List<ModelInfo.SearchParamDefinition> searchParameters)
 {
     this.fhirStore = fhirStore;
     this.snapshotstore = snapshotstore;
     this.localhost = localhost;
     this.transfer = transfer;
     this.searchParameters = searchParameters;
 }
예제 #4
0
 public InitializeHub()
 {
     this.localhost = InfrastructureProvider.Mongo.Localhost;
     this.service = InfrastructureProvider.Mongo.CreateService();
     this.store = InfrastructureProvider.Mongo.Store;
     this.index = InfrastructureProvider.Mongo.Index;
     this.resources = null;
 }
예제 #5
0
 public MaintenanceService(FhirService fhirService, ILocalhost localhost, IGenerator keyGenerator, IFhirStore fhirStore, IFhirIndex fhirIndex)
 {
     this.fhirService = fhirService;
     this.localhost = localhost;
     this.keyGenerator = keyGenerator;
     this.fhirStore = fhirStore;
     this.fhirIndex = fhirIndex;
 }
예제 #6
0
 public MaintenanceService(Infrastructure infrastructure, FhirService service)
 {
     this.service = service;
     this.localhost = infrastructure.Localhost;
     this.generator = infrastructure.Generator;
     this.store = infrastructure.Store;
     this.index = infrastructure.Index;
 }
예제 #7
0
 public InitializeHub(FhirService fhirService, ILocalhost localhost, IFhirStore fhirStore, IFhirIndex fhirIndex)
 {
     this.localhost = localhost;
     this.fhirService = fhirService;
     this.fhirStore = fhirStore;
     this.fhirIndex = fhirIndex;
     this.resources = null;
 }
예제 #8
0
        public FhirService(Infrastructure infrastructure)
        {
            this.localhost = infrastructure.Localhost;
            this.store = infrastructure.Store;
            this.snapshotstore = infrastructure.SnapshotStore;
            this.generator = infrastructure.Generator;
            this.index = infrastructure.Index;
            this.listener = infrastructure.ServiceListener;

            transfer = new Transfer(generator, localhost);
            pager = new Pager(store, snapshotstore, localhost, transfer);
        }
예제 #9
0
        private static Bundle.HTTPVerb DetermineMethod(ILocalhost localhost, IKey key)
        {
            if (key == null) return Bundle.HTTPVerb.DELETE; // probably...

            switch (localhost.GetKeyKind(key))
            {
                case KeyKind.Foreign: return Bundle.HTTPVerb.POST;
                case KeyKind.Temporary: return Bundle.HTTPVerb.POST;
                case KeyKind.Internal: return Bundle.HTTPVerb.PUT;
                case KeyKind.Local: return Bundle.HTTPVerb.PUT;
                default: return Bundle.HTTPVerb.PUT;
            }
        }
예제 #10
0
        public static Interaction ToInteraction(this ILocalhost localhost, Bundle.EntryComponent bundleEntry)
        {
            Key key = localhost.ExtractKey(bundleEntry);

            Bundle.HTTPVerb method = localhost.ExtrapolateMethod(bundleEntry, key);

            if (key != null)
            {
                return(Interaction.Create(method, key, bundleEntry.Resource));
            }
            else
            {
                return(Interaction.Create(method, bundleEntry.Resource));
            }
        }
예제 #11
0
 public static Key ExtractKey(this ILocalhost localhost, Bundle.EntryComponent entry)
 {
     if (entry.Request != null && entry.Request.Url != null)
     {
         return(localhost.UriToKey(entry.Request.Url));
     }
     else if (entry.Resource != null)
     {
         return(entry.Resource.ExtractKey());
     }
     else
     {
         return(null);
     }
 }
예제 #12
0
        public static async Task <ResourceManipulationOperation> GetManipulationOperation(
            Bundle.EntryComponent entryComponent,
            ILocalhost localhost,
            ISearchService service = null)
        {
            var method    = localhost.ExtrapolateMethod(entryComponent, null); //CCR: is key needed? Isn't method required?
            var key       = localhost.ExtractKey(entryComponent);
            var searchUri = GetSearchUri(entryComponent, method);

            return(await _builders[method](
                       entryComponent.Resource,
                       key,
                       service,
                       searchUri != null ? ParseQueryString(localhost, searchUri) : null)
                   .ConfigureAwait(false));
        }
예제 #13
0
        public FhirService(ILocalhost localhost, IFhirStore fhirStore, ISnapshotStore snapshotStore, IGenerator keyGenerator,
            IFhirIndex fhirIndex, IServiceListener serviceListener, IFhirResponseFactory responseFactory, IndexService indexService)
        {
            this.localhost = localhost;
            this.fhirStore = fhirStore;
            this.snapshotstore = snapshotStore;
            this.keyGenerator = keyGenerator;
            this.fhirIndex = fhirIndex;
            this.serviceListener = serviceListener;
            this.responseFactory = responseFactory;
            _indexService = indexService;

            transfer = new Transfer(this.keyGenerator, localhost);
            pager = new Pager(this.fhirStore, snapshotstore, localhost, transfer, ModelInfo.SearchParameters);
            //TODO: Use FhirModel instead of ModelInfo for the searchparameters.
        }
예제 #14
0
        public FhirService(ILocalhost localhost, IFhirStore fhirStore, ISnapshotStore snapshotStore, IGenerator keyGenerator,
                           IFhirIndex fhirIndex, IServiceListener serviceListener, IFhirResponseFactory responseFactory, IndexService indexService)
        {
            this.localhost       = localhost;
            this.fhirStore       = fhirStore;
            this.snapshotstore   = snapshotStore;
            this.keyGenerator    = keyGenerator;
            this.fhirIndex       = fhirIndex;
            this.serviceListener = serviceListener;
            this.responseFactory = responseFactory;
            _indexService        = indexService;

            transfer = new Transfer(this.keyGenerator, localhost);
            pager    = new Pager(this.fhirStore, snapshotstore, localhost, transfer, ModelInfo.SearchParameters);
            //TODO: Use FhirModel instead of ModelInfo for the searchparameters.
        }
예제 #15
0
        public static Key UriToKey(this ILocalhost localhost, Uri uri)
        {
            if (uri.IsAbsoluteUri && uri.IsTemporaryUri() == false)
            {
                return(localhost.IsBaseOf(uri)
                    ? localhost.LocalUriToKey(uri)
                    : throw new ArgumentException("Cannot create a key from a foreign Uri"));
            }

            if (uri.IsTemporaryUri())
            {
                return(Key.Create(null, uri.ToString()));
            }

            var path = uri.ToString();

            return(Key.ParseOperationPath(path));
        }
예제 #16
0
 public static Key UriToKey(this ILocalhost localhost, Uri uri)
 {
     if (uri.IsAbsoluteUri)
     {
         if (localhost.IsBaseOf(uri))
         {
             return(localhost.LocalUriToKey(uri));
         }
         else
         {
             return(ForeignUriToKey(uri));
         }
     }
     else
     {
         string path = uri.ToString();
         return(Key.ParseOperationPath(path));
     }
 }
예제 #17
0
        public static Key ExtractKey(this ILocalhost localhost, Bundle.EntryComponent entry)
        {
            Key key = null;

            if (entry.Request != null && entry.Request.Url != null)
            {
                key = localhost.UriToKey(entry.Request.Url);
            }
            else if (entry.Resource != null)
            {
                key = entry.Resource.ExtractKey();
            }
            if (key != null && string.IsNullOrEmpty(key.ResourceId) &&
                entry.FullUrl != null && UriHelper.IsTemporaryUri(entry.FullUrl))
            {
                key.ResourceId = entry.FullUrl;
            }
            return(key);
        }
예제 #18
0
        private static Bundle.HTTPVerb DetermineMethod(ILocalhost localhost, IKey key)
        {
            if (key == null)
            {
                return(Bundle.HTTPVerb.DELETE);             // probably...
            }
            switch (localhost.GetKeyKind(key))
            {
            case KeyKind.Foreign: return(Bundle.HTTPVerb.POST);

            case KeyKind.Temporary: return(Bundle.HTTPVerb.POST);

            case KeyKind.Internal: return(Bundle.HTTPVerb.PUT);

            case KeyKind.Local: return(Bundle.HTTPVerb.PUT);

            default: return(Bundle.HTTPVerb.PUT);
            }
        }
예제 #19
0
 public static KeyKind GetKeyKind(this ILocalhost localhost, IKey key)
 {
     if (key.IsTemporary())
     {
         return(KeyKind.Temporary);
     }
     else if (!key.HasBase())
     {
         return(KeyKind.Internal);
     }
     else if (localhost.IsLocal(key))
     {
         return(KeyKind.Local);
     }
     else
     {
         return(KeyKind.Foreign);
     }
 }
 public static Key UriToKey(this ILocalhost localhost, Uri uri)
 {
     if (uri.IsAbsoluteUri)
     {
         if (localhost.IsBaseOf(uri))
         {
             return(localhost.LocalUriToKey(uri));
         }
         else
         {
             throw new ArgumentException("Cannot create a key from a foreign Uri");
         }
     }
     else
     {
         string path = uri.ToString();
         return(Key.ParseOperationPath(path));
     }
 }
예제 #21
0
 public MaintenanceHub(
     IFhirService fhirService,
     ILocalhost localhost,
     IFhirStoreAdministration fhirStoreAdministration,
     IFhirIndex fhirIndex,
     ExamplesSettings examplesSettings,
     IIndexRebuildService indexRebuildService,
     ILogger <MaintenanceHub> logger,
     IHubContext <MaintenanceHub> hubContext)
 {
     _localhost               = localhost;
     _fhirService             = fhirService;
     _fhirStoreAdministration = fhirStoreAdministration;
     _fhirIndex               = fhirIndex;
     _examplesSettings        = examplesSettings;
     _indexRebuildService     = indexRebuildService;
     _logger     = logger;
     _hubContext = hubContext;
 }
예제 #22
0
        public static Conformance GetSparkConformance(string sparkVersion, ILocalhost localhost)
        {
            string      vsn         = Hl7.Fhir.Model.ModelInfo.Version;
            Conformance conformance = CreateServer("Spark", sparkVersion, "Furore", fhirVersion: vsn);

            conformance.AddAllCoreResources(readhistory: true, updatecreate: true, versioning: Conformance.ResourceVersionPolicy.VersionedUpdate);
            conformance.AddAllSystemInteractions().AddAllInteractionsForAllResources().AddCoreSearchParamsAllResources();
            conformance.AddSummaryForAllResources();
            conformance.AddOperation("Fetch Patient Record", new ResourceReference()
            {
                Url = localhost.Absolute(new Uri("OperationDefinition/Patient-everything", UriKind.Relative))
            });
            conformance.AddOperation("Generate a Document", new ResourceReference()
            {
                Url = localhost.Absolute(new Uri("OperationDefinition/Composition-document", UriKind.Relative))
            });
            conformance.AcceptUnknown = Conformance.UnknownContentCode.Both;
            conformance.Experimental  = true;
            conformance.Kind          = Conformance.ConformanceStatementKind.Capability;
            conformance.Format        = new string[] { "xml", "json" };
            conformance.Description   = "This FHIR SERVER is a reference Implementation server built in C# on HL7.Fhir.Core (nuget) by Furore and others";

            return(conformance);
        }
예제 #23
0
 public Transfer(IGenerator generator, ILocalhost localhost)
 {
     this.generator = generator;
     this.localhost = localhost;
 }
예제 #24
0
 public MongoSearcher(MongoIndexStore mongoIndexStore, ILocalhost localhost, IFhirModel fhirModel)
 {
     _collection = mongoIndexStore.Collection;
     _localhost = localhost;
     _fhirModel = fhirModel;
 }
예제 #25
0
 public Transfer(IGenerator generator, ILocalhost localhost)
 {
     this.generator = generator;
     this.localhost = localhost;
 }
예제 #26
0
        public static Key UriToKey(this ILocalhost localhost, string uristring)
        {
            Uri uri = new Uri(uristring, UriKind.RelativeOrAbsolute);

            return(localhost.UriToKey(uri));
        }
예제 #27
0
 public static Uri GetAbsoluteUri(this ILocalhost localhost, IKey key)
 {
     return(key.ToUri(localhost.DefaultBase));
 }
예제 #28
0
        //public static string GetOperationPath(this ILocalhost localhost, Uri uri)
        //{
        //    Key key = localhost.AnyUriToKey(uri).WithoutBase();

        //    return key.ToOperationPath();
        //    //Uri endpoint = localhost.GetBaseOf(uri);
        //    //string _base = endpoint.ToString();
        //    //string path = uri.ToString().Remove(0, _base.Length);
        //    //return path;
        //}

        public static Uri Uri(this ILocalhost localhost, params string[] segments)
        {
            return(new RestUrl(localhost.DefaultBase).AddPath(segments).Uri);
        }
예제 #29
0
 public static bool IsForeign(this ILocalhost localhost, IKey key)
 {
     return(!localhost.IsLocal(key));
 }
예제 #30
0
 private static Bundle.HTTPVerb ExtrapolateMethod(this ILocalhost localhost, Bundle.BundleEntryComponent entry, IKey key)
 {
     return(entry.Transaction.Method ?? DetermineMethod(localhost, key));
 }
예제 #31
0
        public static bool IsBaseOf(this ILocalhost localhost, string uristring)
        {
            Uri uri = new Uri(uristring, UriKind.RelativeOrAbsolute);

            return(localhost.IsBaseOf(uri));
        }
예제 #32
0
        public static ResourceManipulationOperation GetManipulationOperation(Bundle.EntryComponent entryComponent, ILocalhost localhost, ISearchService service = null)
        {
            searchService = service;
            Bundle.HTTPVerb method    = localhost.ExtrapolateMethod(entryComponent, null); //CCR: is key needed? Isn't method required?
            Key             key       = localhost.ExtractKey(entryComponent);
            var             searchUri = GetSearchUri(entryComponent, method);

            return(builders[method](entryComponent.Resource, key, service, searchUri != null? ParseQueryString(localhost, searchUri): null));
        }
예제 #33
0
 public Export(ILocalhost localhost)
 {
     this.localhost = localhost;
     interactions   = new List <Interaction>();
 }
예제 #34
0
 public static Uri Uri(this ILocalhost localhost, IKey key)
 {
     return(key.ToUri(localhost.Base));
 }
예제 #35
0
 public MongoSearcher(MongoIndexStore mongoIndexStore, ILocalhost localhost, IFhirModel fhirModel)
 {
     _collection = mongoIndexStore.Collection;
     _localhost  = localhost;
     _fhirModel  = fhirModel;
 }
예제 #36
0
 public CapabilityStatementService(ILocalhost localhost) => _localhost = localhost;
예제 #37
0
        public static CapabilityStatement GetSparkCapabilityStatement(string sparkVersion, ILocalhost localhost)
        {
            var vsn = FHIRVersion.N4_0_1;
            var capabilityStatement = CreateServer("Spark", sparkVersion, "Incendi", fhirVersion: vsn);

            capabilityStatement.AddAllCoreResources(
                true,
                true,
                CapabilityStatement.ResourceVersionPolicy.VersionedUpdate);
            capabilityStatement.AddAllSystemInteractions()
            .AddAllInteractionsForAllResources()
            .AddCoreSearchParamsAllResources();
            capabilityStatement.AddSummaryForAllResources();
            capabilityStatement.AddOperation(
                "Fetch Patient Record",
                localhost.Absolute(new Uri("OperationDefinition/Patient-everything", UriKind.Relative)).ToString());
            capabilityStatement.AddOperation(
                "Generate a Document",
                localhost.Absolute(new Uri("OperationDefinition/Composition-document", UriKind.Relative)).ToString());
            //capabilityStatement.AcceptUnknown = CapabilityStatement.UnknownContentCode.Both;
            capabilityStatement.Experimental = true;
            capabilityStatement.Kind         = CapabilityStatementKind.Capability;
            capabilityStatement.Format       = new string[] { "xml", "json" };
            capabilityStatement.Description  = new Markdown("This FHIR SERVER is a reference Implementation server built in C# on HL7.Fhir.Core (nuget) by Firely, Incendi and others");

            return(capabilityStatement);
        }
 public static Infrastructure AddLocalhost(this Infrastructure infrastructure, ILocalhost localhost)
 {
     infrastructure.Localhost = localhost;
     return infrastructure;
 }
예제 #39
0
 public MongoStoreBuilder(string mongoUrl, ILocalhost localhost)
 {
     this.mongoUrl  = mongoUrl;
     this.localhost = localhost;
 }
예제 #40
0
 public Export(ILocalhost localhost)
 {
     this.localhost = localhost;
     entries        = new List <Entry>();
 }
예제 #41
0
 public ReferenceNormalizationService(ILocalhost localhost) =>
예제 #42
0
 public static Bundle.HTTPVerb ExtrapolateMethod(this ILocalhost localhost, Bundle.EntryComponent entry, IKey key)
 {
     return(entry.Request?.Method ?? DetermineMethod(localhost, key));
 }
예제 #43
0
파일: Export.cs 프로젝트: Condeti/spark
 public Export(ILocalhost localhost)
 {
     this.localhost = localhost;
     interactions = new List<Interaction>();
 }
예제 #44
0
파일: Export.cs 프로젝트: tomhydra/spark
 public Export(ILocalhost localhost, ExportSettings exportSettings)
 {
     this.localhost      = localhost;
     this.exportSettings = exportSettings;
     entries             = new List <Entry>();
 }