-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use scores or raw scores for report server processing (M2-7933) #1616
feat: use scores or raw scores for report server processing (M2-7933) #1616
Conversation
…t makes reference to the user selection to report results using the raw scores or t-scores| This is a complementary change for creating reports using t-scores
…ring_type in case scores_and_reports doesn't have this value (old saved entries)
➡️ Preview environment failed to be destroyed |
❌ E2E tests failed |
…table_and_score_report_lookup_scoring by ignoring Subsetting class definition using # type: ignore[index]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes to the implementation will get us over the line. Now that ChildMindInstitute/mindlogger-admin#1935 is complete you can take a look at the data it submits (as well as the various test cases in the PR description) for a more concrete picture
…plication instead of creating a report
…ated Scores scoryin_type values
…frpm ScoresAndReport.scores
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple things I missed yesterday
…ence, ScoresAndReport using new scores list with Score containing subscale_name and scoring_type, updated test to loop over scores insice ScoresAndReports class. Updated validations and included additional error message for no non-subscale items detected
…ing Score domain class for validation and passing subscale infor to report_server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still some tests to fix but these changes should get us the correct functionality
…ts when the report is of scoring_type = score
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-approving pending fixing of the tests
…d argument, fixed mypy for reports custom_validation by checkiing for None SusbcaleStting on Score with score_type score
…lePayload to consider min and max socores with numeric values, 0 being a feasible option
* 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]>
📝 Description
🔗 Jira Ticket M2-7933
Changes include:
🪤 Peer Testing
✏️ Notes
Example: scores_and_report
{"reports": [{"id": "sumScore_score_local_report_server", "name": "Score LOCAL - Report Server", "type": "score", "message": "Score LOCAL - Report Server", "items_print": [], "items_score": ["item-0", "item-1"], "calculation_type": "sum", "conditional_logic": []}], "scoring_type": "lookup_scores", "subscale_name": "Subscae A0 - Report Server", "generate_report": true, "show_score_summary": true}
Example: subscale_setting
{"subscales": [{"name": "Subscae A0 - Report Server", "items": [{"name": "item-0", "type": "item"}, {"name": "item-1", "type": "item"}], "scoring": "sum", "subscale_table_data": [{"age": 15, "sex": "M", "score": "10", "severity": null, "raw_score": "1", "optional_text": "https://gist.githubusercontent.com/benbalter/3914310/raw/f757a33411082da23f0ad4a124b45fcdacc1b43f/Example--text.txt"}, {"age": 15, "sex": "M", "score": "20", "severity": null, "raw_score": "2", "optional_text": "https://gist.githubusercontent.com/benbalter/3914310/raw/f757a33411082da23f0ad4a124b45fcdacc1b43f/Example--text.txt"}, {"age": 15, "sex": "M", "score": "30", "severity": null, "raw_score": "3", "optional_text": "Markdown Text Here"}, {"age": 15, "sex": "F", "score": "40", "severity": null, "raw_score": "4", "optional_text": "Good"}, {"age": 15, "sex": null, "score": "50", "severity": null, "raw_score": "5", "optional_text": ""}]}], "calculate_total_score": null, "total_scores_table_data": null}