Package-level declarations

Types

Link copied to clipboard
data class FhirValidatorResultsWrapper(val results: List<ResourceValidationResult> = emptyList())
Link copied to clipboard
Link copied to clipboard
data class ResourceValidationResult(val resource: Resource, val validationResult: ValidationResult)

Properties

Link copied to clipboard
val QuestionnaireResponse.allItems: List<QuestionnaireResponse.QuestionnaireResponseItemComponent>

Pre-order list of all questionnaire response items in the questionnaire.

Link copied to clipboard
Link copied to clipboard
const val DANGER_COLOR: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val QuestionnaireResponse.QuestionnaireResponseItemComponent.descendant: List<QuestionnaireResponse.QuestionnaireResponseItemComponent>

Pre-order list of descendants of the questionnaire response item (inclusive of the current item).

Link copied to clipboard
val MeasureReport.StratifierGroupComponent.displayText: String
Link copied to clipboard
const val ERROR_COLOR: String
Link copied to clipboard

This property returns the substring of the filepath after the last period '.' which is the extension

Link copied to clipboard
const val INFO_COLOR: String
Link copied to clipboard
val Questionnaire.QuestionnaireItemComponent.initialExpression: Expression?
Link copied to clipboard
val json: Json
Link copied to clipboard
const val PARTOF: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val REFERENCE: String
Link copied to clipboard

Returns a list of month-year for for all months falling in given measure period Example: Jan-2021 -> Apr-2021 = (Jan-2021), (Feb-2021), (Mar-2021), (Apr-2021)

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val SDF_MMM_YYYY: String
Link copied to clipboard
const val SDF_MMMM: String
Link copied to clipboard
const val SDF_YYYY: String
Link copied to clipboard
Link copied to clipboard
const val SDF_YYYY_MMM: String
Link copied to clipboard
const val SDFHH_MM: String
Link copied to clipboard
Link copied to clipboard
const val TRUE: String
Link copied to clipboard

Functions

Link copied to clipboard

Return an abbreviation for the provided string

Link copied to clipboard
fun Parameters.addResourceParameter(name: String, resource: Resource): Parameters
Link copied to clipboard
fun Resource.appendOrganizationInfo(authenticatedOrganizationIds: List<String>?)
Link copied to clipboard
fun Resource.appendPractitionerInfo(practitionerId: String?)
Link copied to clipboard
fun Resource.appendRelatedEntityLocation(questionnaireResponse: QuestionnaireResponse, questionnaireConfig: QuestionnaireConfig, context: Context)
Link copied to clipboard

This is required to fix keyboard overlapping content in a Composable screen. This functionality is applied after the setContent function of the activity is called.

Link copied to clipboard

Return a pair of application versionCode and versionName e.g. Pair(1, 0.0.1)

Link copied to clipboard
fun QuestionnaireResponse.QuestionnaireResponseItemComponent.asLabel(): String
Link copied to clipboard
fun Resource.asReference(): Reference
fun String.asReference(resourceType: ResourceType): Reference
Link copied to clipboard
fun calculateAge(date: Date, context: Context, localDateNow: LocalDate = LocalDate.now()): String

This function calculates the age from date then translates the abbreviation for the the periods. If year is 0 display the age in years, if year is 0 then display age in month and weeks, if month is 0 display age in weeks and days otherwise if week is 0 display age in days.

Link copied to clipboard
Link copied to clipboard

Function that converts snake_case string to camelCase

Link copied to clipboard
fun String.castToType(type: Enumerations.DataType): Type?

Cast string value (including json string) to the FHIR {@link org.hl7.fhir.r4.model.Type}

Link copied to clipboard
suspend fun FhirValidator.checkResourceValid(vararg resource: Resource, isDebug: Boolean = BuildConfig.DEBUG): FhirValidatorResultsWrapper
Link copied to clipboard
fun QuestionnaireResponse.clearText()

Clears the item text in the QuestionnaireResponse.

