Skip to content

Conversation

@henrikmv
Copy link
Contributor

@henrikmv henrikmv commented Dec 12, 2025

DHIS2-20632

Summary

This PR handles how Tracked Entity Type Attributes (TETA) and
Program Tracked Entity Attributes (PTEA) should be displayed, configured, and saved
when creating or editing a program.


Key changes

Attribute lists behaviour

  • TETA are not shown in “Available attributes”
  • TETA always appear in “Selected attributes”
    • Cannot be deselected
    • Can be reordered internally (TETA are always shown above PTEA)
    • Visually differentiated from PTEA. Currently just adding a label to explain that it is a TETA.

Configure attributes table

  • Both TETA and PTEA are displayed
  • TETA are always shown above PTEA
  • TETA rows are visible but disabled under the following conditions:
    • MANDATORY: if on in TETA then can not be turned off
    • SEARCHABLE: if on in TETA then can not be turned off
    • DISPLAY IN LIST: if on in TETA then can not be turned off
    • DATE IN FUTURE: if on in TETA then can not be turned off
  • Disabled options include tooltips explaining they are inherited from the Tracked Entity Type

Saving and API order

  • On save, both TETA and PTEA are persisted
  • TETA are always posted before PTEA in the final order

Sync behavior when editing existing programs

  • The UI reflects the current Tracked Entity Type configuration:
    • Attributes removed from the TET are treated as PTEA
    • New TETA are visually highlighted with a tooltip explaining their origin
    • Newly added TET attributes automatically appear as new TETA when opening the program in the Maintenance app, but the program needs to be saved to update the backend values (See next point)

Warning on TETA changes

  • When saving changes to a Tracked Entity Type Attribute used by one or more programs:
    • Show a warning encouraging the user to review and update affected programs
    • No links are added to the alert. Not possible with the DHIS2-UI Alert

Assumptions and clarifications

  • Programs automatically inherit TETA and must remain in sync with the TET, but the user needs to open the program and click the save button if attributes are changed in TET. (Why not trigger the API to update the affected programs?)
  • Ordering TETA before PTEA is required both in the Configuration table and in the Transfer modal.

@netlify
Copy link

netlify bot commented Dec 12, 2025

Deploy Preview for dhis2-maintenance-app-beta ready!

Name Link
🔨 Latest commit 975ab1a
🔍 Latest deploy log https://app.netlify.com/projects/dhis2-maintenance-app-beta/deploys/693d4bbfc72e6a000888840d
😎 Deploy Preview https://deploy-preview-720.maintenance-app-beta.netlify.dhis2.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements filtering of tracked entity attributes in the program enrollment data form to exclude attributes that are already associated with the tracked entity type. This prevents duplication by filtering out tracked entity type attributes (TETA) from the available attributes list during program configuration.

Key changes:

  • Extended the tracked entity type field filter in the Edit query to include nested tracked entity type attributes
  • Added logic to track and filter out tracked entity type attributes from the available attributes selection

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/pages/programsWip/Edit.tsx Extended the trackedEntityType field filter to fetch trackedEntityTypeAttributes[trackedEntityAttribute[id]] for filtering purposes
src/pages/programsWip/form/EnrollmentDataFormContents.tsx Added trackedEntityTypeField subscription and filter logic to exclude tracked entity type attributes from available attributes in the ModelTransfer component

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

@henrikmv henrikmv requested a review from Copilot December 13, 2025 11:34
@henrikmv henrikmv marked this pull request as ready for review December 13, 2025 11:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants