Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add due event fetcher and attribute enrichment #167

Merged
merged 12 commits into from
Jan 10, 2024

Conversation

JohanGHole
Copy link
Collaborator

Added:

  • fetch due events route - fetches scheduled tracker events for today, given a map of configured program stages.
  • fetch attributes route - fetches givenName and contactUrn attributes based on configured code values. Tracked Entities "owns" all Tracked Entity Attribute Values (Or "attributes" as described in the payload). However, Tracked Entity Attributes are either connected to a Tracked Entity through its Tracked Entity Type or a Program. Based on the DHIS2 configuration, we can therefore have either Tracked Entity Type Attributes or Tracked Entity Program Attributes. The importance of this separation is related to access control and limiting what information the user can see. In the test container, the attributes are configured to be represented as Tracked Entity Program Attributes, but in many real world cases, the attributes are Tracked Entity Type Attributes. The connector now supports both configurations. Not sure if an aggregation strategy is the best approach for this, as I am setting the endpoint for fetching the attributes dynamically (it can either be "tracker/enrollments" for Tracked Entity Program Attributes configuration, or "tracker/trackedEntities" for Tracked Entity Type Attributes configuration)

The next step will be to add the route for RapidPro contact creation based on the contactUrn , after which the event payload will be transformed to a RapidPro flow and added to a flow queue to be triggered in another route. In my first draft this was all located in the same file, but I will split it into separate files for better maintainability.

Tracked Entities "owns" all Tracked Entity Attribute Values (Or "attributes"). However, Tracked Entity Attributes are either connected to a Tracked Entity through its Tracked Entity Type or a Program, i.e.  Tracked Entity Type Attributes and Tracked Entity Program Attributes. This means that the Tracked Entity Attributes can be located in one of two endpoints: tracker/enrollments as Tracked Entity Program Attributes, or tracker/trackedEntities as Tracked Entity Type attributes.

The connector now supports both dhis configurations.
@JohanGHole JohanGHole requested a review from cjmamo November 23, 2023 10:16
@JohanGHole JohanGHole requested a review from cjmamo December 7, 2023 08:42
@JohanGHole JohanGHole merged commit 8935d26 into main Jan 10, 2024
5 checks passed
@JohanGHole JohanGHole deleted the jh-dhis-event-fetcher branch January 10, 2024 12:25
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