Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor register filter with REL tags #3488

Merged
merged 46 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
96dd00e
Refactor register filter with REL tags
ellykits Sep 11, 2024
055a1be
Update default pageSize to 15
ellykits Sep 11, 2024
960176c
Fix loading locations on map
ellykits Sep 11, 2024
c13157c
Refactor data structure used on base resource search results
ellykits Sep 12, 2024
8db0123
Merge branch 'main' of github.com:opensrp/fhircore into fix-register-…
dubdabasoduba Sep 12, 2024
06d81a9
Merge branch 'main' into fix-register-filters
dubdabasoduba Sep 12, 2024
7e5eaa2
Merge branch 'main' of github.com:opensrp/fhircore into fix-register-…
dubdabasoduba Sep 12, 2024
9cde0b2
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
dubdabasoduba Sep 12, 2024
3f4c49e
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
ellykits Sep 12, 2024
6c32e62
Refactor code
ellykits Sep 13, 2024
6ffbca0
Delete unnecessary code
ellykits Sep 13, 2024
3eeb9aa
Refactor retrieving related resources
ellykits Sep 15, 2024
fb0a037
Merge branch 'main' into fix-register-filters
ellykits Sep 15, 2024
94c13ff
Optimize data structures and perform parallel processing
ellykits Sep 15, 2024
20980f7
Use recent version of rules engine library
ellykits Sep 15, 2024
b01b59c
Refactor implementation for decoding image resources to bitmap
ellykits Sep 15, 2024
b232cce
Fix related resource count on register
ellykits Sep 16, 2024
398c987
Fix loading related resources
ellykits Sep 16, 2024
aca51d7
Batch related resource queries
ellykits Sep 16, 2024
2e3e48c
Map resources to RepositoryResourceData with async map
ellykits Sep 16, 2024
2eb9c85
Make infinite scroll the default register behavior
ellykits Sep 16, 2024
b3f838a
Disable automatic intialization of emoji2
ellykits Sep 16, 2024
e992b3f
:arrow_up: Update the map box and kujaku versions
dubdabasoduba Sep 17, 2024
1629429
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
dubdabasoduba Sep 17, 2024
77d1662
Run spotlessApply
ellykits Sep 17, 2024
513c805
Update tests for displaying images (#3506)
Lentumunai-Mark Sep 17, 2024
8546693
Refactor navigation to GeowidgetLauncher workflow
ellykits Sep 17, 2024
b5a0d3a
Load map data in batches (#3511)
ellykits Sep 19, 2024
59cdd69
Fix failing tests
ellykits Sep 19, 2024
05f3476
Batch searching when list might be large or when count is not defined…
LZRS Sep 19, 2024
7e73bba
Run spotlessApply
ellykits Sep 19, 2024
6d58736
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
ellykits Sep 19, 2024
dc90148
Merge branch 'main' into fix-register-filters
ellykits Sep 19, 2024
c15311b
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
ellykits Sep 19, 2024
e596774
Fix Geowidget tests
ellykits Sep 19, 2024
b12a4d3
Fix spotlessCheck
ellykits Sep 19, 2024
d5d1616
Merge branch 'main' into fix-register-filters
ellykits Sep 19, 2024
8725bf7
Add missing import
ellykits Sep 19, 2024
ab7ad29
Fix rules execution before map render
ellykits Sep 19, 2024
87f412a
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
dubdabasoduba Sep 19, 2024
30fe267
- Update android manifest to use exported values
dubdabasoduba Sep 19, 2024
e877ef0
Prevent leaking map features via viewmodel
ellykits Sep 19, 2024
d345724
Merge branch 'fix-register-filters' of github.com:opensrp/fhircore in…
ellykits Sep 19, 2024
6122067
Format code
ellykits Sep 19, 2024
633217d
Only search map features via keyboard action
ellykits Sep 19, 2024
d487f2d
Merge branch 'main' into fix-register-filters
dubdabasoduba Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions android/engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,7 @@ dependencies {
api(libs.timber)
api(libs.converter.gson)
api(libs.json.path)
api(libs.commons.jexl3) { exclude(group = "commons-logging", module = "commons-logging") }
api(libs.easy.rules.jexl) {
exclude(group = "commons-logging", module = "commons-logging")
exclude(group = "org.apache.commons", module = "commons-jexl3")
}
api(libs.easy.rules.jexl) { exclude(group = "commons-logging", module = "commons-logging") }
api(libs.data.capture) {
isTransitive = true
exclude(group = "ca.uhn.hapi.fhir")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import java.io.File
import java.io.FileNotFoundException
import java.io.InputStreamReader
import java.net.UnknownHostException
import java.util.LinkedList
import java.util.Locale
import java.util.PropertyResourceBundle
import java.util.ResourceBundle
Expand Down Expand Up @@ -61,8 +60,6 @@ import org.smartregister.fhircore.engine.configuration.app.ApplicationConfigurat
import org.smartregister.fhircore.engine.configuration.app.ConfigService
import org.smartregister.fhircore.engine.data.remote.fhir.resource.FhirResourceDataSource
import org.smartregister.fhircore.engine.di.NetworkModule
import org.smartregister.fhircore.engine.domain.model.FhirResourceConfig
import org.smartregister.fhircore.engine.domain.model.ResourceConfig
import org.smartregister.fhircore.engine.util.DispatcherProvider
import org.smartregister.fhircore.engine.util.SharedPreferenceKey
import org.smartregister.fhircore.engine.util.SharedPreferencesHelper
Expand Down Expand Up @@ -376,19 +373,23 @@ constructor(
* @return A list of strings of config files.
*/
private fun retrieveAssetConfigs(context: Context, appId: String): MutableList<String> {
val filesQueue = LinkedList<String>()
val filesQueue = ArrayDeque<String>()
val configFiles = mutableListOf<String>()
context.assets.list(String.format(BASE_CONFIG_PATH, appId))?.onEach {
if (!supportedFileExtensions.contains(it.fileExtension)) {
filesQueue.addLast(String.format(BASE_CONFIG_PATH, appId) + "/$it")
} else configFiles.add(String.format(BASE_CONFIG_PATH, appId) + "/$it")
} else {
configFiles.add(String.format(BASE_CONFIG_PATH, appId) + "/$it")
}
}
while (filesQueue.isNotEmpty()) {
val currentPath = filesQueue.removeFirst()
context.assets.list(currentPath)?.onEach {
if (!supportedFileExtensions.contains(it.fileExtension)) {
filesQueue.addLast("$currentPath/$it")
} else configFiles.add("$currentPath/$it")
} else {
configFiles.add("$currentPath/$it")
}
}
}
return configFiles
Expand Down Expand Up @@ -510,13 +511,14 @@ constructor(
val resultBundle =
if (isNonProxy()) {
fhirResourceDataSourceGetBundle(resourceType, resourceIdList)
} else
} else {
fhirResourceDataSource.post(
requestBody =
generateRequestBundle(resourceType, resourceIdList)
.encodeResourceToString()
.toRequestBody(NetworkModule.JSON_MEDIA_TYPE),
)
}

processResultBundleEntries(resultBundle.entry)

Expand Down Expand Up @@ -730,16 +732,6 @@ constructor(
}
}

private fun FhirResourceConfig.dependentResourceTypes(target: MutableList<ResourceType>) {
this.baseResource.dependentResourceTypes(target)
this.relatedResources.forEach { it.dependentResourceTypes(target) }
}

private fun ResourceConfig.dependentResourceTypes(target: MutableList<ResourceType>) {
target.add(resource)
relatedResources.forEach { it.dependentResourceTypes(target) }
}

suspend fun loadResourceSearchParams():
Pair<Map<String, Map<String, String>>, ResourceSearchParams> {
val syncConfig = retrieveResourceConfiguration<Parameters>(ConfigType.Sync)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import kotlinx.serialization.Serializable
import org.smartregister.fhircore.engine.domain.model.ActionConfig
import org.smartregister.fhircore.engine.util.extension.interpolate

const val ICON_TYPE_LOCAL = "local"
const val ICON_TYPE_REMOTE = "remote"

@Serializable
@Parcelize
data class NavigationMenuConfig(
Expand Down Expand Up @@ -53,9 +56,6 @@ data class ImageConfig(
}
}

const val ICON_TYPE_LOCAL = "local"
const val ICON_TYPE_REMOTE = "remote"

enum class ImageType {
JPEG,
PNG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ data class RegisterConfiguration(
val filterDataByRelatedEntityLocation: Boolean = false,
val topScreenSection: TopScreenSectionConfig? = null,
val onSearchByQrSingleResultActions: List<ActionConfig>? = null,
val infiniteScroll: Boolean = true,
) : Configuration() {
val onSearchByQrSingleResultValidActions =
onSearchByQrSingleResultActions?.filter { it.trigger == ActionTrigger.ON_SEARCH_SINGLE_RESULT }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ data class ButtonProperties(
val interpolated = this.status.interpolate(computedValuesMap)
return if (ServiceStatus.values().map { it.name }.contains(interpolated)) {
ServiceStatus.valueOf(interpolated)
} else ServiceStatus.UPCOMING
} else {
ServiceStatus.UPCOMING
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.smartregister.fhircore.engine.configuration.view

import java.util.LinkedList
import kotlinx.serialization.Serializable
import org.smartregister.fhircore.engine.domain.model.ViewType

Expand Down Expand Up @@ -47,18 +46,17 @@ abstract class ViewProperties : java.io.Serializable {
*/
fun List<ViewProperties>.retrieveListProperties(): List<ListProperties> {
val listProperties = mutableListOf<ListProperties>()
val viewPropertiesLinkedList: LinkedList<ViewProperties> = LinkedList(this)
while (viewPropertiesLinkedList.isNotEmpty()) {
val properties = viewPropertiesLinkedList.removeFirst()
val viewPropertiesQueue: ArrayDeque<ViewProperties> = ArrayDeque(this)
while (viewPropertiesQueue.isNotEmpty()) {
val properties = viewPropertiesQueue.removeFirst()
if (properties.viewType == ViewType.LIST) {
listProperties.add(properties as ListProperties)
}
when (properties.viewType) {
ViewType.COLUMN -> viewPropertiesLinkedList.addAll((properties as ColumnProperties).children)
ViewType.ROW -> viewPropertiesLinkedList.addAll((properties as RowProperties).children)
ViewType.CARD -> viewPropertiesLinkedList.addAll((properties as CardViewProperties).content)
ViewType.LIST ->
viewPropertiesLinkedList.addAll((properties as ListProperties).registerCard.views)
ViewType.COLUMN -> viewPropertiesQueue.addAll((properties as ColumnProperties).children)
ViewType.ROW -> viewPropertiesQueue.addAll((properties as RowProperties).children)
ViewType.CARD -> viewPropertiesQueue.addAll((properties as CardViewProperties).content)
ViewType.LIST -> viewPropertiesQueue.addAll((properties as ListProperties).registerCard.views)
else -> {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ object ViewPropertiesSerializer :
JsonContentPolymorphicSerializer<ViewProperties>(ViewProperties::class) {
override fun selectDeserializer(
element: JsonElement,
): DeserializationStrategy<out ViewProperties> {
): DeserializationStrategy<ViewProperties> {
val jsonObject = element.jsonObject
val viewType = jsonObject[VIEW_TYPE]?.jsonPrimitive?.content
require(viewType != null && ViewType.values().contains(ViewType.valueOf(viewType))) {
require(
viewType != null && ViewType.entries.toTypedArray().contains(ViewType.valueOf(viewType)),
) {
"""Ensure that supported `viewType` property is included in your register view properties configuration.
Supported types: ${ViewType.values()}
Supported types: ${ViewType.entries.toTypedArray()}
Parsed JSON: $jsonObject
"""
.trimMargin()
Expand Down
Loading
Loading