72 Commits

Author SHA1 Message Date
Dan
4ec6e403f5 1. Created a UserFileService, so it's clear what we use when for File Services, UserFiles, SpecFiles, and ReferenceFiles each function differently.
2. Reference Files and Spec Files are written to disk, they do not exist in the database at all.
2022-02-02 12:59:56 -05:00
Dan
9690ebf883 minor minor stuff. 2022-01-24 14:43:36 -05:00
mike cullerton
76b09a418e Created separate api files for spec_files and reference_files 2022-01-20 15:22:47 -05:00
mike cullerton
ca54b850cd UNDO my previous commit regarding get_files needs to have workflow_spec_id
We need to call `get_spec_files` instead now
2022-01-20 14:57:32 -05:00
mike cullerton
9ea1399578 get_files needs to have workflow_spec_id 2022-01-20 09:54:22 -05:00
mike cullerton
68820c67cb Removed (almost) all references to WorkflowSpecDependencyFile
(There is still a call in the lookup service, but we need to decide how to fix that)
2022-01-19 16:12:54 -05:00
mike cullerton
16a9a18c5b Fixed get reference file info, and added test 2022-01-19 15:17:35 -05:00
mike cullerton
091d71eb0f Cleaned up code around differences between file info and file data
Cleaned up some api code around differences between file, spec_file, and reference_file
Cleaned up some api code around differences between file info and file data
Fixed some tests for file api
2022-01-19 13:47:14 -05:00
mike cullerton
6da6e05171 *** WIP ***
code for updating spec files
some cleanup

tests pass, but we don't have all the tests we need.
2022-01-13 15:24:29 -05:00
mike cullerton
b99ed73951 Remove unused imports 2022-01-12 15:00:26 -05:00
mike cullerton
cfa9f00bf3 *** WIP ***
Moved reference files to their own service
2022-01-12 14:37:33 -05:00
mike cullerton
b6b9482a64 *** WIP ***
Incremental commit. Mainly cleaning up failing tests.
2022-01-12 13:16:09 -05:00
mike cullerton
4df2ed6ce4 *** WIP ***
Failing tests, and missing functionality.
Committing to get stuff on Github.
2022-01-11 15:30:22 -05:00
mike cullerton
f537fd7fbf *** WIP *** 2022-01-07 15:58:23 -05:00
mike cullerton
dc27f795c8 *** WIP ***
Committing because it is Friday afternoon, and my computer is acting flaky
2022-01-07 15:34:51 -05:00
mike cullerton
86a6039dc8 *** WIP ***
**Many** tests are failing!

Committing so I can merge dev into this branch
2022-01-06 11:46:54 -05:00
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