Autolock instrument at completion

362 views
Skip to first unread message

ignacio...@gmail.com

unread,
Feb 4, 2022, 3:07:38 AM2/4/22
to redcap open
Hello,

Is there any way to automatically lock a single instrument (not survey not repeatable) once it is saved as completed?

I have an instrument that contains only calculations.
Some of them are cyclically calculating and give a "run out of memory" error after 1 minute inside the instrument. Time enough to save it all of course. 

However, some of them are piped into fields on another instrument and it gives an error as calculations continue running in the background even if saved. 
The only way I found to solve this is to lock the instrument so calculations stop running and pipe a definitive correct value.

As I want to be all calculated just once at record creation, and there is no manually data entry in the instrument, it's not a problem to automatically lock it once saved for the first time.

Hope anybody can help me
Many thanks in advance

Nacho

Roberto Ferreira

unread,
Feb 4, 2022, 6:57:13 AM2/4/22
to ignacio...@gmail.com, redcap open
Hi Nacho,

I hope to find you well,

Can you display a lock function as shown in the image below?

lock.jpg

If not, you will need to ask admins to enable this function for you

Graciously

Roberto 

Mailtrack Sender notified by
Mailtrack
04/02/22 08:56:19

--
You received this message because you are subscribed to the Google Groups "redcap open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redcap_open/8244db2b-ae9c-4ab9-a95a-c77ece877928n%40googlegroups.com.

Ignacio Alvarez Fernandez

unread,
Feb 4, 2022, 7:01:30 AM2/4/22
to Roberto Ferreira, redcap open
Hello Roberto,
Yes sure, I'm developing the project. I can manually lock but it would be great to do it automatically
Thanks!
Best

Rick Watts

unread,
Feb 4, 2022, 10:54:07 AM2/4/22
to Ignacio Alvarez Fernandez, Roberto Ferreira, redcap open
Standard REDCap cannot automatically lock forms. There is however an external module that adds locking functions to the API. If you have a programmer on hand it would be a relatively simple task to program a Data Entry Trigger (DET) to automatically lock a form after it was saved. On the other hand, if you have a programmer it might be better to develop your own external module, but this would be more effort.

Rick Watts

Team Lead, Research Informatics

rick....@ualberta.ca

T: (780) 248-1170 (Voicemail only)

Women and Children’s Health Research Institute

University of Alberta

5-083 Edmonton Clinic Health Academy (ECHA)

11405 87 Avenue NW Edmonton, AB T6G 1C9

F:  (780) 248-5616



    


WCHRI is a partnership between the University of Alberta and Alberta Health Services, funded by the generosity of the Stollery Children's Hospital Foundation and the Alberta Women's Health Foundation.


The University of Alberta respectfully acknowledges that we are situated on Treaty 6 territory, traditional lands of First Nations and Métis people.



Ignacio Alvarez Fernandez

unread,
Feb 4, 2022, 12:22:50 PM2/4/22
to Rick Watts, Roberto Ferreira, redcap open
Thank you for the information Rick
I took a look at Luke's module (I assume is the one you are talking about) but unfortunately I don't have any programmers available.
I will try to learn myself how to program the DET, let's hope I don't burn the server down!
Thanks again!

_____________

Ignacio Álvarez Fernández

Neuropsicólogo / Metodólogo-Estadístico Investigación
Neuropsychologist / Research Methodology-Statistics

Teléfono/Phone: +34 626273933

Rick Watts

unread,
Feb 4, 2022, 12:43:40 PM2/4/22
to Ignacio Alvarez Fernandez, Roberto Ferreira, redcap open
The thing about the DET handler is that it uses the API and doesn't have to reside on the actual REDCap server, which isolates it to some extent from REDCap itself burning down the server is not that likely. You do have to host the code somewhere though. While I wouldn't really call myself a programmer I do have a bit of experience (many decades old) and I did not find it too daunting, but if you're starting from scratch it's a bit of a learning curve. 

Rick Watts

Team Lead, Research Informatics

rick....@ualberta.ca

T: (780) 248-1170 (Voicemail only)

Women and Children’s Health Research Institute

University of Alberta

5-083 Edmonton Clinic Health Academy (ECHA)

11405 87 Avenue NW Edmonton, AB T6G 1C9

F:  (780) 248-5616



    


WCHRI is a partnership between the University of Alberta and Alberta Health Services, funded by the generosity of the Stollery Children's Hospital Foundation and the Alberta Women's Health Foundation.


The University of Alberta respectfully acknowledges that we are situated on Treaty 6 territory, traditional lands of First Nations and Métis people.


Ignacio Alvarez Fernandez

