Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* M2-3451: added module for integrations * some refactoring * some logic for loris * some changes in domain models * integration creation * added method that return all answers that can be shared * added method for interation with data decryption for LORIS * fix recording cq * added integrations details for AppletSingleLanguageDetailMobilePublic * comment unused fields * added improved logic for communication with LORIS * improve logic fro communication with report server * added logging. fix imports order. added answers. * turn on logs * small fix for Activitie model * some improvements. new method * some refactoring and logic improvement * remove unused field * added new logic for candidate and answers * fix url add cohort * one more item type processing * added temporary endpoint for schema * added temporary function that send schema to the LORIS server * added call for instrument creation * added call for instrument creation * added more items types for processing * increment value bacause count start from 0 * removed unnecessary file * some refactoring * fixed some typo, typing * improve logis for singleSelect * added migration that actualize develop with loris integration * added new table that describe relationship between ml and loris user * refactoring * added new logic for center and candidate. provide refactoring * merge heads, actualize loris with dev v1.3.14-rc * entites remaping. refactoring. code update. * added loris to config. refactoring. last changes from dev * fix: merge migration heads to one * fit: added migration with merged heads * test: added tests for loris * fix: added missing values * fit: added migration for arbitrary * fix: fix test for loris integration * refactor: rename field in answers shema. tests refactoring * feat:send to loris versions of applets & missing answers(M2-6646) (#1412) * feat:(Loris): Endpoints for enabling and disabling integration for workspaces(M2-7040) (#1420) * M2-7040:api for enabling and disabling integration * fit: added migration with merged heads * fix: added ability to not provide consent_to_share for applet answer * fit: added endpoint that return list of visits that exist in LORIS system * fit: added ability to collent, group and provide infromation about users activities and visits * fit: improvements requested by team * fix: fix test * tests: update tests * M2-6641: loris integration status via alerts (#1468) * fix: added detailed information into domain models * fix: added fields that helps fully describe data retrieved from frontend * tests: fixed existing tests accordingly changes in domain model * actualize from develop * fix: fixed problem when try to create visit that already exist for user * fix: change message for ws * fix: Make answers.consent_to_share optional on answer create EP (M2-7416) (#1507) * fix: rework answer visits EP (M2-7316) (#1506) * actualize from develop * feat: changed dto. collected only selected answers * fix: changed logic for answers collection * fix: added ability to send answer if it was skeped (M2-7437) * feat: set specific secret_id in alerts if applet relates to loris integration * fix: added ability to send data only for chosen user (M2-7573) * feat: created new columns in both applet and applet_history tables to support Loris connection (M2-7346) (#1512) * feat: adding logic to create integrations with other systems * fix: organizing __init__ files and fixing an error invocation * fix: fixing import on tests after removingsome __init__.py files * fix: Improving Access check by using a get_by_roles method * fix: remove api/version from Loris endpoint * fix: fixed problem with duplicated answers for one respondent (M2-77453) * actualize from develop * fix: fixed import order * fix: some refactoring * fix: fixed formating * Create endpoint for checking LORIS integration - retrieve server configuration (M2-7429) (#1548) * feat: implemented retrieval of integrations * fix: ruff issues * fix: fixing integrations access validation * fix: ruff format * fix: specifying https in loris client * fix: creating public and private versions of integrations domain object * fix: fixing ruff * fix: ruff reformat some files * fix: fixing the retrieval of loris projects * fix: added new test for retrieval of configurations * fix: adding integration retrieval test * fix: fix ruff formatting * fix: removing type in check access * fix: removing unneded errors * fix: remove import * fix: fixing test * fix: fixes wrong reference to AvailableIntegrations type when retrieving a Future integration * fix: running make cq to fix files with formatting issues * fix: removing enable and disable integration endpoints * fix: removing uneeded change on ReviewFlow * fix: removing files that have nothing to do with the PR contents and must have been fixed already in develop * fix: updating name of integrations service retriever given that it rerieves using applet_id and integration type * fix: renaming integration service method retrieve_integration back * Create endpoint for removing LORIS integration - Remove server connection (M2-7428) (#1583) * feature: implemented integration deletion * fix: fixing issues with deletion of integrations and added a test * fix: syncing with retrieval test * fix: fixing tests * fix: fixing test where once an integration is deleted it is marked as deelted but not realy deleted. Not sure if that is what we want * fix: fixing delete test after updating the integration retrieval service * fix: standardizing usage of integration_type instead of type * fix: updating deletion to not retrieve deleted element * fix: updating integrations service to use integrations' CRUD delete_by_id * fix: fixing deletion test and supporting deleting unexisting integrations * fix: removing unused commented line * fix: removed unused import * Update LORIS integration to use stored config (M2-7455) (#1613) * feature: removed the loris dependency on environment variables and replaced it with some logic that retrieves the loris connection configuration from the database tied to the applet id tied to the service instance * fix: removing unused enable and disable integration logic * fix: loris_client classmethod were missing the reference to the class using self * fix: removing unsupported logic to get visits from LORIS with no applet configured * fix: to remove the integrations table locking I removed the async gather call * fix: updating the loris integrations visits endpoint to receive an applet_id as path param * fix: fixing visits list when incorrect LORIS connection is specified * fix: fixing integrations loris {{applet_id}} users visits endpoint to control the case when the authentication against LORIS is wrong * fix: fixing ruff error reports * fix: ruff formatting * fix: fixing some mypy errors * fix: fixing existing test * fix: missing ruff fix after format * fix: loris_integration_configuration can be None * Update loris branch with develop 65ea055 (#1621) * feat: Add/Update endpoint to retrieve activities assigned to a participant (M2-6223) (#1565) This PR adds a new endpoint `/activities/applet/{applet_id}/subject/{subject_id}`, which allows the caller to fetch an object containing the list of activities and activity flows that have been assigned to the subject specified by `subject_id` in some way. Each activity or flow will have a non-nullable array property called `assignments` containing the list of assignments of that activity/flow where the given subject is the **respondent**. It is yet undecided at a product level whether auto assigned activities/flows can be manually assigned, but the API currently allows this. Thus, it is possible for the data returned from this endpoint to contain an activity/flow with both `autoAssign` set to `true`, and a non-empty `assignments` property. The caller of the endpoint must be authenticated as a user with one of the following user roles: - Owner - Manager - Coordinator - Reviewer (with access to the subject) * feat: unassign activity or flow endpoint (M2-7358) (#1556) This pull request introduces the unassign endpoint for activity assignments. The unassign functionality allows authorized users to mark assignments as deleted. It ensures that previously assigned activities or flows can be unassigned, effectively updating the database to reflect the unassignment. * feature: Completed unassign endpoint using the same json structure of the assign assignments endpoint request. Implemented get_assignments_by_activity_or_flow_id_and_subject_id to retrieve assignment_id using activity_id and subject_id. Crated unassign_many to update multiple schemas at a time using the _update CRUD base function * Calling assignment endpoint and then unassign to test functionality * Created tests for unassign feature * Recover applet_assignments function and completed unassign_many function * Typing consistency for delete requests and Optional types on unassign feature * Update src/apps/activity_assignments/router.py Co-authored-by: Farmer Paul <[email protected]> --------- Co-authored-by: Farmer Paul <[email protected]> * fix: add `items` to assigned activities endpoint (#1591) * fix: Return assignments matching either respondent or target subject ID (M2-6223) (#1592) * fix: match by both respondent & target subject Assignments being returned by this endpoint were only matching by respondent subject, but the AC for M2-6223 states to return assignments matching both by respondent & target subject. So adjusted the function to match by one of those, or both, based on the `match_by` parameter. Fixed tests to test this condition as well. * fix: remove redundant CRUD function The `check_for_assignment_and_notify` function was using a CRUD function `get_by_respondent_subject_id` to return assignments matching a given respondent subject, which did not perform soft-delete integrity checks. The same functionality exists in `get_by_applet_and_subject` but with soft-delete integrity checks, so removed the old function in favour of this one. * refactor: use `Filters` class, simplify code On @rcmerlo's recommendation, switched to using `QueryParams` and `Filters` class for filtering assignments queries by respondent or target subject. In doing so, discovered that `get_by_applet_and_subject` was not in fact needed; all the functionality is now provided by `get_by_applet`. * Deploy to dev * Deploy to dev 2 * Fix * Update ECS task runner * Run migrations on startup (#1593) * Created new startup script * testing env * feature env version * feature start manifest * M2-7550 Disabling OASDiff * Dev build/deploy * Fix dev build * Disabling OASDIFF * Add support to Unity activity type (M2-7441) (#1563) * feat: adding unity type * change to fix odd validation behavior on item responses * refactor unityFile to unity * ruff formatting * ruff linting import order change * Adding unity tests * ruff format * test name fix * re-adding wrongly removed test * moving unity file file to config --------- Co-authored-by: Ramir Mesquita <[email protected]> * Fix: tests for Unity activity item (#1597) * feat: Add `severity` field to subscale lookup table (M2-7586) (#1596) This PR adds a field called `severity` to the subscale lookup table JSONB data. This allows subscale lookup tables to be saved with severity data * feature: Handle reassign an assignment in creation endpoint (M2-7461) (#1594) * chore: Update some dependencies to fix some security issues * feature: Handle reassign an assignment in creation endpoint (M2-7461) * Refatoring assignments service and crud to use upsert * chore: Move assignments tests to one file to remove duplicated fixtures * add passed tests to the slack output steps * feature: Soft delete activity assignments on activity/flow deletion (#1598) * fix: Modified answers applet_validate_multiinformant_assessment api (M2-6978) (#1581) Modified answers applet_validate_multiinformant_assessment api to return BAD REQUEST instead of 200 OK response using pydantic validation and modified the answers tests script to validate new responses. * Update: README and .env template in relation to onboarding (#1606) * Update CORS ALLOW ORIGIN env variables to match any localhost pattern. Update MAILING__MAIL__SERVER to 'mailhog'. * Update README with steps related to running API locally. * Additional notes * spelling * feat: Update Subscale Lookup Table to support age ranges (M2-7586) (#1604) This PR updates the validation for the subscale lookup table to support ranges in the `age` field using the tilde character (~), similar to the `score` and `rawScore` fields. * feat: Get Subjects by Respondent Subject: Submissions + Assignments (M2-7919) (#1611) This PR creates the new endpoint `/subjects/respondent/{respondent_subject_id}/activity-or-flow/{activity_or_flow_id}`, which returns a list of subjects based on an association with the respondent subject and activity/flow specified. The endpoint is accessible by users with the following applet roles: - Owner - Manager - Coordinator - Reviewer (who is assigned the `respondent_subject_id` subject) Each subject in the list returned will be the target subject of at least one: - Assignment where `respondent_subject_id` is the respondent subject (including auto-assigned activities/flows) - Submission where `respondent_subject_id` is the source subject In addition to the usual `SubjectReadResponse` properties, there are two extra ones that I'd like to highlight: - `submissionCount`: This is the number of answers that the respondent has submitted for a given subject and activity/flow - `currentlyAssigned`: Whether the activity/flow is currently assigned for the respondent to complete about a given subject Activities/flows that have been unassigned and don't have any submissions aren't included * feat: Add endpoint to get activities/flows assigned to or submitted for target (M2-7853) (#1614) This PR creates the new endpoint `GET /activities/applet/{applet_id}/target/{subject_id}`, which returns a list of activities and flows that are associated with the specified target subject within the applet. The endpoint is accessible by users with the following applet roles: - Owner - Manager - Coordinator - Reviewer (who is assigned the target subject) Each activity/flow in the list will be returned based on one of the following conditions - The activity/flow is set to auto assign - The activity/flow is manually assigned to some respondent, with the specified target subject as its target - Answers have been submitted at some point in the past for the activity/flow with the specified target subject as the target The return type is `ActivityOrFlowWithAssignmentsPublic` --------- Co-authored-by: Rodrigo Merlo <[email protected]> * chore: Fix syntax error in e2e-tests.yaml * feat: implement endpoints for respondent activities * fix: some typo * fix: check for limited account respondents * chore: fix typing and formatting * chore: change cq target to only check and not format --------- Co-authored-by: Kenroy Gobourne <[email protected]> Co-authored-by: AlejandroCoronadoN <[email protected]> Co-authored-by: Farmer Paul <[email protected]> Co-authored-by: Carlos Chacon <[email protected]> Co-authored-by: Andrew Weiland <[email protected]> Co-authored-by: Ramir Mesquita <[email protected]> Co-authored-by: Ramir Mesquita <[email protected]> Co-authored-by: Rodrigo Colao Merlo <[email protected]> Co-authored-by: Phillipe Bojorquez <[email protected]> Co-authored-by: Shaunna Samuels <[email protected]> Co-authored-by: Phillipe Bojorquez <[email protected]> Co-authored-by: Billie He <[email protected]> Co-authored-by: Billie He <[email protected]> * Loris integration phase 2 pull develop da6e8cb (#1630) * feat: Add/Update endpoint to retrieve activities assigned to a participant (M2-6223) (#1565) This PR adds a new endpoint `/activities/applet/{applet_id}/subject/{subject_id}`, which allows the caller to fetch an object containing the list of activities and activity flows that have been assigned to the subject specified by `subject_id` in some way. Each activity or flow will have a non-nullable array property called `assignments` containing the list of assignments of that activity/flow where the given subject is the **respondent**. It is yet undecided at a product level whether auto assigned activities/flows can be manually assigned, but the API currently allows this. Thus, it is possible for the data returned from this endpoint to contain an activity/flow with both `autoAssign` set to `true`, and a non-empty `assignments` property. The caller of the endpoint must be authenticated as a user with one of the following user roles: - Owner - Manager - Coordinator - Reviewer (with access to the subject) * feat: unassign activity or flow endpoint (M2-7358) (#1556) This pull request introduces the unassign endpoint for activity assignments. The unassign functionality allows authorized users to mark assignments as deleted. It ensures that previously assigned activities or flows can be unassigned, effectively updating the database to reflect the unassignment. * feature: Completed unassign endpoint using the same json structure of the assign assignments endpoint request. Implemented get_assignments_by_activity_or_flow_id_and_subject_id to retrieve assignment_id using activity_id and subject_id. Crated unassign_many to update multiple schemas at a time using the _update CRUD base function * Calling assignment endpoint and then unassign to test functionality * Created tests for unassign feature * Recover applet_assignments function and completed unassign_many function * Typing consistency for delete requests and Optional types on unassign feature * Update src/apps/activity_assignments/router.py Co-authored-by: Farmer Paul <[email protected]> --------- Co-authored-by: Farmer Paul <[email protected]> * fix: add `items` to assigned activities endpoint (#1591) * fix: Return assignments matching either respondent or target subject ID (M2-6223) (#1592) * fix: match by both respondent & target subject Assignments being returned by this endpoint were only matching by respondent subject, but the AC for M2-6223 states to return assignments matching both by respondent & target subject. So adjusted the function to match by one of those, or both, based on the `match_by` parameter. Fixed tests to test this condition as well. * fix: remove redundant CRUD function The `check_for_assignment_and_notify` function was using a CRUD function `get_by_respondent_subject_id` to return assignments matching a given respondent subject, which did not perform soft-delete integrity checks. The same functionality exists in `get_by_applet_and_subject` but with soft-delete integrity checks, so removed the old function in favour of this one. * refactor: use `Filters` class, simplify code On @rcmerlo's recommendation, switched to using `QueryParams` and `Filters` class for filtering assignments queries by respondent or target subject. In doing so, discovered that `get_by_applet_and_subject` was not in fact needed; all the functionality is now provided by `get_by_applet`. * Deploy to dev * Deploy to dev 2 * Fix * Update ECS task runner * Run migrations on startup (#1593) * Created new startup script * testing env * feature env version * feature start manifest * M2-7550 Disabling OASDiff * Dev build/deploy * Fix dev build * Disabling OASDIFF * Add support to Unity activity type (M2-7441) (#1563) * feat: adding unity type * change to fix odd validation behavior on item responses * refactor unityFile to unity * ruff formatting * ruff linting import order change * Adding unity tests * ruff format * test name fix * re-adding wrongly removed test * moving unity file file to config --------- Co-authored-by: Ramir Mesquita <[email protected]> * Fix: tests for Unity activity item (#1597) * feat: Add `severity` field to subscale lookup table (M2-7586) (#1596) This PR adds a field called `severity` to the subscale lookup table JSONB data. This allows subscale lookup tables to be saved with severity data * feature: Handle reassign an assignment in creation endpoint (M2-7461) (#1594) * chore: Update some dependencies to fix some security issues * feature: Handle reassign an assignment in creation endpoint (M2-7461) * Refatoring assignments service and crud to use upsert * chore: Move assignments tests to one file to remove duplicated fixtures * add passed tests to the slack output steps * feature: Soft delete activity assignments on activity/flow deletion (#1598) * fix: Modified answers applet_validate_multiinformant_assessment api (M2-6978) (#1581) Modified answers applet_validate_multiinformant_assessment api to return BAD REQUEST instead of 200 OK response using pydantic validation and modified the answers tests script to validate new responses. * Update: README and .env template in relation to onboarding (#1606) * Update CORS ALLOW ORIGIN env variables to match any localhost pattern. Update MAILING__MAIL__SERVER to 'mailhog'. * Update README with steps related to running API locally. * Additional notes * spelling * feat: Update Subscale Lookup Table to support age ranges (M2-7586) (#1604) This PR updates the validation for the subscale lookup table to support ranges in the `age` field using the tilde character (~), similar to the `score` and `rawScore` fields. * feat: Get Subjects by Respondent Subject: Submissions + Assignments (M2-7919) (#1611) This PR creates the new endpoint `/subjects/respondent/{respondent_subject_id}/activity-or-flow/{activity_or_flow_id}`, which returns a list of subjects based on an association with the respondent subject and activity/flow specified. The endpoint is accessible by users with the following applet roles: - Owner - Manager - Coordinator - Reviewer (who is assigned the `respondent_subject_id` subject) Each subject in the list returned will be the target subject of at least one: - Assignment where `respondent_subject_id` is the respondent subject (including auto-assigned activities/flows) - Submission where `respondent_subject_id` is the source subject In addition to the usual `SubjectReadResponse` properties, there are two extra ones that I'd like to highlight: - `submissionCount`: This is the number of answers that the respondent has submitted for a given subject and activity/flow - `currentlyAssigned`: Whether the activity/flow is currently assigned for the respondent to complete about a given subject Activities/flows that have been unassigned and don't have any submissions aren't included * feat: Add endpoint to get activities/flows assigned to or submitted for target (M2-7853) (#1614) This PR creates the new endpoint `GET /activities/applet/{applet_id}/target/{subject_id}`, which returns a list of activities and flows that are associated with the specified target subject within the applet. The endpoint is accessible by users with the following applet roles: - Owner - Manager - Coordinator - Reviewer (who is assigned the target subject) Each activity/flow in the list will be returned based on one of the following conditions - The activity/flow is set to auto assign - The activity/flow is manually assigned to some respondent, with the specified target subject as its target - Answers have been submitted at some point in the past for the activity/flow with the specified target subject as the target The return type is `ActivityOrFlowWithAssignmentsPublic` --------- Co-authored-by: Rodrigo Merlo <[email protected]> * chore: Fix syntax error in e2e-tests.yaml * feat: implement endpoints for respondent activities * fix: some typo * fix: check for limited account respondents * chore: fix typing and formatting * chore: change cq target to only check and not format * feature: extend the list of supported item types * feature(conditionalLogic): Accept new activity items * wip(conditionalLogic): DateItem support * wip(conditionalLogic): time and timerange added * wip(conditionalLogic) Fix validation errors for time an date * wip(sliderRow): Add slider row validation * wip(conditionalLogic) Remove type from tume renge * wip(conditionalLogic): allow all activity items types * wip(conditionalLogic): Split score and reports and conditionalLogic * wip(conditionalLogic): Add special public model * wip(conditionalLogic): Change index type * wip(conditionalLogic): Change option based items validation * feature/new_items_types * chore/fixing code quality * chore/fixing singleTimePayload, minMaxTimePayload, activity_item_change on code quality and fixing date test on test_custom_validation * chore/cleaning test_custom_validation comment * chore/ruff format condition.py and test_custom_validation --------- Co-authored-by: ivan koryshkin <[email protected]> Co-authored-by: iwankrshkin <[email protected]> Co-authored-by: Felipe Imperio <[email protected]> * feat(applet-duplication): add optional report server config flag (M2-7830) (#1623) This PR updates the applet duplication endpoint to optionally include an optional `include_report_server` property that defaults to false (making it backwards compatible). The following properties are duplicated: - `reportServerIp` - `reportPublicKey` - `reportIncludeUserId` - `reportIncludeCaseId` - `reportEmailBody` * chore: Change report server contract (M2-7481,M2-7483) (#1584) * fix: Downgrade boto3 to version 1.26.10 (M2-8020) (#1627) * feat: add Greek email templates (M2-7665) (#1624) * chore: add language assertion to invitation tests * fix: tom's fixture function return type * chore: rename mailing service html template getter * fix: shell account re-invite unit test * chore: parameterize invitation unit tests * chore: fix html email template formatting * feat: implement fallback to English for localized email templates * feat: add placeholder templates for greek emails * fix: lints * fix: some typing errors in invitation unit tests * chore: replace placeholder with actual greek translations * chore: rename parameter names for email template function * chore: add tests for assignment email language --------- Co-authored-by: Billie He <[email protected]> * chore: Update python version to 3.11 (#1622) * chore: Update python version to 3.11 * chore: Getting away from passlib and using bcrypt directly * chore: Moving from python-jose lib to pyJWT * fix: Rebase and fix pipfile.lock * M2-7905 DR Add tag push stage to Github actions builds for DR ECR (#1625) * Adding DR ECR * extra output * fixed region * fix: fixing two alembic heads with `alembic merge heads` * feat: use scores or raw scores for report server processing (M2-7933) (#1616) * Changes Score class allowing two new arguments: scoring_type and sucale_name and verifies that data is saved into the DataBase, then retriving it when create_report is executed. * Fixed issues with SinglePayload class and adjusted tests accordingly. * fix: fixing ScoringType --------- Co-authored-by: Kenroy Gobourne <[email protected]> Co-authored-by: AlejandroCoronadoN <[email protected]> Co-authored-by: Farmer Paul <[email protected]> Co-authored-by: Carlos Chacon <[email protected]> Co-authored-by: Andrew Weiland <[email protected]> Co-authored-by: Ramir Mesquita <[email protected]> Co-authored-by: Ramir Mesquita <[email protected]> Co-authored-by: Rodrigo Colao Merlo <[email protected]> Co-authored-by: Phillipe Bojorquez <[email protected]> Co-authored-by: Shaunna Samuels <[email protected]> Co-authored-by: Phillipe Bojorquez <[email protected]> Co-authored-by: Billie He <[email protected]> Co-authored-by: Billie He <[email protected]> Co-authored-by: felipeMetaLab <[email protected]> Co-authored-by: ivan koryshkin <[email protected]> Co-authored-by: iwankrshkin <[email protected]> Co-authored-by: Felipe Imperio <[email protected]> Co-authored-by: vshvechko <[email protected]> * fix: remove slash from integrations router * fix: update failing integrations tests * remove workspace.integrations column * remove enable/disable workspace integrations endpoint * chore: codequality * chore: run code quality * Update src/apps/integrations/loris/service/loris.py Co-authored-by: Rodrigo Colao Merlo <[email protected]> --------- Co-authored-by: Damirkhon A <[email protected]> Co-authored-by: vshvechko <[email protected]> Co-authored-by: David Alberto Montaño Fetecua <[email protected]> Co-authored-by: Kenroy Gobourne <[email protected]> Co-authored-by: AlejandroCoronadoN <[email protected]> Co-authored-by: Farmer Paul <[email protected]> Co-authored-by: Carlos Chacon <[email protected]> Co-authored-by: Andrew Weiland <[email protected]> Co-authored-by: Ramir Mesquita <[email protected]> Co-authored-by: Ramir Mesquita <[email protected]> Co-authored-by: Rodrigo Colao Merlo <[email protected]> Co-authored-by: Phillipe Bojorquez <[email protected]> Co-authored-by: Shaunna Samuels <[email protected]> Co-authored-by: Phillipe Bojorquez <[email protected]> Co-authored-by: Billie He <[email protected]> Co-authored-by: Billie He <[email protected]> Co-authored-by: felipeMetaLab <[email protected]> Co-authored-by: ivan koryshkin <[email protected]> Co-authored-by: iwankrshkin <[email protected]> Co-authored-by: Felipe Imperio <[email protected]>
- Loading branch information