Example #1
0
        public static async Task <TResource> ReadOneFromBundleWithContinuationAsync <TResource>(
            this Bundle bundle,
            IFhirService fhirService,
            bool throwOnMultipleFound = true)
            where TResource : Resource, new()
        {
            if (bundle == null)
            {
                return(null);
            }

            var resources = await bundle?.ReadFromBundleWithContinuationAsync <TResource>(fhirService, 2);

            var resourceCount = resources.Count();

            if (resourceCount == 0)
            {
                return(null);
            }

            if (throwOnMultipleFound && resourceCount > 1)
            {
                throw new MultipleResourceFoundException <TResource>(resourceCount);
            }

            return(resources.FirstOrDefault());
        }
 public MaintenanceService(IFhirService _fhirServiceFull, ILocalhost localhost, IGenerator keyGenerator, IFhirStoreAdministration fhirStoreAdministration, IFhirIndex fhirIndex)
 {
     this._fhirServiceFull        = _fhirServiceFull;
     this.localhost               = localhost;
     this.keyGenerator            = keyGenerator;
     this.fhirStoreAdministration = fhirStoreAdministration;
     this.fhirIndex               = fhirIndex;
 }
Example #3
0
 public ScopedFhirServiceBuilder(Uri baseUri, IStorageBuilder <TScope> storageBuilder,
                                 IServiceListener[] listeners = null)
 {
     this.baseUri        = baseUri;
     this.storageBuilder = storageBuilder;
     this.listeners      = listeners;
     this.fhirService    = FhirServiceFactory.GetFhirService(baseUri, storageBuilder, listeners);
 }
Example #4
0
 public MaintenanceHub(IFhirService fhirService, ILocalhost localhost, IFhirStoreAdministration fhirStoreAdministration, IFhirIndex fhirIndex, ExamplesSettings examplesSettings)
 {
     _localhost               = localhost;
     _fhirService             = fhirService;
     _fhirStoreAdministration = fhirStoreAdministration;
     _fhirIndex               = fhirIndex;
     _examplesSettings        = examplesSettings;
 }
Example #5
0
 public InitializerHub(IFhirService fhirService, ILocalhost localhost, IFhirStoreAdministration fhirStoreAdministration, IFhirIndex fhirIndex)
 {
     this.localhost               = localhost;
     this.fhirService             = fhirService;
     this.fhirStoreAdministration = fhirStoreAdministration;
     this.fhirIndex               = fhirIndex;
     this.resources               = null;
 }
Example #6
0
        public HttpResponseMessage ResourceDelete(string type, Key key, IFhirService service)
        {
            if (service != null)
            {
                return(service.Delete(key));
            }

            throw new ArgumentException("Service is null, cannot update resource of type " + type);
        }
Example #7
0
 public ObservationController(IFhirService fhirService, IObservationService observationService,
                              IConverter <Observation, ObservationDto> observationToDtoConverter,
                              IConverter <IList <Observation>, IList <ObservationDto> > observationsToDtoConverter)
 {
     _observationService         = observationService;
     _observationToDtoConverter  = observationToDtoConverter;
     _observationsToDtoConverter = observationsToDtoConverter;
     fhirService.Initialize();
 }
        public EndpointPipelineStep(
            IOptions <DicomWebConfiguration> dicomWebConfiguration,
            IFhirService fhirService)
        {
            EnsureArg.IsNotNull(dicomWebConfiguration?.Value, nameof(dicomWebConfiguration));
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));

            _fhirService      = fhirService;
            _dicomWebEndpoint = dicomWebConfiguration.Value.Endpoint.ToString();
        }
        public ImagingStudyUpsertHandler(
            IFhirService fhirService,
            IImagingStudySynchronizer imagingStudySynchronizer)
        {
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));
            EnsureArg.IsNotNull(imagingStudySynchronizer, nameof(_imagingStudySynchronizer));

            _fhirService = fhirService;
            _imagingStudySynchronizer = imagingStudySynchronizer;
        }
        public ImagingStudyDeleteHandler(
            IFhirService fhirService,
            IOptions <DicomWebConfiguration> dicomWebConfiguration)
        {
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));
            EnsureArg.IsNotNull(dicomWebConfiguration?.Value, nameof(dicomWebConfiguration));

            _fhirService      = fhirService;
            _dicomWebEndpoint = dicomWebConfiguration.Value.Endpoint.ToString();
        }
        public PatientPipelineStep(
            IFhirService fhirService,
            IPatientSynchronizer patientSynchronizer)
        {
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));
            EnsureArg.IsNotNull(patientSynchronizer, nameof(patientSynchronizer));

            _fhirService         = fhirService;
            _patientSynchronizer = patientSynchronizer;
        }
 public PatientService(IFhirService fhirService,
                       ICitizenshipService citizenshipService,
                       IConverter <PatientCsv, Patient> patientCsvToPatientConverter,
                       IConverter <PatientDto, Patient> patientDtoToPatientConverter)
 {
     _citizenshipService           = citizenshipService;
     _patientCsvToPatientConverter = patientCsvToPatientConverter;
     _patientDtoToPatientConverter = patientDtoToPatientConverter;
     fhirService.Initialize();
     _fhirClient = fhirService.Client;
 }
        public ImagingStudyDeleteHandlerTests()
        {
            _configuration = new DicomWebConfiguration()
            {
                Endpoint = new System.Uri(DefaultDicomWebEndpoint),
            };
            IOptions <DicomWebConfiguration> optionsConfiguration = Options.Create(_configuration);

            _fhirService = Substitute.For <IFhirService>();
            _imagingStudyDeleteHandler = new ImagingStudyDeleteHandler(_fhirService, optionsConfiguration);
        }
