Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 49 additions & 14 deletions core/api/core.api

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions core/src/main/assets/migrations/181.sql
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,11 @@ ALTER TABLE TrackedEntityAttributeLegendSetLink RENAME TO TrackedEntityAttribute
CREATE TABLE TrackedEntityAttributeLegendSetLink(trackedEntityAttribute TEXT NOT NULL, legendSet TEXT NOT NULL, sortOrder INTEGER NOT NULL, PRIMARY KEY(trackedEntityAttribute, legendSet), FOREIGN KEY(trackedEntityAttribute) REFERENCES TrackedEntityAttribute(uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY(legendSet) REFERENCES LegendSet(uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED);
INSERT INTO TrackedEntityAttributeLegendSetLink(trackedEntityAttribute, legendSet, sortOrder) SELECT trackedEntityAttribute, legendSet, sortOrder FROM TrackedEntityAttributeLegendSetLink_Old;
DROP TABLE IF EXISTS TrackedEntityAttributeLegendSetLink_Old;


# Add tracker custom terminology plurals labels (ANDROSDK-2275)
ALTER TABLE Program ADD COLUMN displayEnrollmentsLabel TEXT;
ALTER TABLE Program ADD COLUMN displayProgramStagesLabel TEXT;
ALTER TABLE Program ADD COLUMN displayEventsLabel TEXT;
ALTER TABLE ProgramStage ADD COLUMN displayEventsLabel TEXT;
ALTER TABLE TrackedEntityType ADD COLUMN displayTrackedEntityTypesLabel TEXT;
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,16 @@ data class Program(
val featureType: FeatureType?,
val accessLevel: AccessLevel?,
val displayEnrollmentLabel: String?,
val displayEnrollmentsLabel: String?,
val displayFollowUpLabel: String?,
val displayOrgUnitLabel: String?,
val displayRelationshipLabel: String?,
val displayNoteLabel: String?,
val displayTrackedEntityAttributeLabel: String?,
val displayProgramStageLabel: String?,
val displayProgramStagesLabel: String?,
val displayEventLabel: String?,
val displayEventsLabel: String?,
val attributeValues: List<AttributeValue>?,
val enrollmentCategoryCombo: ObjectWithUid,
internal val categoryMappings: List<CategoryMapping>?,
Expand Down Expand Up @@ -135,6 +138,8 @@ data class Program(
fun enrollmentLabel(): String? = displayEnrollmentLabel
fun displayEnrollmentLabel(): String? = displayEnrollmentLabel

fun displayEnrollmentsLabel(): String? = displayEnrollmentsLabel

@Deprecated("since v41, replaced by displayFollowUpLabel()")
fun followUpLabel(): String? = displayFollowUpLabel
fun displayFollowUpLabel(): String? = displayFollowUpLabel
Expand All @@ -159,10 +164,14 @@ data class Program(
fun programStageLabel(): String? = displayProgramStageLabel
fun displayProgramStageLabel(): String? = displayProgramStageLabel

fun displayProgramStagesLabel(): String? = displayProgramStagesLabel

@Deprecated("since v41, replaced by displayEventLabel()")
fun eventLabel(): String? = displayEventLabel
fun displayEventLabel(): String? = displayEventLabel

fun displayEventsLabel(): String? = displayEventsLabel

fun attributeValues(): List<AttributeValue>? = attributeValues
fun enrollmentCategoryCombo(): ObjectWithUid = enrollmentCategoryCombo
internal fun categoryMappings(): List<CategoryMapping>? = categoryMappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ data class ProgramStage(
val validationStrategy: ValidationStrategy?,
val displayProgramStageLabel: String?,
Comment thread
andresmr marked this conversation as resolved.
val displayEventLabel: String?,
val displayEventsLabel: String?,
val attributeValues: List<AttributeValue>?,
override val style: ObjectStyle,
) : BaseIdentifiableObjectKt, CoreObject, ObjectWithStyleKt {
Expand Down Expand Up @@ -129,6 +130,7 @@ data class ProgramStage(
fun eventLabel(): String? = displayEventLabel
fun displayEventLabel(): String? = displayEventLabel

fun displayEventsLabel(): String? = displayEventsLabel
fun attributeValues(): List<AttributeValue>? = attributeValues

fun toBuilder(): Builder = ProgramStageBuilder.from(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ data class TrackedEntityType(
val featureType: FeatureType?,
val access: Access,
override val style: ObjectStyle,
val displayTrackedEntityTypesLabel: String?,
) : BaseNameableObjectKt, CoreObject, ObjectWithStyleKt {

fun trackedEntityTypeAttributes(): List<TrackedEntityTypeAttribute>? = trackedEntityTypeAttributes
fun featureType(): FeatureType? = featureType
fun access(): Access = access
fun displayTrackedEntityTypesLabel(): String? = displayTrackedEntityTypesLabel

fun toBuilder(): Builder = TrackedEntityTypeBuilder.from(this)

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

package org.hisp.dhis.android.network.program

import android.system.Os.access

@vgarciabnz vgarciabnz Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not intentional, is it? I don't know why it was not detected by the checks...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know why this was added, will remove it

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.hisp.dhis.android.core.common.FeatureType
Expand Down Expand Up @@ -91,6 +92,7 @@ internal data class ProgramDTO(
val accessLevel: String?,
val enrollmentLabel: String?,
val displayEnrollmentLabel: String?,
val displayEnrollmentsLabel: String?,
val followUpLabel: String?,
val displayFollowUpLabel: String?,
val orgUnitLabel: String?,
Expand All @@ -103,8 +105,10 @@ internal data class ProgramDTO(
val displayTrackedEntityAttributeLabel: String?,
val programStageLabel: String?,
val displayProgramStageLabel: String?,
val displayProgramStagesLabel: String?,
val eventLabel: String?,
val displayEventLabel: String?,
val displayEventsLabel: String?,
val attributeValues: List<AttributeValueDTO>?,
val enrollmentCategoryCombo: CategoryComboWithFallbackDTO = CategoryComboWithFallbackDTO(null),
val categoryMappings: List<CategoryMappingDTO>?,
Expand Down Expand Up @@ -142,13 +146,16 @@ internal data class ProgramDTO(
featureType(featureType?.let { FeatureType.valueOf(it) })
accessLevel(accessLevel?.let { AccessLevel.valueOf(accessLevel) })
displayEnrollmentLabel(displayEnrollmentLabel ?: enrollmentLabel)
displayEnrollmentsLabel(displayEnrollmentsLabel ?: enrollmentLabel)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we should default to the singular value here, at least not in the SDK. It is important to tell the app that the plural translation is not defined so the app can decide what to to: the app can default to the singular translation or follow another approach.

What do you think? @ferdyrod @andresmr

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it makes sense to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I'll change it

displayFollowUpLabel(displayFollowUpLabel ?: followUpLabel)
displayOrgUnitLabel(displayOrgUnitLabel ?: orgUnitLabel)
displayRelationshipLabel(displayRelationshipLabel ?: relationshipLabel)
displayNoteLabel(displayNoteLabel ?: noteLabel)
displayTrackedEntityAttributeLabel(displayTrackedEntityAttributeLabel ?: trackedEntityAttributeLabel)
displayProgramStageLabel(displayProgramStageLabel ?: programStageLabel)
displayProgramStagesLabel(displayProgramStagesLabel ?: programStageLabel)
displayEventLabel(displayEventLabel ?: eventLabel)
displayEventsLabel(displayEventsLabel ?: eventLabel)
attributeValues?.let { attributeValues(it.map { it.toDomain() }) }
enrollmentCategoryCombo(enrollmentCategoryCombo.toDomain())
categoryMappings(categoryMappings?.map { it.toDomain(id) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ internal object ProgramFields : BaseFields<Program>() {
fh.field(Columns.DISPLAY_EVENT_LABEL),
fh.nestedFieldWithUid(Columns.ENROLLMENT_CATEGORY_COMBO),
fh.nestedField<CategoryMapping>(CATEGORY_MAPPINGS).with(CategoryMappingFields.allFields),
fh.field(Columns.DISPLAY_ENROLLMENTS_LABEL),
fh.field(Columns.DISPLAY_PROGRAM_STAGES_LABEL),
fh.field(Columns.DISPLAY_EVENTS_LABEL),
)

val allFields = Fields.from(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ internal data class ProgramStageDTO(
val displayProgramStageLabel: String?,
Comment thread
andresmr marked this conversation as resolved.
val eventLabel: String?,
val displayEventLabel: String?,
val displayEventsLabel: String?,
val attributeValues: List<AttributeValueDTO>? = emptyList(),
) : BaseIdentifiableObjectDTO {
fun toDomain(): ProgramStage {
Expand Down Expand Up @@ -122,6 +123,7 @@ internal data class ProgramStageDTO(
validationStrategy(validationStrategy?.let { ValidationStrategy.valueOf(it) })
displayProgramStageLabel(displayProgramStageLabel ?: programStageLabel)
displayEventLabel(displayEventLabel ?: eventLabel)
displayEventsLabel(displayEventsLabel ?: eventLabel)
attributeValues(attributeValues?.map { it.toDomain() })
}
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ internal object ProgramStageFields : BaseFields<ProgramStage>() {
fh.nestedField<ObjectStyle>(STYLE).with(ObjectStyleFields.allFields),
fh.nestedField<AttributeValue>(ATTRIBUTE_VALUES).with(AttributeValueFields.allFields),
fh.nestedField<Access>(ACCESS).with(AccessFields.data.with(DataAccessFields.write)),
fh.field(Columns.DISPLAY_EVENTS_LABEL),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ internal data class TrackedEntityTypeDTO(
val featureType: String?,
val access: AccessDTO?,
val style: ObjectWithStyleDTO?,
val displayTrackedEntityTypesLabel: String?,
) : BaseNameableObjectDTO {
fun toDomain(): TrackedEntityType {
return TrackedEntityType.builder().apply {
Expand All @@ -64,6 +65,7 @@ internal data class TrackedEntityTypeDTO(
featureType?.let { featureType(FeatureType.valueOf(it)) }
access?.let { access(it.toDomain()) }
style?.let { style(it.toDomain()) }
displayTrackedEntityTypesLabel?.let { displayTrackedEntityTypesLabel(it) }
}.build()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ internal object TrackedEntityTypeFields : BaseFields<TrackedEntityType>() {
.with(TrackedEntityTypeAttributeFields.allFields),
fh.nestedField<ObjectStyle>(STYLE).with(ObjectStyleFields.allFields),
fh.nestedField<Access>(ACCESS).with(AccessFields.data.with(DataAccessFields.allFields)),
fh.field(Columns.DISPLAY_TRACKED_ENTITY_TYPES_LABEL),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ internal data class ProgramDB(
val displayProgramStageLabel: String?,
val displayEventLabel: String?,
val enrollmentCategoryCombo: String,
val displayEnrollmentsLabel: String?,
val displayProgramStagesLabel: String?,
val displayEventsLabel: String?,
) : EntityDB<Program>, BaseNameableObjectDB {

override fun toDomain(): Program {
Expand Down Expand Up @@ -132,6 +135,9 @@ internal data class ProgramDB(
displayProgramStageLabel(displayProgramStageLabel)
displayEventLabel(displayEventLabel)
enrollmentCategoryCombo(ObjectWithUid.create(enrollmentCategoryCombo))
displayEnrollmentsLabel(displayEnrollmentsLabel)
displayProgramStagesLabel(displayProgramStagesLabel)
displayEventsLabel(displayEventsLabel)
}.build()
}
}
Expand Down Expand Up @@ -175,13 +181,16 @@ internal fun Program.toDB(): ProgramDB {
color = style().color(),
icon = style().icon(),
displayEnrollmentLabel = displayEnrollmentLabel(),
displayEnrollmentsLabel = displayEnrollmentsLabel(),
displayFollowUpLabel = displayFollowUpLabel(),
displayOrgUnitLabel = displayOrgUnitLabel(),
displayRelationshipLabel = displayRelationshipLabel(),
displayNoteLabel = displayNoteLabel(),
displayTrackedEntityAttributeLabel = displayTrackedEntityAttributeLabel(),
displayProgramStageLabel = displayProgramStageLabel(),
displayProgramStagesLabel = displayProgramStagesLabel(),
displayEventLabel = displayEventLabel(),
displayEventsLabel = displayEventsLabel(),
enrollmentCategoryCombo = enrollmentCategoryCombo().uid(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ internal data class ProgramStageDB(
val validationStrategy: String?,
val displayProgramStageLabel: String?,
val displayEventLabel: String?,
val displayEventsLabel: String?,
) : EntityDB<ProgramStage>, BaseIdentifiableObjectDB, ObjectWithStyleDB {

override fun toDomain(): ProgramStage {
Expand Down Expand Up @@ -99,6 +100,7 @@ internal data class ProgramStageDB(
validationStrategy?.let { validationStrategy(ValidationStrategy.valueOf(it)) }
displayProgramStageLabel(displayProgramStageLabel)
displayEventLabel(displayEventLabel)
displayEventsLabel(displayEventsLabel)
}.build()
}
}
Expand Down Expand Up @@ -140,5 +142,6 @@ internal fun ProgramStage.toDB(): ProgramStageDB {
validationStrategy = validationStrategy()?.name,
displayProgramStageLabel = displayProgramStageLabel(),
displayEventLabel = displayEventLabel(),
displayEventsLabel = displayEventsLabel(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ internal data class TrackedEntityTypeDB(
override val color: String?,
override val icon: String?,
val accessDataWrite: AccessDB?,
val displayTrackedEntityTypesLabel: String?,
) : EntityDB<TrackedEntityType>, BaseNameableObjectDB, ObjectWithStyleDB {

override fun toDomain(): TrackedEntityType {
Expand All @@ -37,6 +38,7 @@ internal data class TrackedEntityTypeDB(
style(this@TrackedEntityTypeDB.toDomainStyle())
featureType(featureType?.let { FeatureType.valueOf(it) })
accessDataWrite?.let { access(it.toDomain()) }
displayTrackedEntityTypesLabel(displayTrackedEntityTypesLabel)
}.build()
}
}
Expand All @@ -57,5 +59,6 @@ internal fun TrackedEntityType.toDB(): TrackedEntityTypeDB {
color = style().color(),
icon = style().icon(),
accessDataWrite = access().toDB(),
displayTrackedEntityTypesLabel = displayTrackedEntityTypesLabel(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ public static Program getProgram() {
.featureType(FeatureType.POINT)
.accessLevel(AccessLevel.PROTECTED)
.displayEnrollmentLabel("enrollmentLabel")
.displayEnrollmentsLabel("enrollmentsLabel")
.displayFollowUpLabel("followUpLabel")
.displayOrgUnitLabel("orgUnitLabel")
.displayRelationshipLabel("relationshipLabel")
.displayNoteLabel("noteLabel")
.displayTrackedEntityAttributeLabel("trackedEntityAttributeLabel")
.displayProgramStageLabel("programStageLabel")
.displayProgramStagesLabel("programStagesLabel")
.displayEventLabel("eventLabel")
.displayEventsLabel("eventsLabel")
.enrollmentCategoryCombo(ObjectWithUid.create("category_combo_uid"))
.build();
return builder.build();
Expand Down Expand Up @@ -122,13 +125,16 @@ public static Program getAntenatalProgram() {
.featureType(FeatureType.NONE)
.maxTeiCountToReturn(20)
.displayEnrollmentLabel("Enrollment Label")
.displayEnrollmentsLabel("Enrollments Label")
.displayFollowUpLabel("Follow up Label")
.displayOrgUnitLabel("OrgUnit Label")
.displayRelationshipLabel("Relationship Label")
.displayNoteLabel("Note Label")
.displayTrackedEntityAttributeLabel("TrackedEntityAttribute Label")
.displayProgramStageLabel("ProgramStage Label")
.displayProgramStagesLabel("Program Stages Label")
.displayEventLabel("Event Label")
.displayEventsLabel("Events Label")
.enrollmentCategoryCombo(ObjectWithUid.create("m2jTvAj5kkm"))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static ProgramStage getProgramStage() {
.validationStrategy(ValidationStrategy.ON_UPDATE_AND_INSERT)
.displayProgramStageLabel("programStageLabel")
.displayEventLabel("eventLabel")
.displayEventsLabel("eventsLabel")
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static TrackedEntityType get() {
.displayDescription("Person")
.featureType(FeatureType.NONE)
.access(AccessHelper.createForDataWrite(true))
.displayTrackedEntityTypesLabel("TrackedEntityTypesLabel")
.build();
}

Expand Down
3 changes: 3 additions & 0 deletions core/src/sharedTest/resources/program/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
"selectIncidentDatesInFuture": true,
"displayIncidentDateLabel": "Date of incident",
"displayEnrollmentLabel": "Enrollment Label",
"displayEnrollmentsLabel": "Enrollments Label",
"displayFollowUpLabel": "Follow up Label",
"displayOrgUnitLabel": "OrgUnit Label",
"displayRelationshipLabel": "Relationship Label",
"displayNoteLabel": "Note Label",
"displayTrackedEntityAttributeLabel": "TrackedEntityAttribute Label",
"displayProgramStageLabel": "ProgramStage Label",
"displayProgramStagesLabel": "Program Stages Label",
"displayEventLabel": "Event Label",
"displayEventsLabel": "Events Label",
"selectEnrollmentDatesInFuture": false,
"registration": true,
"useFirstStageDuringRegistration": false,
Expand Down
3 changes: 2 additions & 1 deletion core/src/sharedTest/resources/program/program_stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"userGroupAccesses": [],
"attributeValues": [],
"programStageSections": [],
"periodType": "Monthly"
"periodType": "Monthly",
"displayEventsLabel": "Events Label"
}

3 changes: 3 additions & 0 deletions core/src/sharedTest/resources/program/programs.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"expiryPeriodType": "BiMonthly",
"minAttributesRequiredToSearch": 7,
"maxTeiCountToReturn": 20,
"displayEnrollmentsLabel": "Enrollments Label",
"displayProgramStagesLabel": "Program Stages Label",
"displayEventsLabel": "Events Label",
"style": {
"color": "#333",
"icon": "antenatal_icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"displayDescription": "Person",
"displayName": "Person",
"description": "Person",
"displayTrackedEntityTypesLabel": "Persons",
"featureType": "NONE",
"externalAccess": false,
"access": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ internal class ProgramShould : CoreObjectShould<ProgramDTO>("program/program.jso
assertThat(program.programTrackedEntityAttributes()!![0].uid()).isEqualTo("YGMlKXYa5xF")
assertThat(program.programTrackedEntityAttributes()!![1].uid()).isEqualTo("WZWEBrkJSAm")
assertThat(program.programSections()!![0].uid()).isEqualTo("FdpWnXhl7c1")
assertThat(program.displayEnrollmentsLabel()).isEqualTo("Enrollments Label")
assertThat(program.displayEventsLabel()).isEqualTo("Events Label")
assertThat(program.displayProgramStagesLabel()).isEqualTo("Program Stages Label")

val categoryMappings = program.categoryMappings()!!
assertThat(categoryMappings.size).isEqualTo(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ internal class ProgramStageShould : CoreObjectShould<ProgramStageDTO>(
assertThat(programStage.enableUserAssignment()).isTrue()
assertThat(programStage.displayProgramStageLabel()).isEqualTo("ProgramStage Label")
assertThat(programStage.displayEventLabel()).isEqualTo("Event Label")
assertThat(programStage.displayEventsLabel()).isEqualTo("Events Label")

val dataElements = programStage.programStageDataElements()
assertThat(dataElements?.get(0)?.uid()).isEqualTo("EQCf1l2Mdr8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ internal class TrackedEntityTypeShould : CoreObjectShould<TrackedEntityTypeDTO>(
assertThat(entityType.displayDescription()).isEqualTo("Person")
assertThat(entityType.featureType()).isEqualTo(FeatureType.NONE)
assertThat(entityType.access()).isEqualTo(AccessHelper.createForDataWrite(true))
assertThat(entityType.displayTrackedEntityTypesLabel()).isEqualTo("Persons")
}
}