Conversation
…and skip-metadata. Change url to allow for a optional auth parameter. Change program import to allow importing without metadata.
|
|
||
| const endpoint = { | ||
| trackedEntities: () => tracker.trackedEntities.get(apiOptions), | ||
| enrollments: () => tracker.enrollments.get(apiOptions), |
There was a problem hiding this comment.
updatedBefore isn't supported on the enrollments endpoint, d2-api's trackerEnrollments.d.ts:59 has updatedAfter and updatedWithin only. Nothing catches this: assigning to a variable before passing disables TypeScript's excess-property check (apiOptions)
There was a problem hiding this comment.
Added a post-query filter in D2Tracker for enrollments that emulates this function.
|
|
||
| The data can be filtered by: | ||
| - Organization Unit via the `--orgunits-ids` option. If `--descendants` is used, the included orgUnits will be the specified and its descendants. Note that if no `--orgunits-ids` is provided the `ouMode` will be `ALL` and the `--descendants` option will be redundant. | ||
| - The `lastUpdated` property using the `--start-date` and/or `--end-date` options. |
There was a problem hiding this comment.
Just a comment: the date window is applied independently to three related entity types (events, enrollments and tracked entities), so a filtered export can contain dangling references.
For example, with --start-date=2026-01-01: an event edited on 2026-02-14 is exported, but its enrollment (last updated 2024-06-02) and its TEI (2024-05-10) are not, so the file references two records it doesn't contain. If this is intentional like this, then it's ok.
There was a problem hiding this comment.
Added a warning about this in the README. The task didn't warranted tackling this a the data to extract were of event type only.
The fix would be to collect the missing references in the retrieved tracker type metadata and fetch them afterwards.
| const startDateArg = option({ | ||
| type: optional(string), | ||
| long: "start-date", | ||
| description: "Start date", |
There was a problem hiding this comment.
improve description here and in end date
There was a problem hiding this comment.
I restored startDateArg / endDateArg and created new updatedStartDateArg / updatedEndDateArg with a more detailed description and a input validation function.
…or import object.
…/end-date description and add a validator. Update README.
…ng incorrect dates (2000-03-32 for example)
📌 References
Issue: [49] Migrate event data for SKERU
📝 Implementation
Update export programs script to allow the data to be filtered by the
lastUpdatedproperty using the--start-dateand/or--end-dateoptions.Added the
--descendantsoption, is its used, the included orgUnits will be the specified by--orgunits-idsand its descendants.The metadata export can be skipped via the
--skip-metadataoption.Change program import to allow importing without metadata.