ctsit / auto_populate_fields

This REDCap Module provides rich control of default values for data entry fields via a set of action tags. These action tags allow fields to be populated based on values from an ordered list of fields and static values. The fields can be read from the current event or the previous event in longitudinal projects.
Other
13 stars 12 forks source link

New ver. 2.4.0 throws an error #26

Closed JN71 closed 5 years ago

JN71 commented 5 years ago

We updated the auto-populate ti ver. 2.4.0 on the test server (REDCap 9.0.3), but get an PHP error (see pic). Ver. 2.3.0 runs fine. PHP error Auto_populate_fields v  2 4 0 .

jasonlones commented 5 years ago

This happened at our site also. After some digging, I found that when using @DEFAULT to a validated M-D-Y date field when the @DEFAULT value was Y-M-D (e.g. @DEFAULT='2019-06-29') the crash would occur. Other combinations don’t seem to have an issue, but rather the defaulted date is put in the box regardless of the validation and eventually fails (if there is a mismatch) during save.

@pbchase

JN71 commented 5 years ago

It also fails, when a Y-M-D date (e.g. '2019-06-29') is Default_0 in a D-M-Y-validated field and when a Y-M-D date is Default_0 in a Y-M-DY-validated field.

pbchase commented 5 years ago

@ChemiKyle, could you take a look at this? Perhaps PR #21 was not as shiny as we thought.

ChemiKyle commented 5 years ago

I only tested autopopulating using identical datetypes to correct a validation error. I had imagined that nobody would be mixing date formats in a single project, clearly a false assumption!
I am able to recreate this error when attempting to use a YMD validated field to populate a DMY validated field.

pbchase commented 5 years ago

@jasonlones, @JN71, Do you have a use case that requires mixing date formats in one project. i.e. do you need two or more of YMD, DMY, and MDY? We would ordinarily advise our project builders to not do this. It risks confusion for people doing and reviewing the data entry. Also, realize that no matter the date format used, REDCap stores the value as the unambiguous, YYYY-MM-DD.

Our preference is to not support the mixing of different date formats, i.e. YMD vs DMY vs MDY. We can implement a change to prevent the crash and it happens to fix your specific complaint but to do more than that is a good bit more work.

jasonlones commented 5 years ago

Philip,

I concur that there is not a good use case and, like you, we would normally recommending users avoid mixing formats. However, the bigger issue in this case was that when the user (an admin) tested the project and inadvertently/unintentionally mixed the formats, the entire module crashed and became ‘unenabled’. This shut off the module system-wide. While there would be no use case to mix formats, there certainly is the off occasion where accidents occur and in those cases, it is quick a problem to have the entire module fail.

Thanks!

Jason Lones IT Analyst, Sr. Duke Office of Clinical Research (DOCR) School of Medicine Phone: (919) 668-1787

Need REDCap help? Check out remote office hours every Thursday at 2p ET: via WebExhttps://dukemed.webex.com/dukemed/j.php?MTID=m80cefa3357146919ec3fbb4e15cd9ac8.