unread,
Feb 4, 2022, 1:31:53 PM2/4/22
to Rick Watts, Roberto Ferreira, redcap open
Better then if it's isolated from the server!

Really thank you for the advices. I'll look for some free hosting server or whatever.
And yes, for sure it will be a hard but good learning!

Many thanks!



_____________

Ignacio Álvarez Fernández

Neuropsicólogo / Metodólogo-Estadístico Investigación
Neuropsychologist / Research Methodology-Statistics

Email: ignacio...@gmail.com
Teléfono/Phone: +34 626273933

Luke Stevens

unread,
Feb 6, 2022, 3:00:21 PM2/6/22
to ignacio...@gmail.com, redcap open

Hello Nacho,

 

Rather than locking the form as a way of preventing calculations from being recalculated you could handle that in the calculation expressions themselves. You can use an if() statement to check whether a calculation has already been performed, i.e. that the current field already has a value. If it does then return that same value, if it does not, then perform the calculation.

 

As a simple example, say you have a calculated field named [calctimestwo] which as the calculation expression [somefield]*2, you would change that calculation to if([calctimestwo]=’’, [somefield]*2, [calctimestwo])

 

I hope that helps.

 

Regards,

Luke

 

 

From: redca...@googlegroups.com <redca...@googlegroups.com> On Behalf Of ignacio...@gmail.com
Sent: Friday, 4 February 2022 19:08
To: redcap open <redca...@googlegroups.com>
Subject: [EXTERNAL]Autolock instrument at completion

 

CAUTION:  External Email. Please be cautious with attachments and clicking links

 

--

You received this message because you are subscribed to the Google Groups "redcap open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redcap_open/8244db2b-ae9c-4ab9-a95a-c77ece877928n%40googlegroups.com.



This e-mail and any attachments to it (the "Communication") are, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Murdoch Children’s Research Institute (MCRI) ABN 21 006 566 972 or any of its related entities. MCRI does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication.

Ignacio Alvarez Fernandez

unread,
Feb 7, 2022, 3:46:00 AM2/7/22
to Luke Stevens, redcap open
Hello Luke,

Thank you for your help.
I had already tried that but it still works wrong (does show the correct value in the original field/original form but does not pipe any value) until I lock it.
I have isolated that the calculations giving errors are all @CALCTEXT and are a part of a "parental sequence" of calculated fields.

Anyway, I have found a workaround where I prevent any data entry (branching logic) until the user confirms that the "calculated" form is completed and locked, and by setting an email alert that arrives to me when the "calculated" form is saved as completed. It is not automatic but reduces the drama of manually having to assure everything works fine. Besides, data entry users will be 2 to 3 and so it is easy to train them properly.

In case it helps, this is an example of the 48 similar calctext formulas, this would be the first one for [calc_itifor_1mes_3]

With Luke's option:
@CALCTEXT(if ([calc_itifor_1mes_3]="", (
if ([calc_itifor_1mes_2] = 01, "Gener",
if ([calc_itifor_1mes_2] = 02, "Febrer",
if ([calc_itifor_1mes_2] = 03, "Març",
if ([calc_itifor_1mes_2] = 04, "Abril",
if ([calc_itifor_1mes_2] = 05, "Maig",
if ([calc_itifor_1mes_2] = 06, "Juny",
if ([calc_itifor_1mes_2] = 07, "Juliol",
if ([calc_itifor_1mes_2] = 08, "Agost",
if ([calc_itifor_1mes_2] = 09, "Setembre",
if ([calc_itifor_1mes_2] = 10, "Octubre",
if ([calc_itifor_1mes_2] = 11, "Novembre",
if ([calc_itifor_1mes_2] = 12, "Desembre", "NaN"))))))))))))),
[calc_itifor_1mes_3]))


Without preventing recalculation:
@CALCTEXT(if ([calc_itifor_1mes_2] = 01, "Gener",
if ([calc_itifor_1mes_2] = 02, "Febrer",
if ([calc_itifor_1mes_2] = 03, "Març",
if ([calc_itifor_1mes_2] = 04, "Abril",
if ([calc_itifor_1mes_2] = 05, "Maig",
if ([calc_itifor_1mes_2] = 06, "Juny",
if ([calc_itifor_1mes_2] = 07, "Juliol",
if ([calc_itifor_1mes_2] = 08, "Agost",
if ([calc_itifor_1mes_2] = 09, "Setembre",
if ([calc_itifor_1mes_2] = 10, "Octubre",
if ([calc_itifor_1mes_2] = 11, "Novembre",
if ([calc_itifor_1mes_2] = 12, "Desembre",
"NaN")))))))))))))


Best
Nacho
Reply all
Reply to author
Forward
0 new messages