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

Rn 588 data broker tei #4045

Merged
merged 19 commits into from
Jul 29, 2022
Merged

Rn 588 data broker tei #4045

merged 19 commits into from
Jul 29, 2022

Conversation

IgorNadj
Copy link
Contributor

@IgorNadj IgorNadj commented Jul 26, 2022

RN-588

A bunch of refactors around testing, and then two last commits contain:

  • db change to allow finding data with json paths
  • data-broker change which adds entity codes when the DHIS response has a "tei" column

@IgorNadj IgorNadj marked this pull request as draft July 26, 2022 05:03
@IgorNadj IgorNadj marked this pull request as ready for review July 28, 2022 04:05
Copy link
Member

@edmofro edmofro left a comment

Choose a reason for hiding this comment

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

Early review on the two meaningful commits - looking good so far, will review the PR as a whole now

@@ -32,11 +32,12 @@ const mockFind = (array, criteria = {}) =>

if (key.includes('->>')) {
// Special case
const lookupPath = key.split('->>');
if (lookupPath.length > 2) throw new Error('Not implemented yet...');
Copy link
Member

Choose a reason for hiding this comment

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

Hooray, implemented now!

@@ -0,0 +1,3 @@
export const addTrackedEntityCodes = async (models, events) => {
return events;
};
Copy link
Member

Choose a reason for hiding this comment

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

Unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah didn't spot this in my once-over, removed

* Data pulls sometimes return tracked entity instance ids. This translator
* converts these ids to entity codes.
*/
export class TrackedEntityInstanceTranslator {
Copy link
Member

Choose a reason for hiding this comment

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

Unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Member

@edmofro edmofro left a comment

Choose a reason for hiding this comment

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

There's some great deep work in here, thanks for doing so much code quality improvement as part of a hotfix

* It detects such instances, and swaps all the codes it is given to ids for the fetch, then does the same for
* the data coming back (swapping ids in the response data for codes).
*/
export class DhisCodeToIdTranslator {
Copy link
Member

Choose a reason for hiding this comment

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

Huge name improvement, and great comment above

import { expect } from 'chai';
import { createModelsStub } from '../../testUtilities';

describe('createModelsStub', () => {
Copy link
Member

Choose a reason for hiding this comment

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

So meta

* @param {MockData} mockData
* @return {} a partial implementation of ModelRegistry, to be used in its place
*/
export const createModelsStub = mockData => {
Copy link
Member

Choose a reason for hiding this comment

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

Really good idea doing this

@IgorNadj IgorNadj force-pushed the rn-588-data-broker-tei branch from d76455e to 1cfb222 Compare July 29, 2022 04:02
@IgorNadj IgorNadj changed the base branch from dev to master July 29, 2022 04:02
@IgorNadj
Copy link
Contributor Author

Rebased on master so we can deploy this separately as a hotfix, the only commits that were dropped out of this PR were:

These were part of the feature branch when testing. Looking through them, none of them have any changes related to DHIS or data pulling, so should be safe to pull out.

@IgorNadj IgorNadj merged commit 8124896 into master Jul 29, 2022
@IgorNadj IgorNadj deleted the rn-588-data-broker-tei branch July 29, 2022 05:11
IgorNadj added a commit that referenced this pull request Jul 31, 2022
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