Example #14
0
 public PatientController(IFhirService fhirService, IPatientService patientService,
                          IConverter <Patient, PatientDetailDto> patientToDtoConverter,
                          IConverter <IList <Patient>, IList <PatientDetailDto> > patientsToDtoConverter,
                          IValidator <IList <PatientCsv> > patientsCsvValidator)
 {
     _patientService         = patientService;
     _patientToDtoConverter  = patientToDtoConverter;
     _patientsToDtoConverter = patientsToDtoConverter;
     _patientsCsvValidator   = patientsCsvValidator;
     fhirService.Initialize();
 }
        public ImagingStudyUpsertHandlerTests()
        {
            _configuration = new DicomWebConfiguration()
            {
                Endpoint = new System.Uri(DefaultDicomWebEndpoint),
            };
            IOptions <DicomWebConfiguration> optionsConfiguration = Options.Create(_configuration);

            _fhirService = Substitute.For <IFhirService>();
            _imagingStudySynchronizer  = new ImagingStudySynchronizer(new ImagingStudyPropertySynchronizer(), new ImagingStudySeriesPropertySynchronizer(), new ImagingStudyInstancePropertySynchronizer());
            _imagingStudyUpsertHandler = new ImagingStudyUpsertHandler(_fhirService, _imagingStudySynchronizer, optionsConfiguration);
        }
Example #16
0
        public ImagingStudyUpsertHandler(
            IFhirService fhirService,
            IImagingStudySynchronizer imagingStudySynchronizer,
            IOptions <DicomWebConfiguration> dicomWebConfiguration)
        {
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));
            EnsureArg.IsNotNull(imagingStudySynchronizer, nameof(_imagingStudySynchronizer));
            EnsureArg.IsNotNull(dicomWebConfiguration?.Value, nameof(dicomWebConfiguration));

            _fhirService = fhirService;
            _imagingStudySynchronizer = imagingStudySynchronizer;
            _dicomWebEndpoint         = dicomWebConfiguration.Value.Endpoint.ToString();
        }
Example #17
0
        public EndpointPipelineStepTests()
        {
            _configuration = new DicomWebConfiguration()
            {
                Endpoint = new System.Uri(DefaultDicomWebEndpoint),
            };

            IOptions <DicomWebConfiguration> optionsConfiguration = Options.Create(_configuration);

            _fhirService = Substitute.For <IFhirService>();

            _endpointPipeline = new EndpointPipelineStep(optionsConfiguration, _fhirService);
        }
Example #18
0
        public R4FhirImportService(
            IResourceIdentityService resourceIdentityService,
            IFhirService fhirService,
            IFhirTemplateProcessor <ILookupTemplate <IFhirTemplate>, Model.Observation> fhirTemplateProcessor,
            IMemoryCache observationCache,
            ITelemetryLogger logger)
        {
            _fhirTemplateProcessor = EnsureArg.IsNotNull(fhirTemplateProcessor, nameof(fhirTemplateProcessor));
            _fhirService           = EnsureArg.IsNotNull(fhirService, nameof(fhirService));
            _observationCache      = EnsureArg.IsNotNull(observationCache, nameof(observationCache));
            _logger = EnsureArg.IsNotNull(logger, nameof(logger));

            ResourceIdentityService = EnsureArg.IsNotNull(resourceIdentityService, nameof(resourceIdentityService));
        }