Link copied to clipboard
fun Observation.codingOf(code: String): Coding?
Link copied to clipboard
fun String.compare(anotherString: String): Boolean

Compare characters of identical strings

Link copied to clipboard
suspend fun FhirEngine.countUnSyncedResources(): List<Pair<String, Int>>
Link copied to clipboard
fun Questionnaire.cqfLibraryIds(): List<String>
Link copied to clipboard
fun Questionnaire.cqfLibraryUrls(): List<String>
Link copied to clipboard
Link copied to clipboard
inline fun <T> String.decodeJson(jsonInstance: Json? = null): T

Decode string to an entity of type T

Link copied to clipboard
fun <T> String.decodeResourceFromString(parser: IParser = fhirR4JsonParser): T
Link copied to clipboard
Link copied to clipboard
suspend fun QuestionnaireResponse.deleteRelatedResources(defaultRepository: DefaultRepository)

Delete resources in QuestionnaireResponse.contained from the database

Link copied to clipboard
inline fun <T> T.encodeJson(jsonInstance: Json? = null): String

Encode the type T into a Json string

Link copied to clipboard
fun Resource.encodeResourceToString(parser: IParser = fhirR4JsonParser): String
fun StructureMap.encodeResourceToString(parser: IParser = fhirR4JsonParser): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun expiredConcept(): CodeableConcept
Link copied to clipboard
fun Resource.extractAge(context: Context): String

Extract a Resource's age if birthDate is an available field

Link copied to clipboard
fun Resource.extractBirthDate(): Date?

Extract a Resource's birthDate if it's an available field

Link copied to clipboard
fun Questionnaire.extractByStructureMap(): Boolean
Link copied to clipboard
fun Patient.extractFamilyTag(): Coding?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Resource.extractGender(context: Context): String

Extracts and returns a translated string for the gender in the resource

Link copied to clipboard
fun Reference.extractId(): String
Link copied to clipboard

A function that extracts only the UUID part of a resource logicalId.

Link copied to clipboard
fun Reference.extractType(): ResourceType?
Link copied to clipboard
fun Search.filterBy(dataQuery: DataQuery, configComputedRuleValues: Map<String, Any>)

This extension function is used to configure DataQuery s against the Search DSL. This extension covers all queries for for the supported DataType s. Filters of the same DataType are grouped together in a query and a configured DataQuery.operation is used to determine either to use either 'AND' or 'OR' in the where clause of the Query. Optional configComputedRuleValues is provided to substitute FilterCriterionConfig.computedRule placeholders with actual values.

Link copied to clipboard
fun List<RepositoryResourceData>.filterByFhirPathExpression(fhirPathDataExtractor: FhirPathDataExtractor, conditionalFhirPathExpressions: List<String>?, matchAll: Boolean): List<RepositoryResourceData>

Filter provided Resource's using FhirPath expressions. The extracted FHIRPath value is REQUIRED to be a boolean otherwise the toBoolean function will evaluate to false and hence return an empty list.

