public async Task <IActionResult> ResetView() { PatientsList queriedPatients = await FhirService.GetObservationValues(AppContext.MonitorPatients); AppContext.MonitorPatients = queriedPatients; return(Json("Success")); }
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")); } }
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; }
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; }
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; }
public FhirServiceTests() { var fhirConfigurationOptions = Substitute.For <IOptions <FhirConfiguration> >(); fhirConfigurationOptions.Value.Returns(new FhirConfiguration { Authentication = new AuthenticationConfiguration() }); _fhirService = new FhirService(_fhirClient, _fhirResourceValidator, fhirConfigurationOptions); }
/// <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); }
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); }
/// <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")); }
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")); }
public FhirController() { service = Infra.Simple.CreateService(); engine = new Engine(); }
/// <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); } }
public void DoExampleInitialize() { var service = new FhirService(new Uri("http://localhost")); service.Initialize(); }
public FhirServiceTests() { _fhirService = new FhirService(_fhirClient, _fhirResourceValidator); }
public FhirController() { service = DependencyCoupler.Inject <FhirService>(); }
public static FhirMaintenanceService GetFhirMaintenanceService() { FhirService service = new FhirService(new Uri(Settings.Endpoint, "maintenance")); // example: http://spark.furore.com/maintenance/ return(new FhirMaintenanceService(service)); }
public FhirController() { // This will be a (injected) constructor parameter in ASP.vNext. service = new FhirService(InfrastructureProvider.Mongo); }
/// <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()); }
public FhirController(FhirService fhirService) { // This will be a (injected) constructor parameter in ASP.vNext. _fhirService = fhirService; }