Example #19
0
        public HttpResponseMessage ResourceCreate(string type, Resource resource, IFhirService service)
        {
            if (service != null && !string.IsNullOrEmpty(type) && resource != null)
            {
                var key    = Key.Create(type);
                var result = service.Create(key, resource);
                if (result != null)
                {
                    return(result);
                }
            }

            return(new HttpResponseMessage(HttpStatusCode.Ambiguous));
        }
Example #20
0
        public DicomCastWorkerTests()
        {
            _cancellationToken = _cancellationTokenSource.Token;

            _dicomCastWorkerConfiguration.PollInterval = TimeSpan.Zero;

            _fhirService = Substitute.For <IFhirService>();

            _dicomCastWorker = new DicomCastWorker(
                Options.Create(_dicomCastWorkerConfiguration),
                _changeFeedProcessor,
                NullLogger <DicomCastWorker> .Instance,
                _hostApplication,
                _fhirService);
        }
Example #21
0
        public DicomCastWorker(
            IOptions <DicomCastWorkerConfiguration> dicomCastWorkerConfiguration,
            IChangeFeedProcessor changeFeedProcessor,
            ILogger <DicomCastWorker> logger,
            IHostApplicationLifetime hostApplicationLifetime,
            IFhirService fhirService)
        {
            EnsureArg.IsNotNull(dicomCastWorkerConfiguration?.Value, nameof(dicomCastWorkerConfiguration));
            EnsureArg.IsNotNull(changeFeedProcessor, nameof(changeFeedProcessor));
            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(hostApplicationLifetime, nameof(hostApplicationLifetime));
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));

            _dicomCastWorkerConfiguration = dicomCastWorkerConfiguration.Value;
            _changeFeedProcessor          = changeFeedProcessor;
            _logger = logger;
            _hostApplicationLifetime = hostApplicationLifetime;
            _fhirService             = fhirService;
        }
Example #22
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;
 }
Example #23
0
        private static async Task <IEnumerable <TResource> > ReadFromBundleWithContinuationAsync <TResource>(
            this Bundle bundle,
            IFhirService fhirService,
            int?count = null)
            where TResource : Resource
        {
            EnsureArg.IsNotNull(fhirService, nameof(fhirService));

            var resources = new List <TResource>();

            Action <Bundle> storeResources = (bundle) =>
            {
                foreach (var r in bundle.ReadFromBundle <TResource>(count))
                {
                    if (count == 0)
                    {
                        break;
                    }

                    resources.Add(r);
                    if (count != null)
                    {
                        count--;
                    }
                }
            };

            storeResources.Invoke(bundle);

            await foreach (var currentBundle in fhirService.IterateOverAdditionalBundlesAsync(bundle))
            {
                storeResources.Invoke(currentBundle);
            }

            return(resources);
        }
 public R4DeviceAndPatientWithEncounterLookupIdentityService(IFhirService fhirService)
     : base(fhirService)
 {
 }
Example #25
0
 public FhirController(IFhirService fhirService, SparkSettings settings)
 {
     _fhirService = fhirService ?? throw new ArgumentNullException(nameof(fhirService));
     _settings    = settings ?? throw new ArgumentNullException(nameof(settings));
 }
 public OrganizationService(IFhirService fhirService)
 {
     fhirService.Initialize();
     _fhirClient = fhirService.Client;
 }
Example #27
0
 public OrganizationController(IFhirService fhirService, IOrganizationService organizationService)
 {
     _organizationService = organizationService;
     fhirService.Initialize();
 }
Example #28
0
 public FhirController()
 {
     service = DependencyCoupler.Inject <IFhirService>();
 }
Example #29
0
 public FhirController(IFhirService fhirService)
 {
     // This will be a (injected) constructor parameter in ASP.vNext.
     _fhirService = fhirService;
 }
 public R4DeviceAndPatientWithEncounterLookupIdentityService(IFhirService fhirService, ResourceManagementService resourceIdService)
     : base(fhirService, resourceIdService)
 {
 }
Example #31
0
 public FhirController()
 {
     service = DependencyCoupler.Inject<IFhirService>();
 }