Skip to content

Commit

Permalink
Merge branch 'main' of github.com:opensrp/fhircore into 3641-update-t…
Browse files Browse the repository at this point in the history
…ask-status-on-draft-submission
  • Loading branch information
FikriMilano committed Dec 16, 2024
2 parents b4428f9 + 49b1e45 commit d698d55
Show file tree
Hide file tree
Showing 122 changed files with 3,282 additions and 1,923 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,7 @@ jobs:
force-avd-creation: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew clean -PlocalPropertiesFile=local.properties :quest:connectedOpensrpDebugAndroidTest --stacktrace -Pandroid.testInstrumentationRunnerArguments.notPackage=org.smartregister.fhircore.quest.performance

- name: Test UnitTest
run: ./gradlew clean -PlocalPropertiesFile=local.properties :quest:testOpensrpDebugUnitTest --stacktrace
working-directory: android
script: ./gradlew clean -PlocalPropertiesFile=local.properties :quest:fhircoreJacocoReport --stacktrace -Pandroid.testInstrumentationRunnerArguments.notPackage=org.smartregister.fhircore.quest.performance

- name: Run Quest module unit and instrumentation tests and generate aggregated coverage report (Disabled)
if: false
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1. Added a new class (PdfGenerator) for generating PDF documents from HTML content using Android's WebView and PrintManager
2. Introduced a new class (HtmlPopulator) to populate HTML templates with data from a Questionnaire Response
3. Implemented functionality to launch PDF generation using a configuration setup
- Added Save draft MVP functionality
- Added Save draft MVP functionality
- Added Delete saved draft feature
- Add configurable confirmation dialog on form submission

## [1.1.0] - 2024-02-15

