-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: dev
Are you sure you want to change the base?
Conversation
4c162e9
to
2a907db
Compare
// 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'", |
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.
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).
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.
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
bbde0f2
to
da8bab4
Compare
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.
This should be moved in the patient-portal
module.
* @version $Id$ | ||
* @since 0.9.6 | ||
*/ | ||
@Designate(ocd = SubmittedFormsCleanupScheduler.Config.class, factory = true) |
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.
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.
Rebased and addressed most of the comments except query optimisation. |
…der than one year
…der than one year Fixed tag
…der than one year Moved files to the patient-portal module; Removed factory usage from the scheduler
7ee8b09
to
42cf98e
Compare
No description provided.