🚀 DHIS2@6.0.0 Adaptor Released!

Hey Community :wave:

We are excited to announce the release of version 6.0.0 of the DHIS2 adaptor, introducing significant enhancements to align with the latest DHIS2 version.This update migrates the adaptor to the new Tracker API (v36+) for resources such as trackedEntities, enrollments, events, and relationships. Notably, the trackedEntityInstances resource is now deprecated.

The create, update, upsert, and destroy functions have been updated to automatically map affected resources to the new Tracker API endpoints. However, existing workflows utilizing these functions with the aforementioned resources may require adjustments to ensure compatibility with the new API structure.We recommend reviewing your code in accordance with the DHIS2 Tracker Migration Guide to understand the necessary changes.

For instance, previous implementations using:

create('trackedEntityInstances', {
/*...*/
});

should be updated to:

create('trackedEntities', {  
  /*...*/  
});

Similarly, payload structures have evolved. For example, an event creation that previously looked like:

create('events', {  
  trackedEntityInstance: 'eBAyeGv0exc',  
  eventDate: '2024-01-01',  
  /* ... */  
});

should now be modified to:

create('events', {  
  trackedEntity: 'eBAyeGv0exc',  
  occurredAt: '2024-01-01',  
  /* ... */  
});

Please note that the HTTP APIs get(), patch(), and post() will continue to call the specified URLs with the provided data without automatic mapping to the new Tracker API.This allows for direct interaction with any DHIS2 API endpoint.

We encourage all users to update to version 6.0.0 to take advantage of these improvements and to ensure seamless integration with DHIS2. As always, we appreciate your feedback and are here to assist with any questions during this transition.

Examples

Creating multiple trackedEntities

create('trackedEntities', [
  {
    trackedEntityType: 'MCPQUTHX1Ze',
    orgUnit: 'DiszpKrYNg8',
    attributes: [
      { attribute: 'w75KJ2mc4zz', value: 'John Doe' },
      { attribute: 'zDhUuAYrxNC', value: 'john.doe@example.com' }
    ]
  },
  {
    trackedEntityType: 'MCPQUTHX1Ze',
    orgUnit: 'DiszpKrYNg8',
    attributes: [
      { attribute: 'w75KJ2mc4zz', value: 'Jane Smith' },
      { attribute: 'zDhUuAYrxNC', value: 'jane.smith@example.com' }
    ]
  }
]);

Creating Multiple events

create('events', [
  {
    program: 'IpHINAT79UW',
    orgUnit: 'DiszpKrYNg8',
    trackedEntity: 'eBAyeGv0exc',
    occurredAt: '2024-01-01',
    dataValues: [
      { dataElement: 'fWIAEtYVEGk', value: '5' },
      { dataElement: 'cYeuwXTCPkU', value: 'Positive' }
    ]
  },
  {
    program: 'IpHINAT79UW',
    orgUnit: 'DiszpKrYNg8',
    trackedEntity: 'hT5pAe83j7x',
    occurredAt: '2024-02-01',
    dataValues: [
      { dataElement: 'fWIAEtYVEGk', value: '3' },
      { dataElement: 'cYeuwXTCPkU', value: 'Negative' }
    ]
  }
]);