phac-nml / irida-next

IRIDA Next
https://phac-nml.github.io/irida-next/
Apache License 2.0
8 stars 3 forks source link

Data Export: Add workflow execution to create job #526

Closed ChrisHuynh333 closed 5 months ago

ChrisHuynh333 commented 5 months ago

What does this PR do and why?

This PR adds analysis (workflow execution) exporting to the data export create job.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

  1. Set up the ability to run workflow executions locally as described in PR 507
  2. Run a workflow execution
  3. Once completed, export it with:
    user = USER YOU MADE WORKFLOW EXECUTION WITH
    params_1 = {'export_type' => 'analysis', 'export_parameters' => {'ids' => [WORKFLOW_EXECUTION_ID]}, 'email_notification' => true, 'name' => 'test export'}
    DataExports::CreateService.new(user, params_1).execute
  4. After 30s, download the export with:
    data_export = user.data_exports.last
    Rails.application.routes.url_helpers.rails_blob_url(data_export.file)
  5. Copy and paste the above output into a browser. This should download the zip. The file directory should look like:
    |---- manifest.json
    |---- summary.txt.gz
    |---- Sample1.puid
    |           |---------Any attachments
    |
    |---- Sample2.puid
    |           |--------- Any attachments
    |---- etc.

    The manifest should look like:

    
    "type": "Analysis Export",
    "date": "Date.current",
    "children": [
    {
     "name": "summary.txt.gz",
      "type": "file"
    },
    {
      "name": sample1.puid,
      "type": "folder",
      "irida-next-type": "sample",
      "irida-next-name": sample1.name,
      "children": [
        {
          "name": "attachments.name",
          "type": "file",
        },
      },
    {
      "name": sample2.puid,
      "type": "folder",
      "irida-next-type": "sample",
      "irida-next-name": sample2.name,
      "children": [
        {
          "name": "attachments.name",
          "type": "file",
        },
      }
    ]

etc.


## PR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

- [x] I have evaluated the [PR acceptance checklist](https://phac-nml.github.io/irida-next/docs/development/development_processes/code_review#acceptance-checklist) for this PR.
github-actions[bot] commented 5 months ago

Simplecov Report

Covered Threshold
91.89% 90%