Link copied to clipboard
fun Search.filterByResourceTypeId(reference: ReferenceClientParam, resourceType: ResourceType, resourceId: String)
fun Search.filterByResourceTypeId(token: TokenClientParam, resourceType: ResourceType, resourceId: String)
Link copied to clipboard
fun Questionnaire.find(linkId: String): Questionnaire.QuestionnaireItemComponent?
fun QuestionnaireResponse.find(linkId: String): QuestionnaireResponse.QuestionnaireResponseItemComponent?
fun List<QuestionnaireResponse.QuestionnaireResponseItemComponent>.find(linkId: String, default: QuestionnaireResponse.QuestionnaireResponseItemComponent?): QuestionnaireResponse.QuestionnaireResponseItemComponent?
fun Questionnaire.find(fieldType: FieldType, value: String): List<Questionnaire.QuestionnaireItemComponent>
fun List<Questionnaire.QuestionnaireItemComponent>.find(fieldType: FieldType, value: String, target: MutableList<Questionnaire.QuestionnaireItemComponent>)
Link copied to clipboard
fun MeasureReport.MeasureReportGroupComponent.findCount(): MeasureReport.MeasureReportGroupPopulationComponent?
fun MeasureReport.StratifierGroupComponent.findCount(): MeasureReport.StratifierGroupPopulationComponent?
Link copied to clipboard
fun MeasureReport.StratifierGroupComponent.findPercentage(denominator: Int, reportConfiguration: ReportConfiguration?): String
Link copied to clipboard
fun MeasureReport.MeasureReportGroupComponent.findPopulation(id: MeasurePopulationType): MeasureReport.MeasureReportGroupPopulationComponent?
fun MeasureReport.StratifierGroupComponent.findPopulation(id: MeasurePopulationType): MeasureReport.StratifierGroupPopulationComponent?
Link copied to clipboard
fun MeasureReport.MeasureReportGroupComponent.findRatio(): String
fun MeasureReport.StratifierGroupComponent.findRatio(denominator: Int?): String
Link copied to clipboard
fun MeasureReport.MeasureReportGroupComponent.findStratumForMonth(reportingMonth: String): MeasureReport.StratifierGroupComponent?
Link copied to clipboard
fun QuestionnaireResponse.findSubject(bundle: Bundle?): Resource?
Link copied to clipboard
Link copied to clipboard
fun DateType.format(): String
Link copied to clipboard
fun Date.formatDate(pattern: String = "dd-MMM-yyyy"): String
Link copied to clipboard
Link copied to clipboard
fun Resource.generateMissingId()
Link copied to clipboard
fun List<Questionnaire.QuestionnaireItemComponent>.generateMissingItems(qrItems: MutableList<QuestionnaireResponse.QuestionnaireResponseItemComponent>)
fun QuestionnaireResponse.generateMissingItems(questionnaire: Questionnaire)
Link copied to clipboard
Link copied to clipboard
fun FhirContext.getCustomJsonParser(): IParser
Link copied to clipboard
fun View.getDrawable(drawableResourceId: Int): Drawable?
Link copied to clipboard
fun QuestionnaireResponse.getEncounterId(): String?
Link copied to clipboard
fun RequestBody.getPayload(): String
Link copied to clipboard
Link copied to clipboard
fun Task.hasPastEnd(): Boolean
Link copied to clipboard
fun Task.hasStarted(): Boolean
Link copied to clipboard
fun View.hide(gone: Boolean = true)
Link copied to clipboard
fun String.interpolate(lookupMap: Map<String, Any>, prefix: String = DEFAULT_PLACEHOLDER_PREFIX, suffix: String = DEFAULT_PLACEHOLDER_SUFFIX): String

Sample template string: { "saveFamilyButtonText" : {{ family.button.save }} } Sample properties file content: family.button.save=Save Family

Link copied to clipboard

This function checks if the device is online

Link copied to clipboard
fun Task.isDue(): Boolean
Link copied to clipboard
fun <T : Enum<T>> Enum<T>.isIn(vararg values: Enum<T>): Boolean
Link copied to clipboard
fun MeasureReport.MeasureReportGroupComponent.isMonthlyReport(): Boolean
Link copied to clipboard
fun Task.isOverDue(): Boolean
Link copied to clipboard
fun Task.isPastExpiry(): Boolean
Link copied to clipboard
fun Task.isReady(): Boolean
Link copied to clipboard
Link copied to clipboard
fun Task.isUpcoming(): Boolean
Link copied to clipboard
fun isValidResourceType(resourceCode: String): Boolean
Link copied to clipboard
fun String?.join(other: String?, separator: String): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <A : Activity> Activity.launchActivityWithNoBackStackHistory(finishLauncherActivity: Boolean = true, bundle: Bundle = bundleOf())

This function launches another Activity on top of the current. The current Activity is cleared from the back stack for launching the next activity then the current Activity is finished based on finishLauncherActivity condition.

