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

MIG-109: split getStudyManifest function as per requirement #372

Merged

Conversation

davideaquaro
Copy link
Contributor

Requirements

Notes

  • This is necessary for AXD-46. The current logic of getStudyManifest function in StudyManifestTools module will be split into 2 new functions called buildManifestAndDependencies and writeToDisk; the former function will generate all relevant data objects and the latter will write files on the disk.

@@ -136,8 +142,18 @@ class StudyManifestTools {
allEntities = [study, ...await this.getStudyManifestEntities(org, study, orgReferenceProps)],
{ outputEntities, removedEntities } = this.validateReferences(allEntities, orgReferenceProps),
manifest = this.createManifest(outputEntities),
mappingScript = await getMappingScript(org)
mappingScript = await getMappingScript(org),
ingestTransform = fs.readFileSync('../packageScripts/ingestTransform.js')
Copy link
Contributor

@nahueld nahueld May 13, 2022

Choose a reason for hiding this comment

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

This requires the __dirname prefix to make sure it is reading relative to this directory otherwise it will fail when run from the mdctl

Getting orac__forms
Getting orac__form_questions
Getting orac__events
Validating Internal References
{
  object: 'fault',
  name: 'error',
  errCode: 'mdctl.error.unspecified',
  code: 'kError',
  message: "ENOENT: no such file or directory, open '../packageScripts/ingestTransform.js'",
  status: 500,
  trace: null,
  path: undefined,
  resource: undefined,
  reason: '../packageScripts/ingestTransform.js'
}

Copy link
Contributor

Choose a reason for hiding this comment

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

can we add some tests for this change please? there are some examples in the __tests__ folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @nahueld, apologies I think I've accidentally deleted the __dirname at some stage, but it has been fixed now. I've also created a unit test for this ticket.
Thank you

@@ -125,6 +125,12 @@ class StudyManifestTools {

async getStudyManifest() {
Copy link
Contributor

@nahueld nahueld May 13, 2022

Choose a reason for hiding this comment

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

Also noticed that we have some code duplication for the other mdctl tasks, check

  • getTasksManifest
  • getConsentsManifest

For both cases we could split the logic too (that is have writing logic and processing logic decoupled), this will be really convenient for the next release that we are going to be using those other more granular exports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @nahueld is it ok for you if I create another Jira to keep track of this as I guess we probably don't want to overlap with the original requirement?

Copy link
Contributor

@nahueld nahueld May 16, 2022

Choose a reason for hiding this comment

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

ok let's update the ticket to reflect this, given that this is an internal task we are ok adjusting the requirements

@davideaquaro davideaquaro changed the title MIG-109: split getStudyManifest function as per requirement Draft MIG-109: split getStudyManifest function as per requirement May 14, 2022
@davideaquaro davideaquaro changed the title Draft MIG-109: split getStudyManifest function as per requirement MIG-109: split getStudyManifest function as per requirement May 19, 2022
@nahueld nahueld merged commit 125f4b0 into Medable:develop May 19, 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