FhirResourceUtil

@Singleton
class FhirResourceUtil @Inject constructor(val appContext: Context, val defaultRepository: DefaultRepository, val configurationRegistry: ConfigurationRegistry)

Constructors

Link copied to clipboard
@Inject
constructor(appContext: Context, defaultRepository: DefaultRepository, configurationRegistry: ConfigurationRegistry)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun closeFhirResources()
Link copied to clipboard
suspend fun closeRelatedResources(resource: Resource)

This function fetches completed service requests from the local database. For each of the service requests functionality for closing related resources is triggered The related resources are configured in the application config file.

Link copied to clipboard
suspend fun expireOverdueTasks(): List<Task>

Fetches and returns tasks whose Task.status is either "requested", "ready", "accepted", "in-progress" and "received" and Task.restriction.period.end is <= today. It uses the maximum . The size of the tasks is between 0 to (tasksCount * 2).

Link copied to clipboard
suspend fun updateUpcomingTasksToDue(subject: Reference? = null, taskResourcesToFilterBy: List<Task>? = null)

This function updates upcoming Task s (with statuses TaskStatus.REQUESTED, TaskStatus.ACCEPTED or TaskStatus.RECEIVED) to due (updates the status to TaskStatus.READY). If the Task is dependent on another Task and it's parent TaskStatus is NOT TaskStatus.COMPLETED, the dependent Task status will not be updated to TaskStatus.READY. A Task should only be due when the start date of the Tasks Task.executionPeriod is before today and the status is TaskStatus.REQUESTED and the pre-requisite Task s are completed.