Commit Graph

548 Commits

Author SHA1 Message Date
Dan ff8a44a7b1 Make sure we always have a current user, even if the very first task is a script task. 2021-02-16 12:42:59 -05:00
Kelly McDonald e54a6956df Make a change in the case that we have no task_events at all. 2021-02-16 11:10:40 -05:00
Kelly McDonald 118cf62172 Merge remote-tracking branch 'origin/dev' into STG-181_frontend-ux-model-changes 2021-02-16 10:07:34 -05:00
Kelly McDonald 003bf2f9b9 Remove Approvals per ticket 183 2021-02-16 09:05:29 -05:00
Kelly McDonald 3b1dc70558 Add comment for later ticket 2021-02-16 08:44:41 -05:00
mike cullerton ed6218028c We now allow periods in field ids.
Also, added task_id and task_name to the ApiError for missing default value on hidden and required fields
2021-02-15 16:27:56 -05:00
mike cullerton 39eb5c5c21 This is a decent beginning framework for customer error messages.
It is not complete, but is in a state where we can start to interact with the front end.
Two tests are failing.
Committing so I can work on an error for Alex.
2021-02-12 14:18:42 -05:00
Dan Funk 35773ebc29
Merge pull request #240 from sartography/weird-email-error
The email script was failing validation because of missing parameters…
2021-02-12 09:31:52 -05:00
mike cullerton d8bd203139 The email script was failing validation because of missing parameters in scripts.email.do_task_validate_only.
I added a test in tests.test_email_script to make sure we get the default email_address.
I also found and fixed a bug in workflow_service.populate_form_with_random_data where we would overwrite default_values with random text because of a missing continue.
(We don't want to continue if we have repeating fields though.)
2021-02-11 15:36:12 -05:00
Dan Funk fe4e737596
Merge pull request #238 from sartography/value-expression-failing-shield-test-194
We now allow value_expression to evaluate to an empty string ("") so …
2021-02-11 11:25:09 -05:00
Dan Funk df25b83958
Merge pull request #235 from sartography/index-error-for-enums-186
Index error for enums 186
2021-02-11 11:21:50 -05:00
Dan Funk 10b9c7b892
Merge pull request #234 from sartography/hidden-and-required-fields-185
Hidden and required fields 185
2021-02-11 11:20:35 -05:00
Dan f7337f4e54 Merge branch 'dev' of github.com:sartography/cr-connect-workflow into dev 2021-02-11 11:17:56 -05:00
Dan 2ada9f6f42 Private Ldap settings 2021-02-11 11:17:21 -05:00
mike cullerton 39e874504f We now allow value_expression to evaluate to an empty string ("") so that we *do not* set a default value for enums in some cases.
This was causing an error because "" was not an option for the enum.
2021-02-10 14:35:58 -05:00
mike cullerton 8a2a8b1443 Still not in working order. Committing to work on another ticket. 2021-02-10 12:28:59 -05:00
Kelly McDonald da0af14724 Changes to enable front-end changes
Added a human readable name to created user

added last updated task time and name,

added is_review on the workflow which is triggered by a swimlane with a name present.

Notably - it does NOT update or change any of the performance concerns that we were having with this.
2021-02-10 11:58:19 -05:00
mike cullerton b42b843f7d It was possible for an enum field lookup to return an empty list. This meant there were no options for the list.
We now test for this and raise an error.
2021-02-08 15:10:53 -05:00
mike cullerton e87e7b5b8b Form fields that can be hidden and required must now have a default value or value_expression.
Also, if a field is hidden but not required, it should not produce a value.
2021-02-08 10:18:41 -05:00
mike cullerton fa34bee18a First commit for cleaning up error messages for customers.
This is *not* in a working state.
Committing this so I can work on another ticket.
2021-02-04 11:23:05 -05:00
Dan Funk 329146237e
Merge pull request #232 from sartography/boolean-default-values-175
Boolean default values 175
2021-02-03 16:34:54 -05:00
mike cullerton b090e31e00 This fixes 2 issues with setting boolean defaults
- If the default was False, we failed an early test and returned None. We now only return None if default is None
 - We have a better test for deciding if the default value we return should be True or False. We used to return True if the value was the string 'false'.
2021-02-03 09:50:16 -05:00
mike cullerton 7e76639cf3 When a study is put on hold, we now reset workflows and call any pending cancel_notify events.
In api.study.update_study we test the study status and call the new WorkflowService method process_workflows_for_cancels.
In services.workflow_service we added the new method process_workflows_for_cancels. It loops through workflows for a study, and resets them if they are in progress.
In services.workflow_processor, we changed the reset method to be an instance method so we can call self.cancel_notify.
In tests.test_lookup_service we changed the call to WorkflowProcessor.reset to reflect the change from class method to instance method
2021-01-29 14:05:07 -05:00
Dan Funk cccb722e07
Merge pull request #226 from sartography/enum_default_value_expression_162
Enum default value expression 162
2021-01-27 10:43:46 -05:00
mike cullerton 81e55b6055 Cleaning up my smell. A task should only have default_value *or* value_expresion, not both. 2021-01-27 10:21:13 -05:00
Dan Funk 98f946c119
Merge pull request #227 from sartography/missing_form_key_163
Missing form key 163
2021-01-27 09:42:46 -05:00
mike cullerton b71fd93dd4 We now make sure that forms have a form key. Ticket 163 2021-01-22 12:14:17 -05:00
mike cullerton 00d9276483 In spiff_task_to_api_task, when looping through fields, if the field doesn't have a value, we now try to set it with the default value
In test_spec, we now check for FIELD_PROP_VALUE_EXPRESSION when setting default values
2021-01-22 10:00:28 -05:00
Dan 5921ce9f10 Merge branch 'dev' into 152-workflow-spec-pull 2021-01-21 12:30:43 -05:00
Dan Funk 5b13195182
Merge pull request #224 from sartography/restart-with-no-data-99
Restart with no data 99
2021-01-20 17:22:18 -05:00
Dan 41dac33039 Removed two tests around soft_reset that are no longer required.
Reset should construct the workflow_processor, thus completing the reset process.
Removed the spec argument from init, as it is never used anywhere.
2021-01-20 13:24:53 -05:00
mike cullerton 039a1dcd79 WorkflowProcessor code for new restart_workflow api endpoint. WorkflowProcessor.reset will clear workflow_model.bpmn_workflow_json, and if clear_data is True will clear form data.
WorkflowProcessor.__init__ is mostly unchanged.
2021-01-19 15:14:36 -05:00
mike cullerton 6a9e6d3570 Restart workflow without form data. Committing so Dan can check it out 2021-01-14 15:32:14 -05:00
Kelly McDonald f282a9ef73 Make sure that top_level_workflow is transferred over, also include reference files in the list of files to sync
We may want to revisit this because I used a 'Magic' workflow_ref_id of 'REFERENCE_FILES' as a special case so I could re-use most of what I already had. This works well, but we may want to structure it different.
2021-01-11 09:21:44 -05:00
Dan 336c093bf8 Catch errors when building enumeration lists. 2021-01-08 15:15:24 -05:00
Dan 26655b26d3 merging in dev, and fixing a failing test from dev. 2021-01-08 14:42:13 -05:00
Dan Funk 9118517995
Merge pull request #220 from sartography/prevent-duplicate-template-upload-111
Users cannot upload a workflow_spec_file that already exists. We rais…
2021-01-08 13:55:19 -05:00
mike cullerton d274813ae5 We now check form field IDs so they play well with Python and Javascript. 2021-01-07 11:10:31 -05:00
mike cullerton c9a4a9685f Users cannot upload a workflow_spec_file that already exists. We raise an error that is displayed on the fron end. 2021-01-04 15:47:45 -05:00
mike cullerton 0ae4448fbe Fixed ApiError call. Now includes task_id and task_name. 2021-01-04 13:48:34 -05:00
Dan e5a38874f6 A hard or soft reset should also cause a 'cancel_notify' which will kick off any CANCEL events. If this happens during
a hard or soft reset, and an error is thrown trying to fulfil a cancel event, the reset should still fire.
Sending emails still had a number of issues correctly parsing it's arguments.  This is corrected.
2020-12-29 18:05:13 -05:00
Dan c288a8a2bc Merge branch 'dev' into check-field-type#143 2020-12-29 11:11:43 -05:00
mike cullerton 7938ac8eed We now assure each form field has a field type. Modified populate_form_with_random_data, added check at beginning of form field loop. 2020-12-28 18:02:16 -05:00
Dan 6cfce839c1 Validation now assures that we won't encounter errors when generating navigation lists.
Fixing workflow sync paths that were incorrect.
Repairing a suddenly failing test in files, that just don't make no sense.
Bumping spiffworkflow that contains a fix for issue #155
2020-12-28 17:33:38 -05:00
Dan 1f9bf72c59 Merge branch 'dev' into bug/navigation 2020-12-14 11:46:44 -05:00
Dan Funk 4268d0f482
Merge pull request #208 from sartography/152-workflow-spec-pull
152 workflow spec pull
2020-12-14 11:35:06 -05:00
Dan bcb78de225 Merge branch 'dev' into bug/navigation 2020-12-14 11:33:51 -05:00
Dan Funk e54404e424
Merge pull request #205 from sartography/test-email-script
Test email script
2020-12-14 11:28:14 -05:00
Dan b62a9c7074 Merge remote-tracking branch 'origin/dev' into bug/navigation 2020-12-14 10:40:21 -05:00
Dan fd4b881416 upgrading the pip libraries. 2020-12-14 10:30:10 -05:00
Dan 02ea414b94 Additional fixes to Navigation to allow a nested navigation structure. 2020-12-14 10:07:19 -05:00
mike cullerton 7defc2b02f Tests for uid in logs. Currently we test for uid in a response. This covers ApiError.
Currently, we don't have a test for Sentry. Unsure how to do this.
Also added a script, service and test workflow to help. (Also to learn about adding a script and service.)
2020-12-11 17:47:53 -05:00
Kelly McDonald adc4dc4453 redid the api a bit so that nothing was using open security - added a new endpoint for getting a workflow spec that uses the alternate API_TOKEN security and leave the original endpoint as it was. 2020-12-11 12:03:41 -05:00
Kelly McDonald 55e6f5b753 refactored calls into a service - forgot to add actual service 2020-12-11 11:42:00 -05:00
Dan 93b12a8e82 updates using new navigation from spiff workflow's navigation branch, all tests passing. 2020-12-04 17:56:12 -05:00
Dan Funk e15130e09c
Merge pull request #203 from sartography/151-data-store-exclusive-branch-expression
Added the ability to use the custom functions within a decision/flow …
2020-12-01 14:44:27 -05:00
Kelly McDonald 94662c560e Added the ability to use the custom functions within a decision/flow coming off of an exclusive join
Altered previous test to test this feature
2020-12-01 09:13:12 -05:00
mike cullerton 73e01b347b Ticket #105. Verify End Event Documentation. Added explicit call to _process_documentation at end of crc.services.workflow_service.test_spec for the end event 2020-11-24 16:51:18 -05:00
Kelly McDonald 1815a4b657 Merge branch '117-save-restore' into dev 2020-11-05 08:24:18 -05:00
Kelly McDonald 2931f45187 Add 'sponsors' to study_info call 2020-11-04 14:34:10 -05:00
Kelly McDonald 849a4e9f94 Made changes to how soft_reset works so it is backward compatible - essentially, we use the file if we are doing a soft-reset or a new workflow. NB, this may actually still have problems if we have a workflow with P/SMI and we do a soft-reset on it even if there are no structural changes.
Also, change how default_value is interpreted, looking at the object attribute rather than the properties list.
2020-10-09 11:00:33 -04:00
Kelly McDonald 8b23cdc05c commit changes before switching branches 2020-10-09 08:46:14 -04:00
Dan Funk b2aede2b8d Glob on windows seems to return directories where in linux it does not, so now assuring we don't try to add files from the sub-directory. 2020-10-05 17:35:35 -04:00
Dan Funk b544334f45 1. Updating Personnel BPMN diagram to debug some issues.
2. Disabling the token timeout for now, to see if this corrects the issues Alex is having with lost work.
3. Raising more thoughtful error messages for unknown lookup options.
4. Providing better validation of default values and injecting the correct value for defaults related to enum lists of all types.
5. Bumping Spiffworkflow library which contains some better error messages and checks.
2020-09-01 15:58:50 -04:00
Dan Funk 1052dff549 Merge remote-tracking branch 'origin/dev' into feature/python_eval 2020-08-27 14:33:16 -04:00
Dan Funk 53d09303d8 Validating that field properties are valid - they must exist as constants on the Task model.
Making all the lookup field names consistent.
Fixing the lookup service which was failing at times trying to find the correct field to use for building the lookup table.
Updating validation to check for additional fields and properties.
When connexion level errors occur, wrapping it in an API Error to be consistent.
2020-08-27 14:00:14 -04:00
Dan Funk d31fd47837 Merge branch 'dev' into feature/python_eval 2020-08-25 11:08:42 -04:00
Dan Funk 5be35e8bab Adding a study sponsors script to return details about study sponsors 2020-08-25 10:30:46 -04:00
Aaron Louie 4dc98a6b6b Injects current user into task data. 2020-08-21 13:34:37 -04:00
Dan Funk 7f60a19d55
Merge pull request #189 from sartography/feature/documents_publishing
Update github routines to use branches
2020-08-17 15:52:47 -04:00
Dan Funk 35b1b20960 Merge remote-tracking branch 'origin/dev' into feature/documents_publishing 2020-08-17 15:19:24 -04:00
Dan Funk dfaffc22b5 Merge remote-tracking branch 'origin/dev' into fix/returning_failed_name_message 2020-08-17 15:18:17 -04:00
Dan Funk d4c5e297cc Merge remote-tracking branch 'origin/dev' into fix/delete_workflow_endpoint 2020-08-17 15:09:11 -04:00
Dan Funk c09441d019 Merge branch 'dev' into fix/delete_workflow_endpoint 2020-08-17 15:07:58 -04:00
Dan Funk 85ad477b2b Some minor cleanup on the study status and automatic events. I wanted to avoid having one database model automatically generating other database models as a side effect. The study service now has full responsiblity to recording study events.
To help in running tests, adding __init__.py methods to all the test directories.
2020-08-17 14:56:00 -04:00
Carlos Lopez 2bd906e96d Update github routines to use branches 2020-08-14 11:04:22 -06:00
Carlos Lopez 304ca77e3e Fixing exception within NameError handler 2020-08-14 09:01:15 -06:00
Carlos Lopez 369fe4bb35 Automatic events refactoring 2020-08-14 08:36:46 -06:00
Dan Funk 9a5c1d7cfb I may have finally wrapped my head around full text search in python. Now properly using an index based on simple rather than english dictionary which has far fewer stop words and stemming processes and plays much better to the type ahead search we are trying to provide.
Stop words are no longer excluded, so "other" is a valid search and gets a result.
2020-08-13 18:13:41 -04:00
Aaron Louie 9a31d591ae Adds user uid and cascades study event in study model. Fixes migration to properly downgrade enums. 2020-08-12 10:13:23 -04:00
Carlos Lopez 79c14ad23c Unlinking file from workflow instead of trying to delete it 2020-08-10 22:23:20 -06:00
Dan Funk 3cfcd74a6a Just finding a few more edge cases, all tests should pass now. 2020-08-10 15:16:53 -04:00
Dan Funk b53d033400 Cleaning up the delete workflow method in study service so we don't try to delete the same thing more than once) 2020-08-10 14:56:33 -04:00
Dan Funk 56b161a234 Fixing the failing tests by passing in workflow.id rather than workflow to the delete workflow endpoint 2020-08-10 13:51:05 -04:00
Carlos Lopez d3462d2e15 Deleting all dependencies for a workflow 2020-08-10 07:42:56 -06:00
Carlos Lopez a561a5cddc Adjusting study events attribute 2020-08-08 18:25:01 -06:00
Aaron Louie c25536dcca Makes Sonar happy. 2020-08-04 16:42:35 -04:00
Aaron Louie 2846bf9451 Fleshes out fake PB response, so workflows that pull from PB actually trigger validation errors 2020-08-04 15:50:29 -04:00
Aaron Louie b4595b345a Raises ApiError for 'display_name' extension property exception 2020-08-04 13:59:50 -04:00
Carlos Lopez 50b207307a Merge branch 'dev' into feature/update_study_status_latest 2020-07-31 14:26:24 -06:00
Carlos Lopez 5d23223e51 New study status update 2020-07-30 21:03:11 -06:00
Aaron Louie 73699e66bd Merge branch 'dev' into feature/admin_impersonations 2020-07-30 17:36:20 -04:00
Dan Funk 9704cbcb26 Modifications to the ldap scripts to bring them back in line with what Kelly is doing with the evaluation process. 2020-07-30 13:35:20 -04:00
Aaron Louie f8944da31f Merge branch 'dev' into feature/admin_impersonations 2020-07-30 13:01:46 -04:00
Aaron Louie faba0f55ab Adds AdminSession model and refactors impersonation methods to use it. 2020-07-30 12:40:53 -04:00
Dan Funk a6ec0c92c7 Merge remote-tracking branch 'origin/dev' into cr-connect-106-augment-eval-methods 2020-07-30 11:38:47 -04:00
Aaron Louie aa0f24bd33 Fully deletes users from g in test tearDown 2020-07-30 10:40:06 -04:00
Dan Funk 31982f81ae Merge branch 'dev' into feature/documents_publishing
# Conflicts:
#	Pipfile.lock
2020-07-30 10:17:08 -04:00
Aaron Louie 1b0ebecbf4 Uses Flask session to store impersonation state. 2020-07-30 10:17:02 -04:00
Aaron Louie d301e9e6fa Adds list_users endpoint. Adds admin impersonate uid parameter to user endpoint. Adds some utility methods to user service. Refactors authentication tests. 2020-07-29 22:47:47 -04:00
Aaron Louie f897ee3aea Merge branch 'feature/approvals_dashboard_prototype' into feature/admin_impersonations 2020-07-29 10:32:46 -04:00
Dan Funk 0ea4c13d09 Convert protocol builder status to always be in lower case in order to better match the front end. And also fixing an issue with the multi_instance that is oddly broken suddenly, and I don't know why. 2020-07-28 17:16:48 -04:00
Dan Funk 4d11fc04a0 dropping the "read_only" flag in favor of a "do_engine_steps" flag, which more clearly defines what is happening. 2020-07-28 13:51:29 -04:00
Dan Funk f15626033d Allow the workflow to be requested without making changes to the workflow - requires that you specify a read_only flag of true, otherwise it assumes that you want a fully prepared workflow with the next ready task set to run. 2020-07-28 13:33:38 -04:00
Kelly McDonald d617af8565 All tests are passing - may need to refactor a bit, / remove comments 2020-07-28 11:02:49 -04:00
Dan Funk 300026cbc8 Expanding the task events endpoint to accept workflow and study ids as additional filters.
Removing events from the study endpoint, too noisy.
2020-07-28 10:16:48 -04:00
Dan Funk 0cb480801b Provide event data on the Study api endpoint.
Speed up the tests a little, because that got out of hand.  Need to dig into what is causing this problem.
2020-07-27 17:05:01 -04: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
Kelly McDonald 70ad3872a7 Fix several bugs, most had an issue with the bpmn document 2020-07-27 12:02:34 -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
Dan Funk 5ec5fcb4e4 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-23 12:00:24 -04:00
Aaron Louie 855f5544e5 Adds enrollment_date to study model 2020-07-22 09:35:08 -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 b85869905b Merge branch 'cr-connect-92-scripting-enhancements' of github.com:sartography/cr-connect-workflow into cr-connect-92-scripting-enhancements 2020-07-20 11:40:10 -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
Kelly McDonald f415f22ccb Add warning message when we fail due to syntax error and then we try to look up the class as a backup 2020-07-20 10:12:15 -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 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 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 fa7608053a fixing a failed test. 2020-07-14 22:23:54 -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
Aaron Louie d71ff80eac Adds end and start events 2020-07-14 13:42:52 -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
Aaron Louie 463660f185 Merge branch 'dev' into feature/dynamic_enum_list 2020-07-13 17:47:56 -04:00
Aaron Louie 07066b8a16 Looks up enum options from task data 2020-07-13 17:46:28 -04:00
Dan Funk 9e29a43785 Correct for a race condition where multiple lookup tables are built for the same field and workflow specification, causing it to appear that the models are not updating correctly. 2020-07-13 12:45:51 -04:00
Aaron Louie b7920989ed WIP: Adds Camunda property for retrieving enum field options from task data. 2020-07-10 14:48:38 -04:00
Aaron Louie 7f0b35ff27 Merge branch 'dev' into feature/enum_lookup_data 2020-07-10 10:27:51 -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 64f9bd2ca7 Tiny leftover 2020-07-07 08:38:33 -06: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
Aaron Louie 517cd8fc91 Merge branch 'dev' into feature/enum_lookup_data 2020-07-06 16:31:19 -04:00
Dan Funk bb4000ff6d Don't attept to load up the workflows for abandoned studies. 2020-07-06 16:01:43 -04: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
Aaron Louie 1d9fef380a Merge branch 'fix/more-info-in-exceptions' into feature/enum_lookup_data 2020-07-03 14:22:11 -04:00
Aaron Louie f344fe60c0 WIP: Adds enum field lookup option data 2020-07-03 12:20:10 -04:00
Carlos Lopez 817333f26e Adding proper exception information 2020-07-02 16:10:33 -06:00
Dan Funk 84973d2351 resolving comments from pull request. 2020-06-30 12:24:48 -04: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
Dan Funk 49e80398be Merge branch 'rrt/dev' into dev 2020-06-29 14:56:01 -04:00
Aaron Louie a996c81508 Gets mi_index out of Spiff task internal data 2020-06-28 11:35:35 -04:00
Carlos Lopez d4bcb9af65 Proper error handling in csv/dumps for approvals 2020-06-27 13:59:04 -06:00
Aaron Louie 848ad563d3 Only filters by mi_index if task has a mult_instance_index 2020-06-26 12:47:42 -04:00
Aaron Louie f9f3003ef0 Filters by multi-instance index, if applicable 2020-06-26 12:31:37 -04:00
Dan Funk 150117587e Merge branch 'dev' into feature/parallel_multiinstance_tasks 2020-06-25 23:20:38 -04:00
Carlos Lopez 665faaa175 Send emails from service 2020-06-25 16:18:42 -06:00
Carlos Lopez 44995e3813 Merge branch 'feature/emails-enhancement' of github.com:sartography/cr-connect-workflow into feature/emails-enhancement 2020-06-25 14:37:04 -06:00
Aaron Louie c3ceda4c2f Replaces xml.etree with lxml.etree 2020-06-25 14:02:16 -04:00
Carlos Lopez 7116b582e8 Splitting commands properly without losing double quoted strings 2020-06-25 12:01:24 -06:00
Dan Funk fe5a7ddce3 Merge remote-tracking branch 'origin/rrt/dev' into feature/emails-enhancement 2020-06-25 13:29:06 -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
Carlos Lopez dd10e56d1a Adding forgotten variables to returned dict 2020-06-22 14:56:24 -06:00
Carlos Lopez dc5ffd29d0 Refactoring shared code 2020-06-22 14:07:57 -06:00
Carlos Lopez e5541e4950 Enable CSV download 2020-06-22 09:24:58 -06:00
Carlos Lopez b8d60ca944 Spreadsheet generation 2020-06-22 07:14:00 -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 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 896ba6b377 Email relies now on markdown content 2020-06-17 17:00:16 -06:00
Dan Funk da048d358e Merge branch 'dev' into feature/refactor_data_loading 2020-06-17 17:14:30 -04: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
Aaron Louie 40ff3b5fcb Uses mock LDAP if LDAP_URL environment variable is 'mock' 2020-06-16 21:43:20 -04:00
Dan Funk 1b9166dcb7 Cleaning up the merge, which resulted in some lost code. 2020-06-16 13:34:21 -04:00
Dan Funk c7d8eaff30 Merge branch 'dev' into feature/refactor_data_loading 2020-06-16 13:15:43 -04:00
Dan Funk 92580ee867 adding an additional error check for invalid json returned from the Protocol builder. 2020-06-15 12:26:53 -04:00
Dan Funk eec4b579a7 Don't error out if we don't have a valid study id when doing validation. 2020-06-15 11:27:28 -04:00
Carlos Lopez 5f13b96079 More enhancements 2020-06-12 12:17:08 -06:00
Aaron Louie 2a84d5196a filter, not filter_by 2020-06-12 14:13:27 -04: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
Carlos Lopez e9e805b2c9 Storing emails in database 2020-06-09 22:57:56 -06:00
Dan Funk 777e429382 Merging production back into dev, because we got out of whack somehow. 2020-06-08 14:19:30 -04:00
Dan Funk 8cf420b781 Default mail user name and password to blank. 2020-06-08 14:15:56 -04:00
Dan Funk e370148380
Merge pull request #112 from sartography/rrt/dev
Rrt/dev
2020-06-08 13:18:41 -04:00
Carlos Lopez 0351b3548a Adding bcc to all emails sent 2020-06-08 11:17:17 -06:00
Carlos Lopez f91fbf76b9 Capturing explicit errors from mails 2020-06-08 09:16:26 -06: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
Aaron Louie f0904e75a6 Sets main approval status after related approvals have been populated 2020-06-05 15:54:53 -04:00
Carlos Lopez 663da57d8b Config can read smtp values from environment now 2020-06-05 13:54:37 -06:00
Carlos Lopez 57a7c7fa54 Approve/deny fixes 2020-06-05 13:39:52 -06:00
Dan Funk 1f32a99efe Some approval statuses coming back as null., fixed 2020-06-05 14:55:49 -04:00
Carlos Lopez 16ca4fa2c0 Merge branch 'rrt/dev' into feature/mail-system 2020-06-05 12:35:05 -06:00
Dan Funk f0db5b70fc Adding some additional logic to the approval endpoint so that we take related approvals into account when setting the status. In addtion to prevous status options, there is a new status of "AWAITING" which means there are pending approvals before this approval that still need to be approved or canceled. 2020-06-05 14:33:00 -04: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 b6abb0cbe2 using a restartable strategy to get around login errors 2020-06-04 18:03:59 -04:00
Dan Funk 9cfe00dfd0 Don't bind all the time. 2020-06-04 15:38:45 -04: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
Carlos Lopez 8c36d9f367 Email calls outline 2020-06-04 11:43:10 -06:00
Dan Funk 50d2acac9c Made a very stupid mistake with LDAP connections, pushing up quickly to production. 2020-06-04 11:57:00 -04:00
Dan Funk 68aeaf1273 BE VERY CAREFUL where you create a new LdapService() - construction is expensive.
Adding a few more details to the "csv" endpoint for RRT.
2020-06-04 10:33:17 -04:00
Dan Funk bbcbfef1ba Fixing the migrations so I don't break the universe. 2020-06-04 10:09: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 c179c7781b Do not process or return cancelled approvals via the API. 2020-06-03 16:50:47 -04:00
Dan Funk e102214809 minor cleanup of error codes. 2020-06-03 15:03:22 -04:00
Dan Funk 299ad4fc8b Adding more details to the csv output, and assuring we don't miss people with outstanding approvals that were cancelled. 2020-06-03 07:58:48 -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 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
Dan Funk b6bf843f6e used 'name' rather than 'value' in the lookup options during validation, causing a disconnect with how this is processed on the front end. 2020-06-01 11:00:56 -04:00
Aaron Louie 7c8b7829ea Merge branch 'rrt/dev' into feature/approvals_enhancements 2020-06-01 00:41:51 -04:00
Carlos Lopez bec11980eb Fixing broken test by using proper FileSchema 2020-05-31 22:00:52 -06:00
Carlos Lopez b2e56f797b Converting ApprovalModel to Approval in order to serialize properly the result 2020-05-31 21:02:47 -06:00
Aaron Louie f0bd8d4f9e Adds approvals to study schema. Adds approvals endpoint 2020-05-31 22:46:32 -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
Carlos Lopez 26809d1470 Waiting status renaming 2020-05-31 13:35:42 -06:00
Dan Funk 2bc735a3f0 Kelly wrote a beautiful method for resetting the workflow that doesn't loose data when reset inside a parallel task, all I needed to do was use it.
Catching TypeErrors and reporting them back to the UI so we don't 500 in a bad way (but we still 500)
2020-05-31 13:48:00 -04: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 4e4cc7884c Better ldap searching. 2020-05-29 15:17:51 -04:00
Dan Funk afb6be7c60 re-working the way the redirects function, so we pass arguments as a get parameter. Just trying to get rid of the weird lag on production.
I noticed the validation sometimes looks ahead for files, so looking at all the tasks now, not just the ready tasks for the lookup field.
Ran into an issue with validation where a workflow model was required, so I create one and delete it.  Another refactor for another day.
2020-05-29 04:42:48 -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 aea78de066 Merge remote-tracking branch 'origin/dev' into feature/file_refactor_part2 2020-05-28 20:06:32 -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
Aaron Louie 97cdbfce94 Deletes extra line break 2020-05-27 23:48:48 -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
Dan Funk d5e075db82 Order search results by relevancy in the lookup service. 2020-05-27 09:47:44 -04:00
Dan Funk 397cb23b52 Is true "true", yes it is true. So true, is "false", so true, it is true. 2020-05-26 23:38:57 -04:00
Dan Funk 0025931a2e Trying hard to figure out why the DCOS servers think the protocol builder is enabled. 2020-05-26 23:18:14 -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 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 13186176ba Improved LDAP searches, allow filtering on last name as well as uva id. 2020-05-25 16:00:36 -04: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 49eb4b3f98 Making working endpoints for approvals 2020-05-23 23:53:48 -06:00