예제 #1
0
        public async Task <IActionResult> ResetView()
        {
            PatientsList queriedPatients = await FhirService.GetObservationValues(AppContext.MonitorPatients);

            AppContext.MonitorPatients = queriedPatients;
            return(Json("Success"));
        }
예제 #2
0
        public async Task <ActionResult> LoginAsync(LoginViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // Get new Practitioner from input Id
            Practitioner newPractitioner;

            newPractitioner = await FhirService.GetPractitioner(model.Id);

            if (newPractitioner != null)
            {
                AppContext.Practitioner    = newPractitioner;
                AppContext.MonitorPatients = new PatientsList();

                // Notify observers of Practitioner
                AppContext.Practitioner.Notify();
                return(Redirect("/Practitioner/"));
            }
            else
            {
                TempData["ErrorMessage"] = "Practitioner Not Found. Please try again!";
                return(View("Login"));
            }
        }
예제 #3
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;
 }
예제 #4
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;
 }
 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 InitializeHub()
 {
     this.localhost = InfrastructureProvider.Mongo.Localhost;
     this.service   = InfrastructureProvider.Mongo.CreateService();
     this.store     = InfrastructureProvider.Mongo.Store;
     this.index     = InfrastructureProvider.Mongo.Index;
     this.resources = null;
 }
예제 #7
0
        public FhirServiceTests()
        {
            var fhirConfigurationOptions = Substitute.For <IOptions <FhirConfiguration> >();

            fhirConfigurationOptions.Value.Returns(new FhirConfiguration {
                Authentication = new AuthenticationConfiguration()
            });
            _fhirService = new FhirService(_fhirClient, _fhirResourceValidator, fhirConfigurationOptions);
        }
예제 #8
0
        /// <summary>
        /// Update PatientLists when the Practitioner changes
        /// </summary>
        /// <param name="subject"></param>
        /// <returns></returns>
        public async Task UpdateAsync(IObservableSubject subject)
        {
            IsLoading = true;
            if (_practitioner == null || (subject as Practitioner).Id != _practitioner.Id)
            {
                _practitioner = (Practitioner)subject;
                _patients     = await FhirService.GetPatientsOfPractitioner(_practitioner.Id);

                IsLoading = false;
            }
        }
        /// <summary>
        /// Ensures a patient and device resource exists and returns the relevant internal ids.
        /// </summary>
        /// <param name="input">IMeasurementGroup to retrieve device and patient identifiers from.</param>
        /// <returns>Internal reference id to the patient and device resources found or created.</returns>
        /// <exception cref="PatientIdentityNotDefinedException">Thrown when a unique patient identifier isn't found in the provided input.</exception>
        /// <exception cref="PatientDeviceMismatchException">Thrown when expected patient internal id of the device doesn't match the actual patient internal id.</exception>
        protected async virtual Task <(string DeviceId, string PatientId)> EnsureDeviceAndPatientExistsAsync(IMeasurementGroup input)
        {
            EnsureArg.IsNotNull(input, nameof(input));

            // Verify one unique patient identity is present in the measurement group

            if (string.IsNullOrWhiteSpace(input.PatientId))
            {
                throw new ResourceIdentityNotDefinedException(ResourceType.Patient);
            }

            // Begin critical section

            var patient = await ResourceManagementService.EnsureResourceByIdentityAsync <Model.Patient>(
                input.PatientId,
                null,
                (p, id) => p.Identifier = new List <Model.Identifier> {
                id
            })
                          .ConfigureAwait(false);

            var device = await ResourceManagementService.EnsureResourceByIdentityAsync <Model.Device>(
                GetDeviceIdentity(input),
                ResourceIdentityOptions?.DefaultDeviceIdentifierSystem,
                (d, id) =>
            {
                d.Identifier = new List <Model.Identifier> {
                    id
                };
                d.Patient = patient.ToReference();
            })
                         .ConfigureAwait(false);

            patient.ToReference();

            if (device.Patient == null)
            {
                device.Patient = patient.ToReference();
                device         = await FhirService.UpdateResourceAsync(device).ConfigureAwait(false);
            }
            else if (device.Patient.GetId <Model.Patient>() != patient.Id)
            {
                // Device is linked to a different patient.  Current behavior is undefined, throw an exception.
                throw new PatientDeviceMismatchException();
            }

            // End critical section

            return(device.Id, patient.Id);
        }