Expand Down
4 changes: 2 additions & 2 deletions android/engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ dependencies {
implementation(libs.slf4j.nop)
implementation(libs.fhir.sdk.common)

// Shared dependencies
api(libs.bundles.datastore.kt)
api(libs.bundles.navigation)
api(libs.bundles.materialicons)
Expand All @@ -158,8 +159,6 @@ dependencies {
api(libs.bundles.okhttp3)
api(libs.bundles.paging)
api(libs.ui)

// Shared dependencies
api(libs.glide)
api(libs.knowledge) { exclude(group = "org.slf4j", module = "jcl-over-slf4j") }
api(libs.p2p.lib)
Expand Down Expand Up @@ -197,6 +196,7 @@ dependencies {
exclude(group = "com.google.android.fhir", module = "engine")
exclude(group = "org.smartregister", module = "engine")
exclude(group = "com.github.ben-manes.caffeine")
exclude(group = "com.google.android.fhir", module = "knowledge")
}
api(libs.contrib.barcode) {
isTransitive = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import java.util.PropertyResourceBundle
import java.util.ResourceBundle
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import kotlinx.serialization.json.Json
import okhttp3.RequestBody.Companion.toRequestBody
Expand Down Expand Up @@ -100,7 +98,6 @@ constructor(
val localizationHelper: LocalizationHelper by lazy { LocalizationHelper(this) }
private val supportedFileExtensions = listOf("json", "properties")
private var _isNonProxy = BuildConfig.IS_NON_PROXY_APK
private val mutex = Mutex()

/**
* Retrieve configuration for the provided [ConfigType]. The JSON retrieved from [configsJsonMap]
Expand Down Expand Up @@ -592,34 +589,30 @@ constructor(
* Note
*/
suspend fun <R : Resource> addOrUpdate(resource: R) {
withContext(dispatcherProvider.io()) {
try {
createOrUpdateRemote(resource)
} catch (sqlException: SQLException) {
Timber.e(sqlException)
}
try {
createOrUpdateRemote(resource)
} catch (sqlException: SQLException) {
Timber.e(sqlException)
}

/**
* Knowledge manager [MetadataResource]s install. Here we install all resources types of
* [MetadataResource] as per FHIR Spec.This supports future use cases as well
*/
try {
if (resource is MetadataResource) {
mutex.withLock {
knowledgeManager.install(
KnowledgeManagerUtil.writeToFile(
context = context,
configService = configService,
metadataResource = resource,
subFilePath =
"${KnowledgeManagerUtil.KNOWLEDGE_MANAGER_ASSETS_SUBFOLDER}/${resource.resourceType}/${resource.idElement.idPart}.json",
),
)
}
}
} catch (exception: Exception) {
Timber.e(exception)
/**
* Knowledge manager [MetadataResource]s install. Here we install all resources types of
* [MetadataResource] as per FHIR Spec.This supports future use cases as well
*/
try {
if (resource is MetadataResource) {
knowledgeManager.install(
KnowledgeManagerUtil.writeToFile(
context = context,
configService = configService,
metadataResource = resource,
subFilePath =
"${KnowledgeManagerUtil.KNOWLEDGE_MANAGER_ASSETS_SUBFOLDER}/${resource.resourceType}/${resource.idElement.idPart}.json",
),
)
}
} catch (exception: Exception) {
Timber.e(exception)
}
}

Expand All @@ -632,13 +625,11 @@ constructor(
* @param resources vararg of resources
*/
suspend fun createOrUpdateRemote(vararg resources: Resource) {
return withContext(dispatcherProvider.io()) {
resources.onEach {
it.updateLastUpdated()
it.generateMissingId()
}
fhirEngine.create(*resources, isLocalOnly = true)
resources.onEach {
it.updateLastUpdated()
it.generateMissingId()
}
fhirEngine.create(*resources, isLocalOnly = true)
}

@VisibleForTesting fun isNonProxy(): Boolean = _isNonProxy
Expand Down Expand Up @@ -750,7 +741,7 @@ constructor(
it.system.contentEquals(organizationResourceTag?.tag?.system, ignoreCase = true)
}
?.code
COUNT -> appConfig.remoteSyncPageSize.toString()
COUNT -> DEFAULT_COUNT.toString()
else -> paramExpression
}?.let { paramExpression?.replace(paramLiteral, it) }

Expand Down Expand Up @@ -801,7 +792,7 @@ constructor(
const val MANIFEST_PROCESSOR_BATCH_SIZE = 20
const val ORGANIZATION = "organization"
const val TYPE_REFERENCE_DELIMITER = "/"
const val DEFAULT_COUNT = 200
const val DEFAULT_COUNT = 1000
const val PAGINATION_NEXT = "next"
const val RESOURCES_PATH = "resources/"
const val SYNC_LOCATION_IDS = "_syncLocations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ data class QuestionnaireConfig(
val uniqueIdAssignment: UniqueIdAssignmentConfig? = null,
val linkIds: List<LinkIdConfig>? = null,
val showSubmitAnywayButton: String = "false",
val showSubmissionConfirmationDialog: String = "false",
) : java.io.Serializable, Parcelable {

fun interpolate(computedValuesMap: Map<String, Any>) =
Expand Down Expand Up @@ -102,6 +103,8 @@ data class QuestionnaireConfig(
linkIds = linkIds?.onEach { it.linkId.interpolate(computedValuesMap) },
saveButtonText = saveButtonText?.interpolate(computedValuesMap),
showSubmitAnywayButton = showSubmitAnywayButton.interpolate(computedValuesMap),
showSubmissionConfirmationDialog =
showSubmissionConfirmationDialog.interpolate(computedValuesMap),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.smartregister.fhircore.engine.configuration.app
import kotlinx.serialization.Serializable
import org.smartregister.fhircore.engine.configuration.ConfigType
import org.smartregister.fhircore.engine.configuration.Configuration
import org.smartregister.fhircore.engine.configuration.ConfigurationRegistry
import org.smartregister.fhircore.engine.configuration.event.EventWorkflow
import org.smartregister.fhircore.engine.domain.model.LauncherType
import org.smartregister.fhircore.engine.util.extension.DEFAULT_FORMAT_SDF_DD_MM_YYYY
Expand All @@ -28,7 +29,7 @@ data class ApplicationConfiguration(
override var appId: String,
override var configType: String = ConfigType.Application.name,
val appTitle: String = "",
val remoteSyncPageSize: Int = 100,
val remoteSyncPageSize: Int = ConfigurationRegistry.DEFAULT_COUNT,
val languages: List<String> = listOf("en"),
val useDarkTheme: Boolean = false,
val syncInterval: Long = 15,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ interface ConfigService {
/** Define a list of [ResourceTag] for the application. */
fun defineResourceTags(): List<ResourceTag>

/** Return the App's launcher icon for use in notifications */
fun getLauncherIcon(): Int

/**
* Provide a list of [Coding] that represents [ResourceTag]. [Coding] can be directly appended to
* a FHIR resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.smartregister.fhircore.engine.domain.model.RuleConfig
data class MigrationConfig(
val updateValues: List<UpdateValueConfig>,
val resourceConfig: FhirResourceConfig,
val rules: List<RuleConfig>,
val rules: List<RuleConfig> = emptyList(),
val version: Int,
val purgeAffectedResources: Boolean = false,
val createLocalChangeEntitiesAfterPurge: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ data class RegisterConfiguration(
val registerCard: RegisterCardConfig = RegisterCardConfig(),
val fabActions: List<NavigationMenuConfig> = emptyList(),
val noResults: NoResultsConfig? = null,
val pageSize: Int = 10,
val pageSize: Int = 20,
val activeResourceFilters: List<ActiveResourceFilterConfig> =
listOf(
ActiveResourceFilterConfig(resourceType = ResourceType.Patient, active = true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data class RegisterContentConfig(
val separator: String? = null,
val display: String? = null,
val placeholderColor: String? = null,
val rules: List<RuleConfig>? = null,
val rules: List<RuleConfig> = emptyList(),
val visible: Boolean? = null,
val computedRules: List<String>? = null,
val searchByQrCode: Boolean? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ enum class ApplicationWorkflow {

/** A workflow to launch pdf generation */
LAUNCH_PDF_GENERATION,

/** A workflow to launch delete draft questionnaires */
DELETE_DRAFT_QUESTIONNAIRE,
}
Loading

0 comments on commit d698d55

Please sign in to comment.