-
Notifications
You must be signed in to change notification settings - Fork 174
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
[Instrument] Rename Data_entry_completion_status & move to its own column in flag #6876
[Instrument] Rename Data_entry_completion_status & move to its own column in flag #6876
Conversation
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 PR is missing CHANGELOG updates as well as the application of the patch on the RB dataset
@kongtiaowang @AlexandraLivadas Would you be able to help me figure out what's going on with travis here? |
@kongtiaowang I am a little bit confused about adding back the |
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.
In this case,
$this->_instrument->table = 'flag';
$defaults = $this->_instrument->getInstanceData();
It means that the instranceData from flag table.
you have inserted 'Data_entry_completion_status' into flag table.That is why the 'Data_entry_completion_status' is here.
However, removing the field from the array causes the test suite to fail. Following discussion with Shen, this may be because the unittest does not run the scripts in this PR. The field can therefore be removed from the test file in a future PR after all of the scripts from this PR are run and the deprecation of |
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.
-
you forgot the necessary changes to tools script (scripts that generate instrument tables mostly)
-
you are missing all changes in the conflict resolver tables where
Data_entry_completion_status
might appear as a conflict as well as the removal of that value from the$_doubleDataEntryDiffIgnoreColumns
array of the instrument classes (this array exists in multiple places you should search for it) -
It's a "convoluted" implementation of a change that should have made a bunch of stuff simpler, not more complex. You are removing the
Data_entry_completion_status
from within instrument data and yet choose to still use the instrument save function to save it when the saving functionality is already pretty-wrapped in a_setDataEntryCompletionStatus
method... seems like the intuitive way is to modify that to simply store the value inflag
rather then modify the save function to handle a field that is no longer in it's scope.
I addressed most of your comments in the latest commit. For this one, I put a direct update to flag in the |
a4594bf
to
270bf44
Compare
@ridz1208 After making all of the changes in this PR & running source_rb from the branch, I get the following error: Do you know what's causing this / what I should change? |
@CamilleBeau My guess would be that you have an invalid default value |
@CamilleBeau could you rebase? |
@zaliqarosli it's not quite clear from the above thread and it's showing up as approved.. is this ready to merge or are there still changes to do? |
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.
requesting changes:
@CamilleBeau i think it's good that the value is updated if it has to be. but is there maybe a way to check inconsistencies and print them out to ask for confirmation before continuing? let me know if i can be clearer
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.
i don't think its necessary to print out every commentID being checked in the flag table.
i think an array of mismatched results will suffice. if you find the printout useful, maybe you can add a -verbose option
(loris-mri-python) lorisadmin@zrosli-dev:/var/www/loris$ php tools/single_use/Set_Required_elements_completed_flag.php
*** Set Data_entry_completion_satus in flag table ***
####################################################################################
This script is to be run for one time use only to update and rename the
Data_entry_completion_status field.
Without being run with 'confirm', the script only reports mismatching data. If run
with 'confirm', the new Required_elements_completed flag is updated by using the
_determineRequiredElementsCompletedFlag and _setRequiredElementsCompletedFlag
functions. An array is printed at the end of the script that lists all the cases
where the new Required_elements_completed flag does not match the old
Data_entry_completion_status. If the Required_elements_completed flag is not updated
through this script or through instrument saving, it's default is 'N'.
After running this script with 'confirm', run
Remove_Data_entry_completion_status_instr_column.php to generate a DROP COLUMN patch
to remove the old column from instrument tables.
####################################################################################
Checking mismatching flag for 300001MTL0011211468524336.
Checking mismatching flag for 300001MTL0011221465332127.
Checking mismatching flag for 300001MTL0011231524315839.
Checking mismatching flag for 300001MTL0011241522092423.
Checking mismatching flag for 300001MTL0011261522092728.
Checking mismatching flag for 300001MTL0011347211524056560.
Checking mismatching flag for 300001MTL0011347241524056560.
Checking mismatching flag for 300002MTL0021189211524318806.
Checking mismatching flag for 300002MTL0021189241524318806.
Checking mismatching flag for 300002MTL0021643231524668096.
Checking mismatching flag for 300002MTL0021643241524318806.
Checking mismatching flag for 300002MTL0021643261524668096.
Checking mismatching flag for 300002MTL0022211468524336.
Checking mismatching flag for 300002MTL0022221465351036.
Checking mismatching flag for 300002MTL0022231524315839.
Checking mismatching flag for 300002MTL0022241522092423.
Checking mismatching flag for 300002MTL0022261522092728.
Checking mismatching flag for 300003MTL0033211468524337.
Checking mismatching flag for 300003MTL0033221465351036.
i think this script is going to take a long time to complete if it prints every row
Thanks @zaliqarosli ! Printout of each data point removed, ready for re-review |
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.
something seems off with determining the Data entry completion status:
[DDE_475906DCC4222142121524502652] => Array
(
[Data entry completion status] => Complete
[New Required elements completed flag] => N
)
mysql> select Data_entry_completion_status from bmi where CommentID='DDE_475906DCC4222142121524502652';
+------------------------------+
| Data_entry_completion_status |
+------------------------------+
| Incomplete |
+------------------------------+
1 row in set (2.07 sec)
SQL/Cleanup_patches/2020-12-08-remove_dataEntryCompletionStatus_conflict_resolver.sql
Show resolved
Hide resolved
Thanks for the catch @zaliqarosli .. I tried to replicate this and debug but I wasn't able to. I noticed though that I wasn't resetting the $instrDECS value for each iteration of the for loop. That could have been causing the problem |
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.
[DDE_587630DCC0901053121524238782] => Array
(
[Data entry completion status] =>
[New Required elements completed flag] => N
)
[DDE_676061DCC2922145221524505477] => Array
(
[Data entry completion status] =>
[New Required elements completed flag] => N
)
[DDE_947103DCC7022155121524664375] => Array
(
[Data entry completion status] =>
[New Required elements completed flag] => N
)
i think its your logic between and around lines 80-90. DDE_947103DCC7022155121524664375 in raisin bread has NULL Data column in flag table and is linst instrument which i believe by default uses jsonData but i could be wrong here.
so i think you're missing the case for when the instrument uses json data but the data column is empty. so you would still have to grab the value from the instrument table, or default the value to 'incomplete' if the data column is empty
@zaliqarosli Thank you Zaliqa! I changed it so that a null value is considered as 'Incomplete'. We can not take from the instrument table in the case of json instruments because the table may not exist. |
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.
looks like the logic is fixed! i would just ask before approving this PR that the script documentation clearly states that running the script with 'confirm' argument will over write the DECS with the determined completed flag in the case where there is a mismatch, i.e. making it clear that there will be a loss / modification of data for projects
@zaliqarosli Edited the info printed by the script to specify this |
CHANGELOG.md
Outdated
@@ -45,6 +46,8 @@ requesting a new account and will be displayed in the User Accounts module (PR # | |||
### Notes For Existing Projects | |||
- New function Candidate::getSubjectForMostRecentVisit replaces Utility::getSubprojectIDUsingCandID, adding ability to determine which subproject a candidate belongs to given their most recent visit. | |||
- LINST instrument class was modified to implement the getFullName() and getSubtestList() functions thus making entries in the test_names and instrument_subtests tables respectively unnecessary for LINST instruments (PR #7169) | |||
- The `Data_entry_completion_status` column of instrument tables has been migrated to its own column in flag, and renamed to `Required_elements_completed`. After script `Set_Required_elements_completed_flag.php` is run, projects will need to delete the `Data_entry_completion_status` column of instrument tables. This can be accomplished by running `Remove_Data_entry_completion_status_instr_column.php`, and then sourcing the patch generated by this script. | |||
- Make sure to replace all instances of `_setDataEntryCompletionStatus`, `_determineDataEntryCompletionStatus`, and `updateDataEntryCompletionStatus` functions with their newly named counterparts, `_setRequiredElementsCompletedFlag`, `_determineRequiredElementsCompletedFlag`, `updateRequiredElementsCompletedFlag` |
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.
I don't understand this. Replace them where?
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 is meant to be a note for projects to replace these functions in case they are calling them in any overrides
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.
I re-worded it to be more clear
tools/single_use/Remove_Data_entry_completion_status_instr_column.php
Outdated
Show resolved
Hide resolved
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.
approved once the typo in suggested changes is fixed
…umn.php Co-authored-by: Dave MacFarlane <[email protected]>
@@ -0,0 +1,134 @@ | |||
<?php |
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.
after SQL
Brief summary of changes
This PR moves Data_entry_completion_status field to its own column in flag following discussion and renames to Required_elements_completed. This is accomplished with the help of a patch and a single-use script (the patch must be run before the script).
Testing instructions (if applicable)
SQL/New_patches/2020-07-29_Required_elements_completed_flag_column.sql
andSQL/Cleanup_patches/2020-12-08-remove_dataEntryCompletionStatus_conflict_resolver.sql
php tools/single_use/Set_Required_elements_completed_flag.php
. Check that the script successfully sets the new column to Y for instruments that already have Data_entry_completion_status=Complete and to N for instruments that had Data_entry_completion_status=Incomplete. Make sure that this holds for both JSON and non JSON instruments.php tools/single_use/Remove_Data_entry_completion_status_instr_column.php
Link(s) to related issue(s)