예제 #10
0
        public static FhirService GetFhirService(bool withUpdatedTags)
        {
            var authenticationConfiguration = new FhirServiceAuthenticationConfiguration(
                authority: authority,
                audience: audience,
                smartProxyEnabled: smartOnFhirEnabled);
            var workspace = new FhirService(
                tags: withUpdatedTags ? UpdateTags : DefaultTags,
                kind: "fhir-R4",
                location: DefaultLocation,
                authenticationConfiguration: authenticationConfiguration);

            return(workspace);
        }
예제 #11
0
        /// <summary>
        /// Handle Get More Data event in View
        /// </summary>
        /// <returns> Index View </returns>
        public async Task <ActionResult> GetData()
        {
            // execute async task with callback to avoid blocking the web app
            _ = FhirService.GetData().ContinueWith((data) =>
            {
                // Write fetched data to csv file
                MLHelpers.WriteToCsv(data.Result);

                // Save new fetched data to AppContext
                foreach (Patient p in data.Result)
                {
                    AppContext.AnalysisData.AddPatient(p);
                }
            });

            return(View("Index"));
        }
예제 #12
0
        public async Task <ActionResult> UpdateMonitor(List <string> ListId)
        {
            AppContext.MonitorPatients.IsLoading = true;
            PatientsList newMonitorList = new PatientsList();
            PatientsList queryPatients  = new PatientsList();

            // Only add Patients haven't queried observations to avoid repeated query
            // One patient only needs to query once at the first time it is selected
            foreach (Patient patient in AppContext.Patients)
            {
                if (ListId.Contains(patient.Id))
                {
                    patient.Selected = true;
                    if (!patient.HasObservations)
                    {
                        queryPatients.AddPatient(patient);
                    }
                    else
                    {
                        newMonitorList.AddPatient(patient);
                    }
                }
                else
                {
                    patient.Selected = false;
                }
            }

            // query list of patients haven't queried Cholesterol
            PatientsList queriedPatients = await FhirService.GetObservationValues(queryPatients);

            foreach (Patient patient in queriedPatients)
            {
                newMonitorList.AddPatient(patient);
            }


            AppContext.MonitorPatients = newMonitorList;

            return(View("Monitor"));
        }
예제 #13
0
 public FhirController()
 {
     service = Infra.Simple.CreateService();
     engine  = new Engine();
 }
예제 #14
0
 /// <summary>
 /// Creates or updates a FHIR Service resource with the specified parameters.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group that contains the service instance.
 /// </param>
 /// <param name='workspaceName'>
 /// The name of workspace resource.
 /// </param>
 /// <param name='fhirServiceName'>
 /// The name of FHIR Service resource.
 /// </param>
 /// <param name='fhirservice'>
 /// The parameters for creating or updating a Fhir Service resource.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <FhirService> BeginCreateOrUpdateAsync(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #15
0
        public void DoExampleInitialize()
        {
            var service = new FhirService(new Uri("http://localhost"));

            service.Initialize();
        }
예제 #16
0
 public FhirServiceTests()
 {
     _fhirService = new FhirService(_fhirClient, _fhirResourceValidator);
 }
예제 #17
0
 public FhirController()
 {
     service = DependencyCoupler.Inject <FhirService>();
 }
예제 #18
0
파일: Factory.cs 프로젝트: schellack/spark
        public static FhirMaintenanceService GetFhirMaintenanceService()
        {
            FhirService service = new FhirService(new Uri(Settings.Endpoint, "maintenance")); // example: http://spark.furore.com/maintenance/

            return(new FhirMaintenanceService(service));
        }
예제 #19
0
 public FhirController()
 {
     // This will be a (injected) constructor parameter in ASP.vNext.
     service = new FhirService(InfrastructureProvider.Mongo);
 }
예제 #20
0
 /// <summary>
 /// Creates or updates a FHIR Service resource with the specified parameters.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group that contains the service instance.
 /// </param>
 /// <param name='workspaceName'>
 /// The name of workspace resource.
 /// </param>
 /// <param name='fhirServiceName'>
 /// The name of FHIR Service resource.
 /// </param>
 /// <param name='fhirservice'>
 /// The parameters for creating or updating a Fhir Service resource.
 /// </param>
 public static FhirService BeginCreateOrUpdate(this IFhirServicesOperations operations, string resourceGroupName, string workspaceName, string fhirServiceName, FhirService fhirservice)
 {
     return(operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, fhirServiceName, fhirservice).GetAwaiter().GetResult());
 }
예제 #21
0
 public FhirController(FhirService fhirService)
 {
     // This will be a (injected) constructor parameter in ASP.vNext.
     _fhirService = fhirService;
 }