Commit Graph

494 Commits

Author SHA1 Message Date
Dan Funk 8d42d520a0 Adding events to the study that is returned via the api. 2020-07-27 16:32:23 -04:00
Carlos Lopez de0fe705c3 Wrapping LOCKED task update attempt into a try-catch block for tests 2020-07-27 14:00:44 -06:00
Dan Funk 452f2c3723 Building out a user service for getting the current user, it will provide a number of functions, one of which will allow administrative users to impersonate other users in some circumstances (but will assure that we log events correctly when an impersonation occures) 2020-07-27 14:38:57 -04:00
Dan Funk 0d2cb8c1b8 Correcting an issue with the Navigation where it did not correctly handle looking back to a previous task within the workflow.
In some cases the session was not getting committed, leaving rogue assignments outstanding for a workflow.
2020-07-27 12:36:20 -06:00
Dan Funk 6379b26a71 Add a few more details to the workflow metadata model. 2020-07-27 12:34:25 -06:00
Kelly McDonald cc55aed89c Change exception name 2020-07-27 12:18:28 -04:00
Kelly McDonald 70ad3872a7 Fix several bugs, most had an issue with the bpmn document 2020-07-27 12:02:34 -04:00
Dan Funk 824582dab1 Hot fix to correct for a failing test due to updates in Spiffworkflow library,
and modifying the token authorization so that we can log in as different users when not in production mode.
2020-07-27 11:25:29 -04:00
Kelly McDonald a124e13c6a Replace all legacy style calls with new calls.
Still having issues where we try to eval an empty definition, not quite sure why there is a difference from what we had before. I may need to revert some of it and determine what is going on.
2020-07-24 14:33:24 -04:00
Kelly McDonald f5ab283538 Test of adding in the ability of augmenting the workflow to include internal scripts like StudyInfo
This is the first waypoint on a larger effort to make all of the 'special scripts' that currently require a shebang to be just another python function.
2020-07-24 12:08:46 -04:00
Kelly McDonald ce8d7cad16 We resolved a problem with a test with some changes to Spiff, change the correct so that it is correct. 2020-07-23 14:56:12 -04:00
Carlos Lopez 74e5e07114 Testing for all values 2020-07-23 07:41:29 -06:00
Aaron Louie aa7437bfc4 Merge branch 'dev' into feature/approvals_dashboard_prototype 2020-07-22 13:08:32 -04:00
Dan Funk a243c14d75 Updating to lastest spiffworkflow which uses box to support dot notation.
Adding a new endpoint for evaluating the results of a python expression into the tools section of the api.
2020-07-22 11:30:16 -04:00
Carlos Lopez 41cbce8e01 Updating bpmn test 2020-07-21 21:08:08 -06:00
Carlos Lopez 522f848682 Addressing feedback 2020-07-21 20:54:03 -06:00
Carlos Lopez 313770d538 Ldap lookup script 2020-07-21 20:54:03 -06:00
Dan Funk 3d9eeab502 Add a few more details to the workflow metadata model. 2020-07-21 15:18:08 -04:00
Dan Funk d01b30debc Building the start of an endpoint that could be used by logged in / authenticated users that will evaluate basic python functions sent in via the API.
The hope here is that we can process these in real time for the front end, but still do it using the same evaluation engine we use everywhere else, so
the syntax for things like hide-expressions can be properly verified during workflow validation and will be assured to work during front end rendering.
Removing any all javascript code in the BPMN models.
2020-07-21 13:57:33 -04:00
Dan Funk 6caf44544c Merge branch 'dev' into cr-connect-92-scripting-enhancements
# Conflicts:
#	crc/static/bpmn/ind_supplement/ind_supplement.bpmn
#	tests/workflow/test_workflow_service.py
2020-07-20 13:01:23 -04:00
Dan Funk dd0f984347 Drop backwards compatibility of scripts. While this will cause some initial pain, it's less confusing and error prone, and we are still in the development phase of the project. Were this going straight to production we would likely want to keep this backwards compatibility.
Don't parse on spaces if this is python code, so we avoid any errors in processing - spaces should be valid.
2020-07-20 12:26:34 -04:00
Dan Funk 06430550c8 Dropping the RRT-Data-Fix, it should have come out already, but had a failing test, so pulling it out now rather than delve into what is going wrong with obsolete code. 2020-07-20 11:39:50 -04:00
Carlos Lopez fcb772c900 Reporting to Sentry all captured exceptions and enabling multiple environments 2020-07-19 16:40:33 -06:00
Carlos Lopez 73400ed6c7 Adding proper tests for files publishing 2020-07-17 16:59:25 -06:00
Aaron Louie e82532aad8 Updates IND workflow spec. Fixes validation process to return lookups for enum values. 2020-07-17 11:51:21 -04:00
Kelly McDonald de54b63e20 Process scripts with no shebang (#!) as a regular python script. If there is a shebang, we look up the class as we did before.
I've also made it so that it falls back if we accidentally forget to add a shebang to a study as this would be a breaking change.

With the fallback feature, it should work with unmodified bpmn documents.
2020-07-17 10:56:04 -04:00
Kelly McDonald ab5771024e Check in for sanity check 2020-07-17 09:24:53 -04:00
Aaron Louie 7cbafe966e Adds form key and pool name 2020-07-16 17:59:56 -04:00
Aaron Louie 9570e19b09 Fixes failing test 2020-07-16 14:02:29 -04:00
Aaron Louie d67105332f Merge branch 'dev' into feature/lanes_and_roles 2020-07-16 14:00:53 -04:00
Aaron Louie d0279a11e5 Fixes failing unit test 2020-07-15 17:44:46 -04:00
Aaron Louie 040a95281e Updates package hashes 2020-07-15 17:09:34 -04:00
Aaron Louie 08fba1a4dc Merge branch 'dev' into feature/dynamic_enum_list 2020-07-15 13:09:02 -04:00
Dan Funk c7662315aa Assure that any errors that occur during the do_engine_steps is correctly captured and returned to the end user or configurator with enough information for them to act on. 2020-07-15 11:16:35 -04:00
Dan Funk d85ca1ce51 Whenever a workflow is loaded or updated, add events to the TaskEvent table with assignments for the next set of ready tasks, along with who should complete those tasks.
Add the lane information to the Task model.
Drop the foreign key constraint on the user_uid in the task log, as we might create tasks for users before they ever log into the system.
Add a new endpoint to the API called task events.  It should be possible to query this and get a list of all tasks that need a users attention.
The task events returned include detailed information about the workflow and study as sub-models
Rename all the actions in event log to things that are easier to pass over the api as arguments, make this backwards compatible, updating existing names in the database via the migration.
Throughly test the navigation and task details as control of the workflow is passed between two lanes.
2020-07-14 22:16:44 -04:00
Dan Funk 9077ff3ebf It is not possible to use task_data for an auto-complete field. It's too expensive an operation to provide that feature on the backend, and the data already fully resides on the front end anyway. Task-data can be used to populate enum fields if needed, so it can populate dropdowns, radios and checkboxes, just not auto-complete. 2020-07-14 11:38:48 -04:00
Dan Funk a48322ef6a Partial work on CR Connect Roles.
Adding checks in the API to assure the correct person is completeing a task based on the task's lane.
Adding lane to the Navigation item.
Adding a check to assure that unique user ids can be identified using task.data
Added some additional ldap entries to make testing and development easier.
Removed a big chunk of duplicate code from task_tests_api
Modified some of the helper functions to make it easier to test as specific users.
Added some additional bpmn models to the tests for testing lanes and roles.
2020-07-14 10:29:25 -04:00
Dan Funk f83995a692 Partial work towards roles and lane support 2020-07-14 09:01:29 -04:00
Aaron Louie 07066b8a16 Looks up enum options from task data 2020-07-13 17:46:28 -04:00
Aaron Louie 3c8e1e5c37 Tests for presence of data property in enum options 2020-07-13 11:02:29 -04:00
Dan Funk ff7c30b879
Merge pull request #138 from sartography/fix/cleanup_todos
Cleanup pending  TODOs
2020-07-10 08:26:47 -04:00
Dan Funk 6a79fb3581 There may be multiple investigators of the same type that come back from the protocol builder, adding some tests and additional code to handle this, but still keep the list flat, currently appends a number to the investigator type when there is more than one. 2020-07-07 17:16:33 -04:00
Carlos Lopez b4e127b3b7 Cleaning properly previous versions 2020-07-07 08:32:41 -06:00
Carlos Lopez a302208890 Updating test for study with approvals 2020-07-07 08:32:41 -06:00
Carlos Lopez c7b864f9c7 Cleaning up old notes 2020-07-07 08:32:20 -06:00
Dan Funk 8a66128189 Bug fixes after bumping the version of Spiffworlflow to the latest - which has fixes for sequential multi-instance. 2020-07-06 15:34:24 -04:00
Dan Funk 419c05e46c
Merge branch 'dev' into fix/more-info-in-exceptions 2020-07-06 12:51:24 -04:00
Dan Funk a5cef8775e * Modifying the StudyInfo script to return both "investigators" and "roles", the investigators argument will return only the current active investigators according to the protocol builder. The "roles" argument returns all possible roles - it is what "investigators" use to be.
* The Task.title returned to the front end will now attempt to process the "display_name" property for dot-notation syntax, making it possible to use this for multi-instance tasks,
  but will work in all cases where we want he title to change based on values in the data model.
* Fixing a bug the test_study_api where it wasn't updated when we made recent changes to the different states of a study.
*
2020-07-06 12:09:21 -04:00
Carlos Lopez 817333f26e Adding proper exception information 2020-07-02 16:10:33 -06:00
Dan Funk 93bf46354b A last minute change to make the API a little clearer and cleaner broke some tests. 2020-06-30 11:12:28 -04:00
Dan Funk f183e12fe5 Provides some basic tools for getting additional information about a lookup field.
Adds an optional 'value' parameter to the lookup endpoint so you can find a specific entry in the lookup table.
Makes sure the data attribute returned on a lookup model is a dictionary, and not a string.
Fixes a previous bug that would crop up if double spaces were used when performing a search.
2020-06-30 10:34:16 -04:00
Dan Funk d3ce1af1ce Provides some basic tools for getting additional information about a lookup field.
Adds an optional 'id' parameter to the lookup endpoint so you can find a specific entry in the lookup table.
Makes sure the data attribute returned on a lookup model is a dictionary, and not a string.
Fixes a previous bug that would crop up in double spaces were used when performing a search.
2020-06-30 10:00:22 -04:00
Aaron Louie e650a46073 Fixes local testing bug where working directory was sometimes wrong. 2020-06-29 16:41:42 -04:00
Aaron Louie fe61333b7b Fixes typo 2020-06-26 12:31:15 -04:00
Aaron Louie 29b108673d Adds failing test exposing bug with getting data for multi-instance tasks 2020-06-26 11:51:27 -04:00
Dan Funk 150117587e Merge branch 'dev' into feature/parallel_multiinstance_tasks 2020-06-25 23:20:38 -04:00
Dan Funk fe5a7ddce3 Merge remote-tracking branch 'origin/rrt/dev' into feature/emails-enhancement 2020-06-25 13:29:06 -04:00
Aaron Louie be6dcc7020 Merge branch 'STG-26' into feature/parallel_multiinstance_tasks 2020-06-25 12:55:28 -04:00
Dan Funk 0ca9b9624e Switching to STG-26 for the Spiff Library, and adding a test that demonstrates the failure Aaron ran into yesterday. 2020-06-25 12:44:34 -04:00
Carlos Lopez 5d1ae402b6 Slight refactor on data passed to template rendering 2020-06-24 22:43:44 -06:00
Carlos Lopez a0d877e02f Feedback from PR addressed 2020-06-24 22:23:31 -06:00
Carlos Lopez 5327b469f6 Merge branch 'rrt/dev' into feature/emails-enhancement 2020-06-24 21:46:53 -06:00
Aaron Louie a40adeca3a Merge branch 'dev' into STG-26 2020-06-22 19:57:43 -04:00
Carlos Lopez 91fe5f0cdd Fixing broken test 2020-06-22 14:22:56 -06:00
Carlos Lopez dc5ffd29d0 Refactoring shared code 2020-06-22 14:07:57 -06:00
Dan Funk 6aec15cc7c Shifting to a different model, where the TaskEvents store ONLY the form data submitted for that task.
In order to allow proper deletion of tasks, we no longer merge data returned from the front end, we set it directly as the task_data.
When returning data to the front end, we take any previous form submission and merge it into the current task data, allowing users to keep their previous submissions.
There is now an "extract_form_data" method that does it's best job to calculate what form data might have changed from the front end.
2020-06-19 08:22:53 -04:00
Carlos Lopez e6d74aaa1a Removing extra index when parsing users info 2020-06-18 12:53:50 -06:00
Kelly McDonald 479f6d9647 STG-26
Do rename per conversation, continue to look for ways to implement looping in a way that is re-entrant
2020-06-18 12:01:02 -04:00
Carlos Lopez 4db815a999 Handling incoming values from processor 2020-06-17 21:11:47 -06:00
Carlos Lopez e947f40ec7 Merge branch 'rrt/dev' into feature/emails-enhancement 2020-06-17 20:10:11 -06:00
Carlos Lopez 5ce279b663 Dropping silly pdb statement 2020-06-17 17:36:15 -06:00
Carlos Lopez 896ba6b377 Email relies now on markdown content 2020-06-17 17:00:16 -06:00
Carlos Lopez ddf1f4640c Re-organizing tests file structure 2020-06-17 16:10:06 -06:00
Carlos Lopez 2ce2dc73b5 Rendering proper content & organizing file structure for email tests 2020-06-17 16:09:38 -06:00
Dan Funk 3b57adb84c Continuing a major refactor. Some important points:
* TaskEvents now contain the data for each event as it was when the task was completed.
* When loading a task for the front end, if the task was completed previously, we take that data, and overwrite it with the lastest data, allowing users to see previously entered values.
* Pulling in the Admin branch, as there are changes in that branch that are critical to seeing what is happening when we do this thing.
* Moved code for converting a workflow to an API ready data stricture into the Workflow service where it belongs, and out of the API.
* Hard resets just convert to using the latest spec, they don't try to keep the data from the last task.  There is a better way.
* Moving to a previous task does not attept to keep the data from the last completed task.
* Added a function that will fix all the existing RRT data by adding critical data into the TaskEvent model. This can be called with from the flask command line tool.
2020-06-17 17:11:15 -04:00
Kelly McDonald 1844c93919 STG-26 - basic test case for a looping task
Criteria :
task.multi_instance_type == 'looping'

to terminate, use the standard endpoint for submitting form data with a query variable of terminate_loop=true

Will likely need two buttons:
"Submit and quit"
"Submit and add another"
or something similar
2020-06-17 11:35:06 -04:00
Carlos Lopez d4a285883f Email script 2020-06-16 18:42:36 -06:00
Dan Funk c7d8eaff30 Merge branch 'dev' into feature/refactor_data_loading 2020-06-16 13:15:43 -04:00
Kelly McDonald 0d3105fe7e Make changes to the workflow names so that they are placed in the correct order - I made workflows go in order of the name rather than in the order they appear in the XML to allow more control over the way the nav list is displayed. 2020-06-15 12:32:19 -04:00
Carlos Lopez 5f13b96079 More enhancements 2020-06-12 12:17:08 -06:00
Aaron Louie e3126620b3 Eschews obfuscation 2020-06-12 14:09:08 -04:00
Aaron Louie 561e254315 Prevents non-admin users from editing each others' tasks. Fixes bug where test user uid was not being set from token. Moves complete form and get workflow API test utility methods into BaseTest. 2020-06-12 13:46:10 -04:00
Aaron Louie 691258a4fb Fixes bug where approvals counts were off by 1. Tests CSV export and all approvals endpoints with lots of records. 2020-06-11 17:15:44 -04:00
Aaron Louie f51e5e4e6b Adds tests for approval counts and all approvals endpoints 2020-06-11 16:39:00 -04:00
Aaron Louie 768f14b3ac Cleans up console logging 2020-06-11 13:42:44 -04:00
Aaron Louie 0cbbe756a3 Tests for token expiration ApiError 2020-06-11 13:42:32 -04:00
Dan Funk 4e006e2653 Clear out the g.user between tests. 2020-06-11 11:49:07 -04:00
Aaron Louie cccff9b856 Fixes broken unit tests. But still broken. 2020-06-11 11:29:58 -04:00
Aaron Louie 1f5554d0d8 Merge branch 'rrt/dev' into feature/swagger_admin_authentication 2020-06-11 08:55:29 -04:00
Carlos Lopez e9e805b2c9 Storing emails in database 2020-06-09 22:57:56 -06:00
Carlos Lopez 5c1c0f685e Tests update 2020-06-08 16:17:41 -06:00
Aaron Louie 87e2379871 Merge branch 'rrt/dev' into feature/swagger_admin_authentication 2020-06-08 10:30:16 -04:00
Aaron Louie af1c848f65 Merge branch 'rrt/dev' into rrt/testing 2020-06-07 19:57:09 -04:00
Dan Funk 213d3f3501 Merge branch 'feature/better_approval_status' into rrt/dev 2020-06-05 19:11:16 -04:00
Dan Funk 6861991d8f Allow setting the type of approvals you want back, by status.
Some very minor performance enhancements, that will add up on the Approvers page.
2020-06-05 17:49:55 -04:00
Carlos Lopez 57a7c7fa54 Approve/deny fixes 2020-06-05 13:39:52 -06:00
Carlos Lopez 16ca4fa2c0 Merge branch 'rrt/dev' into feature/mail-system 2020-06-05 12:35:05 -06:00
Carlos Lopez a6758fd555 Removing deprecation warnings 2020-06-05 12:08:46 -06:00
Carlos Lopez 4fc1b51cbc Approve/denied emails 2020-06-05 12:08:31 -06:00
Carlos Lopez 4727d87adb Hooking up emails into process - start 2020-06-04 20:37:28 -06:00
Dan Funk fed6e86f92 Trying to fix LDAP issues on production. Changing LDAP to static only methods, caching the connection and calling bind before all connection requests.
Also assuring we don't load the documents.xls file over and over again.
2020-06-04 14:59:36 -04:00
Dan Funk 1324533865 Some additional cleanup - when a file is "archived" it is no longer returned for any endpoints about files, but it
is directly accessible via id, in the event some request is made for it at a later date.
2020-06-04 09:49:42 -04:00
Carlos Lopez f581bd9f2b Mails for approval process 2020-06-04 00:35:59 -06:00
Dan Funk 217ecfc911 When you can't delete a file, mark it as archived. Don't include archived files in new approval requests. 2020-06-03 17:34:27 -04:00
Dan Funk 4bf13b0718 Doing everything I can imagine to get a CSV dump out tomorrow. 2020-06-02 22:01:49 -04:00
Dan Funk e7c130054d Fixing a test. 2020-06-02 20:07:56 -04:00
Dan Funk c7484267e1 For the main approval endpoints - we now group the approvals by study. So you get one record back for each study, but it may have other approvals along with it as "related_approvals".
We now cache the LDAP records - so we look in our own database for the record before calling out to ldap for the details when given a straight up computing id like dhf8r.

Added "date_approved" to the approval model.

And moved the approver and primary investigator into real associated models to make it easier to dump.

Fixed a problem with the validation that was causing it to throw incorrect errors on valid workflows. Getting it to behave a little more like the front end behaves, and respecting the read-only fields.  But it was mainly to do with always returning all the data with each form submission.
2020-06-02 18:17:00 -04:00
Dan Funk 59e91ec414 Don't add an empty approval record. 2020-06-02 08:35:19 -04:00
Dan Funk d8329e9eff I completely missed pushing up my changes last night before handing back over to Carlos. Sorry about that.
Added checks to assure the approver matches g.uid of the current user - otherwise don't modify the approval record.
2020-06-02 07:43:19 -04:00
Dan Funk 4090667a5d Missed committing a pile of changes last night. 2020-06-02 07:08:29 -04:00
Dan Funk c2a1b0175a Tweaks to approvals 2020-06-01 21:49:30 -04:00
Dan Funk 1db9401166 Don't put all the data into Spiff Tasks on a reload or backtrack, just store the data that gets submitted each time in the task log, and use that.
This should correct issues with parallel tasks and other complex areas - so we don't have tasks seeing data that isn't along their path.
2020-06-01 17:42:39 -04:00
Carlos Lopez bec11980eb Fixing broken test by using proper FileSchema 2020-05-31 22:00:52 -06:00
Aaron Louie 311e180c65 Comments out failing test for now. Adds a placeholder test for study approvals 2020-05-31 23:16:14 -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
Aaron Louie c4a84ac509 Work in progress: Trying to get Swagger to use verify_token_admin to protect admin endpoints. Not working for some reason, though. 2020-05-31 18:01:08 -04:00
Dan Funk 73137d0858 If an assertion fails, the tests stop at that point, never reaching the last line in the test. You have to handle any tear down, in the tearDown method. 2020-05-31 17:18:07 -04:00
Aaron Louie be9b613bbb Refactors user authentication endpoints so we can use the Swagger UI in production mode 2020-05-31 16:49:39 -04:00
Carlos Lopez 26809d1470 Waiting status renaming 2020-05-31 13:35:42 -06:00
Dan Funk 98fb305868 Run the validation process twice, each time it is requested, first populating everything, and then a second time
using on the required form fields.
2020-05-30 18:43:20 -04:00
Dan Funk 1f0e8741ba Run the validation twice, once completing all of the data, and a second time, completing only the required fields.
Also, add a helper method to reduce boiler plate code around Workflow Exceptions.
2020-05-30 17:26:27 -04:00
Dan Funk 860c475b29 Fill out repeating sections during validation process.
Also, when returning error messages, attempt to include the task data for the task that caused the error.
Also, when attempting to delete any file, respond with an API error explaining the issue, and log the details.
2020-05-30 15:37:04 -04:00
Dan Funk 5046d3a669 Committed a stupid. 2020-05-29 15:20:22 -04:00
Dan Funk 4e4cc7884c Better ldap searching. 2020-05-29 15:17:51 -04:00
Dan Funk 0ba2819867 Merge branch 'dev' into feature/approval_request_script 2020-05-29 04:51:50 -04:00
Dan Funk 11413838a7 Faster lookup fields. We were parsing the spec each time to get details about how to search. We're just grabbing the workflow id and task id now and building that straight into the full text search index for faster lookups. Should be peppy.
Another speed improvement - data in the FileDataModel is deferred, and not queried until it is specifically used, as the new data structures need to use this model frequently.
2020-05-29 01:39:39 -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
Carlos Lopez 41b26e28bd Merge branch 'dev' into feature/approval_request_script 2020-05-28 08:11:31 -06: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 560263d1a3 Missed another test. 2020-05-27 14:45:00 -04:00
Dan Funk 77f72e408f Lookup Service now raises exact matches to the top. Very hackish, but it works. 2020-05-27 14:36:10 -04:00
Carlos Lopez 54640988a7 Update endpoint fixes 2020-05-27 12:06:32 -06:00
Dan Funk 229b5d5ece Forgot to add the test fixes. 2020-05-27 09:55:46 -04:00
Dan Funk d5e075db82 Order search results by relevancy in the lookup service. 2020-05-27 09:47:44 -04:00
Dan Funk 7869fa596e Protocol Builder isn't disabled on the dcos servers, trying to figure out why, and assure it isn't some sort of weird race condition. 2020-05-26 22:42:49 -04:00
Dan Funk eb15d172c1 I absolutely must fix our cascade deletes, but I sort of like the horror such chunks of code cause, we really need to protect these endpoints, and assure they never get called under normal circumstances, and raise some thoughtful errors. 2020-05-26 21:18:09 -04:00
Dan Funk ccbf374b40 Loads of bug fixes.
Modifed the request_approval to take a list of arguments, which works better for us... today.
UpdateStudy correctly handles validation.
WorkflowService correctly populates random values from lookup tables.
And several fixes down in Spiffworkflow, including a big bug where only the last item in a decision table made it through.
2020-05-26 20:06:50 -04:00
Dan Funk e9645fa3fd Renamed redirect_url to just redirect. 2020-05-26 15:47:41 -04:00
Carlos Lopez 72b59deeaf Completing tests 2020-05-26 10:21:36 -06:00
Dan Funk a14168362a Merge branch 'feature/support_ui_dashboard' into dev 2020-05-25 21:31:16 -04:00
Carlos Lopez 727274ae33 Using full approval payload to update record 2020-05-25 15:40:24 -06:00
Dan Funk be057e8758 Adding an "UpdateStudy" task that is able to update the data on the study model, useful for setting core data points on the model, such as setting the Primary Investigator, or altering the Study Title.
Fixing a bug where the validation of forms did not correctly process auto-complete fields.
Fixing a bug where the approvals script and the update study script could not process dot notation correctly.

Moved populate_random_data into the WorkflowService where it makes more sense.
2020-05-25 15:30:06 -04:00
Dan Funk 6cd4ef64d1 Fixing add_study api endpoint, so you can actually add a new "Study" with just some basic information.
Using the LDAP service for checking user details in development mode - even if you are using the back door.
Added a new Flask fucntion load-example-rrt-data that loads the rrt workflow, and not the CRC wrokflows.
Modified the "load-example-data" in the tests to use some test data, rather than loading up all the workflows[
in CRC each time, with a parameter to load crc data if that is required - which is enabled for just a handful of tests.
(Tests run in 1/4 the time now)
2020-05-25 12:29:05 -04:00
Dan Funk 971d9a58e9 As we now have an approval_service.py, I moved all the business logic into this service and out of the request_approval.py script. And moved all tests for these features into a test file for the service. Will make it easier to cross reference what is happening, as everything all happens in one file.
As many of the scripts need to know the workflow, and it's down in a weird parameter, moved this so it is passed in each time.
2020-05-24 16:13:15 -04:00
Carlos Lopez e9bd19b112 Fixing broken test 2020-05-24 01:22:14 -06:00
Carlos Lopez 49eb4b3f98 Making working endpoints for approvals 2020-05-23 23:53:48 -06:00
Dan Funk d39ef658a2 Made some modifications to the Approval so that it knows exactly what versions of every file are being sent for approval
Added the following columns:
  * date_created - so we know when the file was created
  * renamed workflow_version to just "version", because everything has a version,  this is the version of the request.
  * workflow_hash - this is just a quick way to see what files and versions are associated with the request, it could be factored out.
  * study - a quick relationship link to the study, so that this model is easier to use.
  * workflow - ditto
  * approval_files - these is a list from a new link table that links an approval to specific files and versions.

The RequestApproval is logically sound, but still needs some additional pieces in place to be callable from a BPMN workflow diagram.

Altered the file service to pick up on changes to files vs adding new files, so that versions are picked up correctly as
users modify their submission - adding new files or replacing existing ones.  Deleting files worries me, and I will need to revisit this.

The damn base test keeps giving me a headache, so I made changes there to see if clearing and dropping the database each time won't allow the tests to pass more consistently.

Lots more tests around the file service to make sure it is versioning user uploaded files correctly.

The "Test Request Approval Script" tries to find to assure the correct behavior as this is likely to be called many times repeatedly and with little knowledge of the internal system.  So it should just "do the right thing".
2020-05-23 15:08:17 -04:00
Aaron Louie 6c14248ef9 Adds 'v1.0/' to login route 2020-05-23 14:49:02 -04:00
Dan Funk 49c322177b
Merge pull request #76 from sartography/feature/rrp-endpoints
Feature/rrp endpoints
2020-05-22 19:38:26 -04:00
Dan Funk 148e86bb42 Building out the boilerplate code to make pushing forward on this a little friendlier.
There is an approval api file, and approval model file and an approval test file.
2020-05-22 18:25:00 -04:00
Dan Funk d1606ffb1a forgot to include the new empty master workflow, which allows the tests to all pass. 2020-05-22 15:31:38 -04:00
Dan Funk 1017bb1897 On the tools/render_docx api, allow sending the json data in the body, rather than as a ludicrous long get parameter. Silly Dan. 2020-05-22 15:30:22 -04:00
Dan Funk 503c1c8f18 Allow disabling the Protocol Builder
PB_ENABLED can be set to false in the configuration (either in a file called instance/config.py, or as an environment variable)

Added a check in the base_test, to assure that we are always running tests with the test configuration, and bail out otherwise.  Setting TESTING=true as an environment variable will get this, but so well the correct ordering of imports. Just be dead certain the first file every test file imports is base_test.py.

Aaron was right, and we call the Protocol Builder in all kinds of awful places.  But we don't do this now.  So Carlos, you should have the ability to reuse a lot of the logic in the study_service now.

I dropped the poorly named "study-update" endpoint completely.  We weren't using it. POST and PUT to Study still work just fine for doing exactly that.

All the tests now run and pass with the Protocol builder disabled. Tests that specifically check PB behavior turn it back on for the test, or mock it out.
2020-05-22 14:37:49 -04:00
Dan Funk b490005af7 dropping the remaining config stuff for flask_sso.
updaing the user 'sso' endpoint to provide additional information for debugging.
Pulling information from ldap to stay super consistent on where we get our information.
2020-05-22 09:50:18 -04:00
Dan Funk 951710d762 ldap lookup.
Refactored calls into a new lookup_service to keep things tidy.

New keys for all enum/auto-complete fields:
    PROP_OPTIONS_FILE = "spreadsheet.name"
    PROP_OPTIONS_VALUE_COLUMN = "spreadsheet.value.column"
    PROP_OPTIONS_LABEL_COL = "spreadsheet.label.column"
    PROP_LDAP_LOOKUP = "ldap.lookup"
    FIELD_TYPE_AUTO_COMPLETE = "autocomplete"
2020-05-19 16:11:43 -04:00
Dan Funk dff92c6e4c fixing a test. 2020-05-18 20:49:50 -04:00
Dan Funk 5c5c2a7312 Assure that new lines entered in text-fields are correctly added to the final word document. 2020-05-18 11:55:10 -04:00
Dan Funk 7a380fdeb4 Forgot to fix another test and to add the example file used for a previous test. 2020-05-16 15:38:15 -04:00
Dan Funk 43bf8f5337 Fixing a bug with navigation where elements went missing past exclusive gateways on subsequent forks. 2020-05-16 15:33:06 -04:00
Dan Funk de435bd961 the heck with camel case, what the heck TypeScript? Get a grip. This is a python API. 2020-05-15 16:38:37 -04:00
Dan Funk 53255ef35e massive overhaul of the Workflow API endpoint.
No Previous Task, No Last Task, No Task List.  Just the current task, and the Navigation.
Use the token endpoint to set the current task, even if it is a "READY" task in the api.
Previous Task can be set by identifying the prior task in the Navigation (I'm hoping)
Prefering camel case to snake case on all new apis.  Maybe clean the rest up later.
2020-05-15 15:54:53 -04:00
Dan Funk b63ee8159e We now only return the ready user tasks, not all tasks, and even then the ready user tasks don't come back with the forms and details, just the bare minimum. Speeds things up considerably, and most of this information wasn't used anyway. 2020-05-14 17:13:47 -04:00
Dan Funk 6d4348d644 Fixing some failing tests. Moved the task properties into a dictionary, but moving the form field properties to a dictionary will be a larger effort that we don't want to get into on either the back or front end right this moment. 2020-05-14 14:39:14 -04:00
Dan Funk 55a1850e7c adding a navigation component to the Workflow Model.
running all extension/properties through the Jinja template processor so you can have custom display names using data, very helpful for building multi-instance displays.
Properties was returned as an array of key/value pairs, which is just mean.  Switched this to a dictionary.
2020-05-14 13:43:23 -04:00
Dan Funk b7c11fd893 Merge branch 'master' into feature/investigators_reference_file 2020-05-11 17:36:37 -04:00
Dan Funk 02f8764056 Updated to use the latest script engine / evaluation engine that creates a single location where all values used in BPMN/DMN are processed. Right now this is a python based interpreter, but we will eventually base this on FEEL expressions.
The validation process needs to take the api model into account so we catch errors with bad file names.
2020-05-11 17:04:05 -04:00
Dan Funk da7cae51b8 Adding a new reference file that provides greater details about the investigators related to a study.
Improving the study_info script documentation to provide detailed examples of values returned based on arguments.
Making the tests a little more targetted and less subject to breaking through better mocks.
Allow all tests to pass even when ther protocol builder mock isn't running locally.
Removing the duplication of reference files in tests and static, as this seems silly to me at the moment.
2020-05-07 13:57:24 -04:00
Dan Funk 1571986c0e I had to give up and live with the idea that we can only render documentation on the current task, not on the previous or next tasks. I think this is ok. If you want to view a task, you need to make it the active task to assure all the parts and pieces are in place. 2020-05-06 13:01:38 -04:00
Dan Funk 07e58e923d Merge remote-tracking branch 'origin/chore/update_specs' into feature/previous_task
# Conflicts:
#	Pipfile.lock

Assuring that all documents from the xls spreadsheet are loaded when doing validations.
2020-05-06 11:25:50 -04:00
Dan Funk 9629b36e92 Setting JSON_SORT_KEYS to false, assuring that Flask does not resort all data returned to the front end.
Updating Spiff Workflow which has some critical behavioral changes around MultiInstance.
2020-05-06 10:59:49 -04:00
Aaron Louie 4ecb0cb3a3 Updates BPMN files 2020-05-05 16:15:38 -04:00
Dan Funk 714b5f3be0 Merge branch 'feature/protocol_status' into feature/previous_task
# Conflicts:
#	crc/services/study_service.py
2020-05-04 11:08:36 -04:00
Dan Funk 2699f5c65c Refactor the stats models, and assure they are very correct across all tests with the workflow api.
I noticed we were saving the workflow every time we loaded it up, rather than only when we were making changes to it.  Refactored this to be a little more careful.
Centralized the saving of the workflow into one location in the processor, so we can make sure we update all the details about that workflow every time we save.
The workflow service has a method that will log any task action taken in a consistent way.
The stats models were removed from the API completely.  Will wait for a use case for dealing with this later.
2020-05-04 10:57:09 -04:00
Dan Funk 7c743d65ed Adding tests around parallel which pass great, but ran into a bug down in Spiff that I'm passing back to Kelly with a test in that repo. More coming on this. 2020-04-30 15:39:11 -04:00
Dan Funk bec59a71d7 Deleteing stuff is a damn mess, but this is a little cleaner. 2020-04-29 16:07:39 -04:00
Dan Funk f1f8b91c9c Refactor the document details scripts. Now there is one script, it returns data in a consistent format, and has all the details required. The script is located in StudyInfo, with the argument documents. Make note that it returns a dictionary of ALL the documents, with a field to mark which ones are required according to the protocol builder. Others may become required if a workflow determines such, in which case the workflow will enforce this, and the document will have a count > 0, and additional details in a list of files within the document. I modified the XLS file to use lower case variable names, because it disturbed me, and we have to reference them frequently. Removed devious "as_object" variable on get_required_docs, so it behaves like the other methods all the time, and returns a dictionary. All the core business logic for finding the documents list now resides in the StudyService.
Because this changes the endpoint for all existing document details, I've modified all the test and static bpmn files to use the new format.
Shorting up the SponsorsList.xls file makes for slightly faster tests. seems senseless to load 5000 everytime we reset the data.
Tried to test all of this carefully in the test_study_details_documents.py test.
2020-04-29 15:08:11 -04:00
Dan Funk 13333fb306 Adding an API endpoint that allows setting the token on the workflow to a specific task.
Added error checking such that attempting to submit data for a task that is not in the "READY" state throws an error message.
For some reason I'm getting lots of errors in the tests as they try to hit API endpoints they were not hitting before, so adding a number of mocks to some of the study service tests.
2020-04-28 17:25:53 -04:00
Dan Funk 0088364b1d Merge branch 'master' of github.com:sartography/cr-connect-workflow 2020-04-28 13:48:52 -04:00
Dan Funk 3e3a249e3c Verifying Sub-Process works, and adding a field to expose a hint as to the sub-process in which the task occurs.
Because the name field is now used to expose workflow/sub-process information on tasks, we can't use it to store the workflow_version, so that is now just stored on the database model.  Which is much cleaner and removes a duplication.
2020-04-28 13:48:44 -04:00
Aaron Louie 496e5b7719 Updates all workflow specs to match staging 2020-04-27 22:54:05 -04:00
Dan Funk 447f4013f8 Assure that a hard-reset sticks, and the system is properly updated. 2020-04-27 16:08:23 -04:00
Dan Funk 1b9743a4d1 Assure that if a form has an enumeration it errors out if that enumeration is empty. 2020-04-27 15:10:09 -04:00
Aaron Louie c85173de88 Sorts approvals by display order 2020-04-24 08:54:14 -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 08140eca17 Merge branch 'master' of github.com:sartography/cr-connect-workflow 2020-04-23 15:01:02 -04:00
Dan Funk 3aeb7ad116 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-23 14:58:17 -04:00
Aaron Louie 796c109611 Adds approvals to study service 2020-04-23 14:40:05 -04:00
Dan Funk ae2313203c fixing a failed test. Punished for doing a kind thing. 2020-04-23 13:06:51 -04:00
Dan Funk b5b46b7c2c better overall search results for type ahead. Still dealing with stop words failing. 2020-04-23 12:05:08 -04:00
Dan Funk 65b29e1a9d Don't just bomb out as soon as someone types an empty string. 2020-04-23 09:44:11 -04:00
Dan Funk 286af86f08 Forgot a missing bpmn file for running the tests. 2020-04-22 19:41:40 -04:00
Dan Funk 7b085c9c9d Adding an API Endpoint that will return a list of LookupValues that match a given query - can be used to populate an auto-complete table. 2020-04-22 19:40:40 -04:00
Dan Funk 6de8c8b977 Create lookup tables for XSL files referenced in workflows so we can do full text searches and populate lists on the fly quickly. 2020-04-22 15:37:02 -04:00
Dan Funk fd0adb1d43 Updated the study status to use a different enumeration. Migration correctly handles modifying the enum.
INCOMPLETE = 'Incomplete in Protocol Builder',
  ACTIVE = 'Active / Ready to roll',
  HOLD = 'On Hold',
  OPEN = 'Open - this study is in progress',
  ABANDONED = 'Abandoned, it got deleted in Protocol Builder'
2020-04-21 17:13:30 -04:00
Dan Funk 0a74bf8c44 We can now collect, and provide "extension properties" on a task as set in the camunda modeler.
These are provided as "properties" on a task, and are identical in structure to properties on a form field.
2020-04-21 12:07:59 -04:00
Dan Funk ec112f52be Make use of cleaner data provided by Spiffworkflow about multi-instance settings. 2020-04-21 11:43:43 -04:00
Dan Funk ee999a0f15 fixing a bunch of stupid mistakes because I am tried. 2020-04-20 20:28:12 -04:00
Dan Funk 59d400b058 Assure DMN can pick up name rather than label outputs. 2020-04-20 19:26:42 -04:00
Dan Funk edbd75bb75 Connect LDAP Requests to the StudyInfo service so we get back additional details. 2020-04-20 16:02:13 -04:00
Dan Funk 2d3402a719 Ldap Service with Test and mocks.
LDAP_URL can be set in an environment variable.
2020-04-20 15:16:33 -04:00