Skip to content
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

CARDS-2021: PREMs: Automatically delete submitted survey responses older than one year #1325

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

veronikaslc
Copy link
Contributor

No description provided.

@marta- marta- added the needs test instructions Not enough information has been provided to perform proper testing label Feb 9, 2023
Comment on lines 87 to 102
// select the data forms
"select distinct dataForm.*"
+ " from [cards:Form] as dataForm"
// belonging to a visit
+ " inner join [cards:Form] as visitInformation on visitInformation.subject = dataForm.subject"
+ " inner join [cards:Answer] as submitted on isdescendantnode(submitted, visitInformation)"
+ " where"
// link to the correct Visit Information questionnaire
+ " visitInformation.questionnaire = '%1$s'"
// the data form was last modified by the patient before the allowed timeframe
+ " and dataForm.[jcr:lastModified] < '%2$s'"
// the visit is submitted
+ " and submitted.question = '%3$s'"
+ " and submitted.value = 1"
// exclude the Visit Information form itself
+ " and dataForm.questionnaire <> '%1$s'",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query can probably be made more efficient by using looking for the SUBMITTED status flag and replacing the use of isdescendantnode with the form property (if still necessary).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I got the optimisation of isdescendantnode part. Also did you mean the status flag on the form? May be the proposed change would be helpful

Copy link
Member

@sdumitriu sdumitriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved in the patient-portal module.

* @version $Id$
* @since 0.9.6
*/
@Designate(ocd = SubmittedFormsCleanupScheduler.Config.class, factory = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need more than one instance running, so it shouldn't be using a factory.

Or, alternatively, add another setting in the Config below for the questionnaires to delete, so we could only have different deletion policies for different data.

@veronikaslc
Copy link
Contributor Author

Rebased and addressed most of the comments except query optimisation.
Not tested yet, needs instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs test instructions Not enough information has been provided to perform proper testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants