Skip to content

Commit

Permalink
Merge branch 'main' into pld-add-codeql
Browse files Browse the repository at this point in the history
  • Loading branch information
pld authored Apr 8, 2023
2 parents c9a0573 + 6f6163b commit d62e94b
Show file tree
Hide file tree
Showing 70 changed files with 1,166 additions and 1,032 deletions.
81 changes: 0 additions & 81 deletions .github/workflows/anc-release.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.2.2] - 2023-xx-xx
### Added

### Fixed
- Order the Registers after every form interaction tied to it
- Refactor register search to use SDK Search API to perform database query

### Changed

## [0.2.1] - 2023-03-27
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ FHIRcore also interoperates well with:
<img align=center width=400 src="docs/assets/fhircore.png">

## Getting Started

Due to it's dependency on the Android FHIR SDK's workflow library, OpenSRP FHIR Core requires a minimum Android SDK version of Android 8.0 (API level 26).

This repository contains the folders
* **[android](android)**: for building the Android application.
* **[docs](docs)**: a library of documents describing the FHIR Core solution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.google.android.fhir.search.has
import java.util.LinkedList
import javax.inject.Inject
import kotlinx.coroutines.withContext
import org.hl7.fhir.r4.model.Enumerations.DataType
import org.hl7.fhir.r4.model.Reference
import org.hl7.fhir.r4.model.Resource
import org.hl7.fhir.r4.model.ResourceType
Expand All @@ -41,7 +42,6 @@ import org.smartregister.fhircore.engine.data.local.DefaultRepository
import org.smartregister.fhircore.engine.domain.model.ActionParameter
import org.smartregister.fhircore.engine.domain.model.ActionParameterType
import org.smartregister.fhircore.engine.domain.model.DataQuery
import org.smartregister.fhircore.engine.domain.model.DataType
import org.smartregister.fhircore.engine.domain.model.FhirResourceConfig
import org.smartregister.fhircore.engine.domain.model.NestedSearchConfig
import org.smartregister.fhircore.engine.domain.model.RelatedResourceCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.os.Bundle
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
import org.hl7.fhir.r4.model.Enumerations
import org.smartregister.fhircore.engine.configuration.QuestionnaireConfig
import org.smartregister.fhircore.engine.configuration.profile.ManagingEntityConfig
import org.smartregister.fhircore.engine.configuration.workflow.ActionTrigger
Expand Down Expand Up @@ -71,7 +72,7 @@ data class ActionConfig(
data class ActionParameter(
val key: String,
val paramType: ActionParameterType? = null,
val dataType: DataType? = null,
val dataType: Enumerations.DataType? = null,
val value: String,
val linkId: String? = null
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalSerializationApi::class)

package org.smartregister.fhircore.engine.domain.model

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.JsonNames

/** Represents different types of parameters that can be defined within the config actions */
@Suppress("EXPLICIT_SERIALIZABLE_IS_REQUIRED")
enum class ActionParameterType {
/** Represents parameters that are used to pre-populate Questionnaire items with initial values */
@JsonNames("pre_populate", "PrePopulate") PREPOPULATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@

package org.smartregister.fhircore.engine.domain.model

/** Represents the set of possible set of data types that are used for the resource elements */
enum class DataType {
BOOLEAN,
DECIMAL,
INTEGER,
DATE,
DATETIME,
TIME,
STRING,
URI,
CODING,
QUANTITY
}
import android.os.Parcelable
import androidx.compose.runtime.Stable
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable

@Stable
@Serializable
@Parcelize
data class Code(var system: String? = null, var code: String? = null, var display: String? = null) :
Parcelable
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.smartregister.fhircore.engine.domain.model

import android.os.Parcelable
import ca.uhn.fhir.rest.param.ParamPrefixEnum
import com.google.android.fhir.search.Operation
import com.google.android.fhir.search.StringFilterModifier
import java.math.BigDecimal
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
import org.hl7.fhir.r4.model.Enumerations.DataType
import org.smartregister.fhircore.engine.util.serializers.BigDecimalSerializer
import org.smartregister.fhircore.engine.util.serializers.FilterCriterionSerializer

@Serializable
@Parcelize
data class DataQuery(
val paramName: String,
val operation: Operation = Operation.AND,
val filterCriteria: List<FilterCriterionConfig>
) : Parcelable

@Serializable(with = FilterCriterionSerializer::class)
@Parcelize
sealed class FilterCriterionConfig : Parcelable {

abstract val dataType: DataType

@Serializable
@Parcelize
data class QuantityFilterCriterionConfig(
override val dataType: DataType = DataType.QUANTITY,
val prefix: ParamPrefixEnum? = null,
@Serializable(with = BigDecimalSerializer::class) val value: BigDecimal? = null,
val system: String? = null,
val unit: String? = null
) : FilterCriterionConfig(), Parcelable

@Serializable
@Parcelize
data class DateFilterCriterionConfig(
override val dataType: DataType = DataType.DATETIME,
val prefix: ParamPrefixEnum = ParamPrefixEnum.GREATERTHAN_OR_EQUALS,
val valueDate: String? = null,
val valueDateTime: String? = null
) : FilterCriterionConfig(), Parcelable

@Serializable
@Parcelize
data class NumberFilterCriterionConfig(
override val dataType: DataType = DataType.DECIMAL,
val prefix: ParamPrefixEnum = ParamPrefixEnum.EQUAL,
@Serializable(with = BigDecimalSerializer::class) val value: BigDecimal? = null
) : FilterCriterionConfig(), Parcelable
@Serializable
@Parcelize
data class StringFilterCriterionConfig(
override val dataType: DataType = DataType.STRING,
val modifier: StringFilterModifier = StringFilterModifier.STARTS_WITH,
val value: String? = null
) : FilterCriterionConfig(), Parcelable

@Serializable
@Parcelize
data class UriFilterCriterionConfig(
override val dataType: DataType = DataType.URI,
val value: String? = null
) : FilterCriterionConfig(), Parcelable

@Serializable
@Parcelize
data class ReferenceFilterCriterionConfig(
override val dataType: DataType = DataType.REFERENCE,
val value: String? = null
) : FilterCriterionConfig(), Parcelable

@Serializable
@Parcelize
data class TokenFilterCriterionConfig(
override val dataType: DataType = DataType.CODE,
val value: Code? = null
) : FilterCriterionConfig(), Parcelable
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.os.Parcelable
import com.google.android.fhir.search.Order
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
import org.hl7.fhir.r4.model.Enumerations
import org.hl7.fhir.r4.model.ResourceType

/**
Expand Down Expand Up @@ -65,7 +66,7 @@ data class ResourceConfig(
@Parcelize
data class SortConfig(
val paramName: String,
val dataType: DataType,
val dataType: Enumerations.DataType,
val order: Order = Order.ASCENDING
) : Parcelable

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalSerializationApi::class)

package org.smartregister.fhircore.engine.domain.model

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.JsonNames
import org.smartregister.fhircore.engine.R

@Suppress("EXPLICIT_SERIALIZABLE_IS_REQUIRED")
enum class ServiceMemberIcon(val icon: Int) {
@JsonNames("child", "Child") CHILD(R.drawable.ic_kids),
@JsonNames("pregnant_woman", "PregnantWoman") PREGNANT_WOMAN(R.drawable.ic_pregnant)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalSerializationApi::class)

package org.smartregister.fhircore.engine.domain.model

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.JsonNames

/** Represents different types of views that can be rendered via compose */
@Suppress("EXPLICIT_SERIALIZABLE_IS_REQUIRED")
enum class ViewType {
/** Represent a vertical layout that arranges views one on top of the other */
@JsonNames("column", "Column") COLUMN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import com.google.android.fhir.logicalId
import java.util.TreeSet
import javax.inject.Inject
import kotlinx.coroutines.runBlocking
import org.hl7.fhir.r4.model.ResourceType
import org.json.JSONArray
import org.smartregister.fhircore.engine.configuration.ConfigurationRegistry
import org.smartregister.fhircore.engine.data.local.DefaultRepository
Expand All @@ -46,7 +45,6 @@ constructor(
override fun receiveJson(@NonNull type: DataType, @NonNull jsonArray: JSONArray): Long {
var maxLastUpdated = 0L
Timber.i("saving resources from base dai ${type.name} -> ${jsonArray.length()}")
val resourceTypes = ResourceType.values()
(0 until jsonArray.length()).forEach {
runBlocking {
val resource =
Expand Down
Loading

0 comments on commit d62e94b

Please sign in to comment.