Link copied to clipboard
suspend fun FhirEngine.loadCqlLibraryBundle(fhirOperator: FhirOperator, measurePath: String): Any?
Link copied to clipboard
suspend fun FhirEngine.loadLibraryAtPath(fhirOperator: FhirOperator, path: String)
suspend fun FhirEngine.loadLibraryAtPath(fhirOperator: FhirOperator, relatedArtifact: RelatedArtifact)
Link copied to clipboard
inline suspend fun <T : Resource> FhirEngine.loadResource(resourceId: String): T?
Link copied to clipboard
fun Date?.makeItReadable(pattern: String = "dd-MMM-yyyy"): String
Link copied to clipboard
fun String.messageFormat(locale: Locale?, vararg arguments: Any?): String?

Wrapper method around the Java text formatter

Link copied to clipboard
Link copied to clipboard
fun QuestionnaireResponse.packRepeatedGroups()

Borrows from: https://github.com/google/android-fhir/pull/1936

Link copied to clipboard
inline fun <T : Parcelable> Intent.parcelable(key: String): T?
inline fun <T : Parcelable> Bundle.parcelable(key: String): T?
Link copied to clipboard
Link copied to clipboard

Parse this String to a color code to be used in compose. Color code must either a). begin with pound sign ('#') and should be of 6 valid characters or b). be equal to 'primaryColor', 'primaryVariantColor' or 'errorColor'

Link copied to clipboard
fun String.parseDate(pattern: String): Date?
Link copied to clipboard
fun Date.plusDays(days: Int): Date
Link copied to clipboard
fun Date.plusMonths(months: Int, startOfMonth: Boolean = false): Date
Link copied to clipboard
fun DateType.plusMonthsAsString(months: Int): String
Link copied to clipboard
fun DateType.plusWeeksAsString(weeks: Int): String
Link copied to clipboard
fun Date.plusYears(years: Int): Date
Link copied to clipboard

Get the practitioner endpoint url and append the keycloak-uuid. The original String is assumed to be a keycloak-uuid.

Link copied to clipboard
fun List<Questionnaire.QuestionnaireItemComponent>.prepareQuestionsForEditing(path: String = "QuestionnaireResponse.item", readOnlyLinkIds: List<String>? = emptyList())

Set all questions that are not of type Questionnaire.QuestionnaireItemType.GROUP to readOnly if readOnlyLinkIds item are there while editing the form. This also generates the correct FHIRPath population expression for each question when mapped to the corresponding QuestionnaireResponse

Link copied to clipboard
fun List<Questionnaire.QuestionnaireItemComponent>.prepareQuestionsForReadingOrEditing(path: String = "QuestionnaireResponse.item", readOnly: Boolean = false, readOnlyLinkIds: List<String>? = emptyList())

Set all questions that are not of type Questionnaire.QuestionnaireItemType.GROUP to readOnly if readOnly is true. This also generates the correct FHIRPath population expression for each question when mapped to the corresponding QuestionnaireResponse

Link copied to clipboard
fun List<Questionnaire.QuestionnaireItemComponent>.prePopulateInitialValues(interpolationPrefix: String, prePopulationParams: List<ActionParameter>)

Pre-Populate Questionnaire items with initial values

Link copied to clipboard
suspend fun Questionnaire.prepopulateUniqueIdAssignment(questionnaireConfig: QuestionnaireConfig, questionnaireComputedValues: Map<String, Any>, extractUniqueIdAssignmentFunc: suspend (UniqueIdAssignmentConfig, Map<String, Any>) -> String)

Pre-populates questionnaire with computed QuestionnaireConfig.uniqueIdAssignment.

Link copied to clipboard
suspend fun Questionnaire.prepopulateWithComputedConfigValues(questionnaireConfig: QuestionnaireConfig, actionParameters: List<ActionParameter>?, questionnaireConfigRulesComputeFunc: (List<RuleConfig>) -> Map<String, Any>, extractUniqueIdAssignmentFunc: suspend (UniqueIdAssignmentConfig, Map<String, Any>) -> String): Map<String, Any>

