RegisterRepository

class RegisterRepository @Inject constructor(val fhirEngine: FhirEngine, val dispatcherProvider: DispatcherProvider, val sharedPreferencesHelper: SharedPreferencesHelper, val configurationRegistry: ConfigurationRegistry, val configService: ConfigService, val configRulesExecutor: ConfigRulesExecutor, val fhirPathDataExtractor: FhirPathDataExtractor, val parser: IParser, val context: Context) : DefaultRepository, Repository

Constructors

Link copied to clipboard
@Inject
constructor(fhirEngine: FhirEngine, dispatcherProvider: DispatcherProvider, sharedPreferencesHelper: SharedPreferencesHelper, configurationRegistry: ConfigurationRegistry, configService: ConfigService, configRulesExecutor: ConfigRulesExecutor, fhirPathDataExtractor: FhirPathDataExtractor, parser: IParser, context: Context)

Properties

Link copied to clipboard
Link copied to clipboard
open override val configService: ConfigService
Link copied to clipboard
Link copied to clipboard
open override val context: Context
Link copied to clipboard
Link copied to clipboard
open override val fhirEngine: FhirEngine
Link copied to clipboard
Link copied to clipboard
open override val parser: IParser
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun <R : Resource> addOrUpdate(addMandatoryTags: Boolean = true, resource: R)

This function upserts a resource into the database. This function also updates the Resource.meta and generates the Resource.id if it is missing before upserting the resource. The resource needs to already have a Resource.id.

suspend fun Search.applyFilterByRelatedEntityLocationMetaTag(baseResourceType: ResourceType, filterByRelatedEntityLocation: Boolean)
Link copied to clipboard
suspend fun changeManagingEntity(newManagingEntityId: String, groupId: String, managingEntityConfig: ManagingEntityConfig?)
Link copied to clipboard
suspend fun closeResource(resource: Resource, eventWorkflow: EventWorkflow)
Link copied to clipboard
inline suspend fun count(search: Search): Long
Link copied to clipboard
open suspend override fun countRegisterData(registerId: String, fhirResourceConfig: FhirResourceConfig?, paramsMap: Map<String, String>?): Long

Count register data for the provided registerId. Use the configured base resource filters

Link copied to clipboard
suspend fun create(addResourceTags: Boolean = true, vararg resource: Resource): List<String>

Saves a resource in the database. It also updates the Resource.meta _lastUpdated and generates the Resource.id if it is missing before saving the resource.

Link copied to clipboard
suspend fun createRemote(addResourceTags: Boolean = true, vararg resource: Resource)
Link copied to clipboard
suspend fun delete(resource: Resource, softDelete: Boolean = false)
suspend fun delete(resourceType: ResourceType, resourceId: String, softDelete: Boolean = false)
Link copied to clipboard
fun filterRelatedResource(resource: Resource, resourceConfig: ResourceConfig): Boolean

Filtering the Related Resources is achieved by use of the filterFhirPathExpression configuration. It specifies which field and values to filter the resources by.

Link copied to clipboard
suspend fun loadManagingEntity(group: Group): Patient?
Link copied to clipboard
open suspend override fun loadProfileData(profileId: String, resourceId: String, fhirResourceConfig: FhirResourceConfig?, paramsList: Array<ActionParameter>?): RepositoryResourceData

This function returns data used on the profile for the given resourceId. Profile configuration is identified by the profileId and contains the queries for filtering the profile data. Data is loaded based on the FhirResourceConfig. When none is provided the configurations identified by the profileId are used.

Link copied to clipboard
open suspend override fun loadRegisterData(currentPage: Int, registerId: String, fhirResourceConfig: FhirResourceConfig?, paramsMap: Map<String, String>?): List<RepositoryResourceData>

This function loads the desired register configuration using the provided registerId. The data query extracted from the retrieved configuration is used to filter the register data (FHIR resources wrapped in ResourceData

Link copied to clipboard
inline suspend fun <T : Resource> loadResource(resourceId: String): T?
suspend fun loadResource(reference: Reference): Resource
suspend fun loadResource(resourceId: String, resourceType: ResourceType): Resource
Link copied to clipboard
suspend fun purge(resource: Resource, forcePurge: Boolean)
Link copied to clipboard
suspend fun removeGroup(groupId: String, isDeactivateMembers: Boolean?, configComputedRuleValues: Map<String, Any>)
Link copied to clipboard
suspend fun removeGroupMember(memberId: String, groupId: String?, groupMemberResourceType: ResourceType?, configComputedRuleValues: Map<String, Any>)

Remove member of a group using the provided memberId and groupMemberResourceType

Link copied to clipboard
suspend fun retrieveFlattenedSubLocations(locationId: String): LinkedList<Location>
Link copied to clipboard
suspend fun retrieveUniqueIdAssignmentResource(uniqueIdAssignmentConfig: UniqueIdAssignmentConfig?, computedValuesMap: Map<String, Any>): Resource?
Link copied to clipboard
inline suspend fun <R : Resource> search(search: Search): List<R>
Link copied to clipboard
inline suspend fun <T : Resource> searchResourceFor(token: TokenClientParam, subjectType: ResourceType, subjectId: String, dataQueries: List<DataQuery> = listOf(), configComputedRuleValues: Map<String, Any>): List<T>
Link copied to clipboard
suspend fun searchResourcesRecursively(filterByRelatedEntityLocationMetaTag: Boolean, filterActiveResources: List<ActiveResourceFilterConfig>?, fhirResourceConfig: FhirResourceConfig, secondaryResourceConfigs: List<FhirResourceConfig>?, currentPage: Int? = null, pageSize: Int? = null, configRules: List<RuleConfig>?): List<RepositoryResourceData>
Link copied to clipboard
suspend fun <R : Resource> update(resource: R)
Link copied to clipboard
suspend fun updateResourcesRecursively(resourceConfig: ResourceConfig, subject: Resource? = null, eventWorkflow: EventWorkflow)

Data queries for retrieving resources require the id to be provided in the format ResourceType/UUID e.g Group/0acda8c9-3fa3-40ae-abcd-7d1fba7098b4. When resources are synced up to the server the id is updated with history information e.g Group/0acda8c9-3fa3-40ae-abcd-7d1fba7098b4/_history/1 This needs to be formatted to ResourceType/UUID format and updated in the computedValuesMap