Commit Graph

56 Commits

Author SHA1 Message Date
alicia pritchett 40b5bf3afa Adds a POST for reference file. and a cool test 2021-10-12 14:29:15 -04:00
alicia pritchett 8b5686ce40 wip 2021-10-12 09:46:22 -04:00
mike cullerton cc403f1fac Merge branch 'dev' into dmn-from-spreadsheet-395 2021-09-09 13:09:35 -04:00
mike cullerton a3b3df1bbb Use flask send_file to return DMN file 2021-09-07 12:09:30 -04:00
mike cullerton 8677d0368b Grab the file data from the request, not as a parameter 2021-09-03 10:32:32 -04:00
mike cullerton b5082b8fd3 Call FileService 2021-09-02 09:53:17 -04:00
mike cullerton 0c31b091ee Merge branch 'dev' into dmn-from-spreadsheet-395 2021-09-01 09:38:03 -04:00
mike cullerton 5db5c7ca43 Added file_id to some error messages in api.file 2021-08-31 15:28:21 -04:00
mike cullerton 4c41011299 Add task_spec_name to `add_file` API call 2021-08-26 10:37:05 -04:00
mike cullerton 19e0caa700 API endpoint for creating a DMN table from a spreadsheet 2021-08-11 08:55:10 -04:00
Dan 1b1a994360 Refactoring Reference files to use the lookup table, rather than parsing the results directly out of the spreadsheet, or attempting to cache them.
Adding a DocumentService to clean up the FileService, and get Documents well seperated, as it seems likely be pulled out or seperated in the future, there is now a Documents api file as well, for the same reason.
Some other minor changes are just fixing white space to assure our code is linting correctly.
I removed _create_study_workflow_approvals from the base test, as we don't use approvals like this anymore.
2021-07-06 13:10:20 -04:00
Dan 59f605c3df Prefer tasks that share a parent over just the the next available task when returning the next_task in the workflow processor. 2021-06-08 08:03:14 -04:00
Dan 7e6645db89 Merge branch 'dev' of github.com:sartography/cr-connect-workflow into dev 2021-05-14 14:10:19 -04:00
Dan 427875b8dd upgrading Sartography libraries, and fixing a potential error where a file can't be located in the documents.xslt 2021-05-14 14:10:14 -04:00
Kelly McDonald cbd1d01203 Add URL to the study_info('documents') script
fixes #321 - I merged in branches that fix #320 and #297

320-add-default-for-file-data-get
297-filename-in-documents
2021-05-05 11:30:08 -04:00
Dan dd7c5fd1c1 Fixes #306 assure that we take the doc_code into account if passed in as an argument to the API for get_files. 2021-04-23 16:16:19 -04:00
Dan cf051a7d4f Merge branch 'dev' into 277-Document-pane
# Conflicts:
#	crc/api/file.py
2021-04-21 14:09:44 -04:00
Dan ecff7d20d3 Adding a test for the new endpoint and cleaning up the API documenation 2021-04-21 14:00:19 -04:00
Kelly McDonald 19e94da6b6 Fix slight bug in expansion code,
a non-expanded node was causing all parent levels to not expand.
2021-04-20 11:11:11 -04:00
Kelly McDonald e2197ddab9 Changes to support the frontend data pane
fixes #277 and requires frontend branch 277-document-pane
2021-04-20 08:12:27 -04:00
mike cullerton 2374400542 Automatically set the first workflow for a workflow_spec to primary 2021-04-15 12:39:12 -04:00
Kelly McDonald 949f3be403 give an endpoint to return all files associated with a study 2021-04-12 12:23:33 -04:00
Kelly McDonald 44c72115ae Make sure we get the file we intended 2020-12-07 08:50:20 -05:00
Kelly McDonald f26a8615a4 Get more file details so we can fill out everything locally and also add a method to download the file by md5_hash 2020-12-07 08:49:38 -05:00
Dan Funk e102214809 minor cleanup of error codes. 2020-06-03 15:03:22 -04:00
Dan Funk 9c7de39b09 This adds additional file data details to the study model as well. 2020-05-31 21:15:40 -04:00
Dan Funk dba41f4759 Ludicrously stupid launch in a refactor of the way all files work in the system at a time where I crave sleep and peace above all other things.
Added a File class, that we wrap around the FileModel so the api endpoints don't change, but File no longer holds refences to versions or dates of the file_data model, we
figure this out based on a clean database structure.

The ApprovalFile is directly related to the file_data_model - so no chance that a reviewer would review the incorrect version of a file.py

Noticed that our FileType enum called "bpmn" "bpmm", hope this doesn't screw someone up.

Workflows are directly related to the data_models that create the workflow spec it needs.  So the files should always be there.  There are no more hashes, and thus no more hash errors where it can't find the files to rebuild the workflow.py

Not much to report here, other than I broke every single test in the system at one point.  So I'm super concerned about this, and will be testing it a lot before creating the pull request.
2020-05-28 20:03:50 -04:00
Dan Funk cd7f67ab48 A major refactor of how we search and store files, as there was a lot of confusing bits in here.
From an API point of view you can do the following (and only the following)