Pre-populates questionnaire with computed values from the Rules engine as well as include initial values set on configured QuestionnaireConfig.barcodeLinkId or QuestionnaireConfig.uniqueIdAssignment properties.

Link copied to clipboard
Link copied to clipboard
fun Resource.referenceParamForCondition(): ReferenceClientParam
Link copied to clipboard
fun Resource.referenceParamForObservation(): ReferenceClientParam
Link copied to clipboard
fun Resource.referenceValue(): String
Link copied to clipboard
Link copied to clipboard

Remove double white spaces from text and also remove space before comma

Link copied to clipboard
fun String.resourceClassType(): Class<out Resource>
Link copied to clipboard
fun QuestionnaireResponse.retainMetadata(questionnaireResponse: QuestionnaireResponse)
Link copied to clipboard
fun Composition.retrieveCompositionSections(): List<Composition.SectionComponent>

Composition sections can be nested. This function retrieves all the nested composition sections and returns a flattened list of all Composition.SectionComponent for the given Composition resource

fun ImplementationGuide.retrieveImplementationGuideDefinitionResources(): List<ImplementationGuide.ImplementationGuideDefinitionResourceComponent>
inline suspend fun FhirEngine.retrievePreviouslyGeneratedMeasureReports(startDateFormatted: String, endDateFormatted: String, measureUrl: String, subjects: List<String>): List<MeasureReport>
Link copied to clipboard
fun Context.retrieveResourceId(resourceName: String?, resourceType: String = "drawable"): Int?
Link copied to clipboard
fun BigDecimal?.rounding(roundingStrategy: RoundingStrategy, roundingPrecision: Int): String
Link copied to clipboard
suspend fun FhirEngine.searchCompositionByIdentifier(identifier: String): Composition?
Link copied to clipboard
fun <T> List<T>.second(): T

This function returns the second element of the List. It complements the existing kotlin List.first() and List.last() extensions

Link copied to clipboard
inline fun <T : Serializable> Intent.serializable(key: String): T?
Link copied to clipboard
Link copied to clipboard
fun Resource.setPropertySafely(name: String, value: Base): Base?
Link copied to clipboard
fun View.show()
Link copied to clipboard
fun Context.showToast(message: String, toastLength: Int = Toast.LENGTH_LONG)
Link copied to clipboard
Link copied to clipboard
fun CodeableConcept.stringValue(): String
Link copied to clipboard
fun Task.TaskStatus.toCoding(): Coding
Link copied to clipboard
fun today(): Date
Link copied to clipboard
Link copied to clipboard
fun Enumerations.AdministrativeGender.translateGender(context: Context): String
Link copied to clipboard

Creates identifier from string text by doing clean up on the passed value

Link copied to clipboard
inline fun <T> String.tryDecodeJson(jsonInstance: Json? = null): T?

Decode string to an entity of type T or return null if json is invalid

Link copied to clipboard

Parses a string that represents a duration in ISO-8601 format and returns the parsed Duration value. If parsing fails a default of 1 day duration value is returned

Link copied to clipboard
suspend fun Task.updateDependentTaskDueDate(defaultRepository: DefaultRepository): Task

This suspend function updates the due date of the dependents of the current Task, based on the date of a related Immunization. The function loops through all the tasks that are part-of the current task, loads the dependent tasks and their related immunization resources from the DefaultRepository then updates the start date of the dependent task if it's scheduled to start before the immunization date plus the required number of days.

Link copied to clipboard
fun <T : Resource> T.updateFrom(updatedResource: Resource): T
Link copied to clipboard
fun Resource.updateLastUpdated()
Link copied to clipboard
fun Observation.valueCode(): String?
Link copied to clipboard
fun Base?.valueToString(datePattern: String = "dd-MMM-yyyy"): String
Link copied to clipboard
Link copied to clipboard