From: Philip Chase notifications@github.com Sent: Tuesday, November 19, 2019 11:30 AM To: ctsit/auto_populate_fields auto_populate_fields@noreply.github.com Cc: Jason Lones jason.lones@duke.edu; Mention mention@noreply.github.com Subject: Re: [ctsit/auto_populate_fields] New ver. 2.4.0 throws an error (#26)

@jasonloneshttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_jasonlones&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=Td3FAvYr6Wb9IvSlxOmnwiWeLLoCrWzy7U2NMvdoUHA&s=PPPUW8ZP4KO7BdCxee2jflhomS6xwyTKKqnuDrACZ6I&e=, @JN71https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JN71&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=Td3FAvYr6Wb9IvSlxOmnwiWeLLoCrWzy7U2NMvdoUHA&s=IqeOtBxbk2DWoDJ0utWufhG8vNH6uVwFRt4hKNcvujc&e=, Do you have a use case that requires mixing date formats in one project. i.e. do you need two or more of YMD, DMY, and MDY? We would ordinarily advise our project builders to not do this. It risks confusion for people doing and reviewing the data entry. Also, realize that no matter the date format used, REDCap stores the value as the unambiguous, YYYY-MM-DD.

Our preference is to not support the mixing of different date formats, i.e. YMD vs DMY vs MDY. We can implement a change to prevent the crash and it happens to fix your specific complaint but to do more than that is a good bit more work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ctsit_auto-5Fpopulate-5Ffields_issues_26-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAFPLNJUHGMS4TYTWIDXDKVDQUQIBTA5CNFSM4JKVCLJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEO2IYY-23issuecomment-2D555590755&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=Td3FAvYr6Wb9IvSlxOmnwiWeLLoCrWzy7U2NMvdoUHA&s=SF9zVkD5qVnVwuG_PqnG5Er8mv-gCL9E4QlN3jiOKQ8&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AFPLNJS63FP56S52N5XVU5LQUQIBTANCNFSM4JKVCLJA&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=Td3FAvYr6Wb9IvSlxOmnwiWeLLoCrWzy7U2NMvdoUHA&s=UD633e2SPTX6AiyaBOhd3hhdK2R0R90OfbsLoPF6Gz4&e=.

pbchase commented 5 years ago

@jasonlones, I think we're on the same page. We'll fix the crash.

jasonlones commented 5 years ago

Thanks, Philip! Your team is great! Thanks for all you do!

Jason Lones IT Analyst, Sr. Duke Office of Clinical Research (DOCR) School of Medicine Phone: (919) 668-1787

Need REDCap help? Check out remote office hours every Thursday at 2p ET: via WebExhttps://dukemed.webex.com/dukemed/j.php?MTID=m80cefa3357146919ec3fbb4e15cd9ac8.

From: Philip Chase notifications@github.com Sent: Tuesday, November 19, 2019 1:31 PM To: ctsit/auto_populate_fields auto_populate_fields@noreply.github.com Cc: Jason Lones jason.lones@duke.edu; Mention mention@noreply.github.com Subject: Re: [ctsit/auto_populate_fields] New ver. 2.4.0 throws an error (#26)

@jasonloneshttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_jasonlones&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=pkWS7rR8Ijqr9tEQ8C6OFHlgJI3_uOBX6fUP640PEHU&s=IC9h7Xh-P9Xjy2qMXt0XQYps7Xbe7Rsnfvce2SMFs3U&e=, I think we're on the same page. We'll fix the crash.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ctsit_auto-5Fpopulate-5Ffields_issues_26-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAFPLNJRXRXOS5NJBBFW75V3QUQWHXA5CNFSM4JKVCLJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEPHRRA-23issuecomment-2D555645124&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=pkWS7rR8Ijqr9tEQ8C6OFHlgJI3_uOBX6fUP640PEHU&s=ZpVsQ_H1W4tx4u8FoRN5y__V-V9Wu8Dtq_NeV115K8k&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AFPLNJTNVI2UMWXUTIFVOX3QUQWHXANCNFSM4JKVCLJA&d=DwMCaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=nYfz2SrQ15712TVmSKGObqzckauoY11EyFeqM2m5_t0&m=pkWS7rR8Ijqr9tEQ8C6OFHlgJI3_uOBX6fUP640PEHU&s=6lY9fQqg3dF4TPUB0lrT5HexVQjlXDNPSP7x6T3wyJc&e=.

JN71 commented 5 years ago

Hi @jasonlones & others - We are not mixing date formats in our projects - only using D-M-Y (or D-M-Y H:M for precision). I checked 4 different projects from A-Z. What I meant was that the database is Y-M-D natively and has to be formatted, when you use D-M-Y in your project.

But something strange happened this morning. Our REDCap page was blank white, because a nightly batch job had overridden our PHP 7 with a version 5. And all our doctors were complaining on the phone for an hour. But after our server admin reinstalled PHP 7, the site not only worked again, but this consistent PHP-error with auto-populate seems to be gone. Before it was everywhere, now I can´t replicate it.

I will test again and follow it through. Will let you know if it happens again

Best regards Jeppe Neimann

pbchase commented 5 years ago

addressed by PR #27