/files?workflow_spec_id=x
* You can find all files associated with a workflow_spec_id, and add a file with a workflow_spec_id
/files?workflow_id=x
* You can find all files associated with a workflow_id, and add a file that is directly associated with the workflow
/files?workflow_id=x&form_field_key=y
* You can find all files associated with a form element on a running workflow, and add a new file.
   Note: you can add multiple files to the same form_field_key, IF they have different file names. If the same name, the original file is archived,
   and the new file takes its place.

The study endpoints always return a list of the file metadata associated with the study.  Removed /studies-files, but there is an
endpoint called

/studies/all  - that returns all the studies in the system, and does include their files.

On a deeper level:
 The File model no longer contains:
  - study_id,
  - task_id,
  - form_field_key

Instead, if the file is associated with workflow - then that is the one way it is connected to the study, and we use this relationship to find files for a study.
A file is never associated with a task_id, as these change when the workflow is reloaded.
The form_field_key must match the irb_doc_code, so when requesting files for a form field, we just look up the irb_doc_code.
2020-05-28 08:27:26 -04:00
Dan Funk d5c91e575f stuff that might be broken. 2020-05-23 15:21:30 -04:00
Aaron Louie 9afcd753c4 No longer requires task_id 2020-05-06 14:27:28 -04:00
Dan Funk 12eb039bc9 Server isn't erroring out, but can't find the lookup table id in the database, so trying to use the in-memory model instead, to give things time to get to the database. Really unsure what is happening here. Hard to see in the database. 2020-04-24 07:01:32 -04:00
Dan Funk dc2895cb05 Allow configurators to upload xls files into a workflow for defining enumrations of values for dropdown lists in forms. Fixing lots of tests.
Found a problem where the documentation for elements was being processed BEFORE data was loaded from a script.  There still may be some issues here.

Ran into an issue with circular dependencies - handling it with a new workflow_service, and pulling computational logic out of the api_models - it was the right thing to do.
2020-04-15 11:13:32 -04:00
Aaron Louie 519a034d87 Updates last_updated when file data is saved. Returns last_updated as lastModified in response header for file data endpoint. 2020-04-08 12:58:55 -04:00
Dan Funk 967ac65d0e Just raise the ApiError, no need to marshal it. 2020-03-23 12:22:26 -04:00
Dan Funk 6e3b6c2635 Assure that files uploaded through web forms and files generated from templates can be cross-referenced to known document requirements from the protocol builder. Configurators can control this by managing an XLS Spreadsheet called "irb_documents.xslx".
Required Documents is becoming complicated, so making this it's own script task, removing it from study_info.py
The file_service is now very aware of this irb_documents file, so it will always need to exist.  We seed this file
during setup, but it can be overwritten by the configurator.
2020-03-19 17:14:20 -04:00
Dan Funk 779674ab60 Add the ability to upload and request general reference files by name. These will be used across workflows and will frequently contain lookup tables that can be referenced by various script tasks. 2020-03-13 15:03:57 -04:00
Dan Funk c5cee4761e Improve version handling of files. Consolidate more of this logic in FileService. Place the version on the actual data model, not the file model, so the file model remains the same, and we just version the data associated with it. 2020-03-04 13:40:25 -05:00
Aaron Louie 8611a23ad3 Renaming to snake case for consistency 2020-02-28 11:54:11 -05:00
Aaron Louie b0b1a6e5e8 Saves form field key 2020-02-11 15:03:25 -05:00
Dan Funk 1d24ebe382 Provide a script for generating word documents from template files. Refractored file managment into a service to make it easier to programatically add files. Modified the workflow_processor to inject the study_id and workflow_id into the running workflow so that this meta-information is avialable at the task level. 2020-02-10 16:19:23 -05:00
Aaron Louie 5a6d589e6d Adds form_field_key to API 2020-02-05 15:06:19 -05:00
Aaron Louie e1e866a2b3 Gets docker-compose working.
You'll need to add a .env file to the same directory as the docker-compose.yml file that sets the values for DB_USER and DB_PASS.
2020-02-04 21:42:09 -05:00
Dan Funk b1a81957ef Merge branch 'feature/update-task-data' of github.com:sartography/cr-connect-workflow into feature/update-task-data 2020-02-04 15:45:05 -05:00
Dan Funk 9e6fbfee79 Followup on Postgres - had some failing tests that needed cleaning up now that we are using a real database. 2020-02-04 15:44:06 -05:00
Aaron Louie 3ee0426ba9 Adds workflow_id to file endpoints. 2020-02-04 14:26:53 -05:00
Aaron Louie 098ecb3e87 Wipes out old migrations, since changing foreign key constraints in SQLite requires a full database reset anyways. 2020-02-04 09:57:02 -05:00
Aaron Louie 0368657549 Adds ability to get FileModel records by study and task 2020-02-03 21:56:18 -05:00
Aaron Louie a0e60ddd77 Renames endpoint methods for clarity. Adds endpoint for just updating file info. 2020-01-31 10:39:19 -05:00
Aaron Louie a3b6e4fc7f Fixes import paths 2020-01-24 11:52:52 -05:00
Aaron Louie 50dfa561a9 Fixes import paths, which were screwing up stuff. 2020-01-24 09:29:50 -05:00