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

dhis2 update examples #617

Merged
merged 3 commits into from
Dec 10, 2024
Merged

dhis2 update examples #617

merged 3 commits into from
Dec 10, 2024

Conversation

mtuchi
Copy link
Contributor

@mtuchi mtuchi commented Dec 9, 2024

Short Description

Update DHIS2 examples to using the latest best practice job writing guide

Details

Update two internal DHIS2 examples that appear on the docs.openfn.org/adaptors by removing the dataValue()(state) pattern and use the new create() function to create dataValues and events. Addittionally i have added docusaurus generate-library command in start:dev script

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to
know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our
Responsible AI Policy

@mtuchi mtuchi requested a review from josephjclark December 9, 2024 19:31
});

// Create dataValueSets
create('dataValueSets', state => state.dataValueSetMap);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't best practice be more like:

create('dataValueSets', {
  dataSet: 'pBOMPrpg1QX',
  completeDate: $.form.date,
  period: '201401',
  orgUnit: 'DiszpKrYNg8',
  dataValues: [
    {
      dataElement: 'f7n9E0hX8qk',
      value: $.form.prop_a,
    },
    {
      dataElement: 'Ix2HsbDMLea',
      value: $.form.prop_b,
    },
    {
      dataElement: 'eY5ehpbEsB7',
      value: $.form.prop_c,
    },
  ],
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's clean and simple. I have updated the examples to use that pattern

@mtuchi mtuchi requested a review from josephjclark December 10, 2024 12:47
Copy link
Contributor

@josephjclark josephjclark left a comment

Choose a reason for hiding this comment

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

Thanks!

@josephjclark josephjclark merged commit 99ca93f into main Dec 10, 2024
1 check passed
@josephjclark josephjclark deleted the dhis2-docs branch December 10, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants