REDCap - Sending out automated emails after searching in the data for condition - redcap

I am migrating sql server database into REDCap. I am new to REDCap and I am still investigating the features of REDCap. I am building a survey form that will collect all the data into REDCap. Once the data is there in the REDCap, I want to send emails based on the date in the future. For example, if there are fields in the instrument as below
Email
Expiry Date
test#gmail.com
12/12/2021
I want to send automated email to that email address(test#gmail.com) on that date date (12/12/2021). Basically, it has to look at the data and send out reminders to the email address on the expiry date.
I looked at alerts and notifications. I can write the conditional logic to send the reminder upon data entry. But, here in my case, the data is already stored.
I looked at the scheduling module. Scheduling module is generating events on the calendar but not sending emails automatically.
Is there a way I can achieve this?

Which version of REDCap is your institution on? Since version 9.9.1 you can have an alert send either before or after a date field in your project. So the alert can be configured to be triggered by data import, and the time to send would be, say, 5 days before the [expiry_date].
Here is the changelog entry:
Improvement: A new send-time option has been added when setting up Automated Survey Invitations and Alerts & Notifications. When defining
when the ASI/Alert should be sent, the option “Send after a lapse of
time” has a new setting added so that, if desired, the user may set
the time lapse relative to the value of a date or datetime field in
the project. In previous versions, the time lapse setting could only
be set relative to the time in which the ASI/Alert was triggered. That
is still an option, but now users may also opt to send the ASI/Alert a
certain amount of time either before or after the date/time of a
specific field. This new setting will allow users to have greater
control with regard to setting when ASIs/Alerts will be sent without
getting too complicated in their setup, such as having to use complex
logic (with datediff, etc.).
As the changelog says, another method is to use datediff logic in the trigger, which you will need to use if you are not on v9.9.1 or later (you should also encourage your institution to upgrade since there are important security patches since then). When an alert has a datediff function in its logic, REDCap will check it every four hours (unless the frequency has been changed by your administrators). This means you can send the alert 5 days before the expiry date with this logic:
(existing logic) and datediff("today", [expiry_date], "d", true) = -5
The true parameter here returns the signed value, so that if the first date is later than the second, it will return a negative value. false returns an absolute number.
This will be true on the exact day when [expiry_date] is 5 days in the future.

Related

Restrict access to a page when event fires

i have created a booking system which synchronizes with Google Calendar every 5 minutes and also truncates and old data and fetches new one from calendar, this process takes about 2-3 seconds.
What i want to do is, when the event to fetch data from Google Calendar fires, i want to disable access to the route of the booking system for these 2-3 seconds then enable it again when the event ends, i want to do this because it truncates the old data and fetches new one, so if a person is looking at the booking system this 2-3 seconds all the book schedule times will be free and i don't want this to happen.
Is this kind of thing possible?
Thanks and regards!
Well, my suggestion is to create a new field in your users table something like : is_google_sync_active and route middleware.
Then just before you will start sync. you change that field to true and in your new middleware you may check whether your sync. is active or not, then when your sync. ends you just change the value of field again to false. So, every time when user tries to pass to your sync route he will be passing your middleware which wil handle all job.
In addition, you can redirect user to page which shows status or progress if the sync. is processing.

Want to build an attendance management system using MEAN stack

I want to build an attendance management system using MEAN stack. The application should work like this -
There will be an admin who will control CRUD operations on User and as well as look into the Attendance of each user and have a detailed list of average attendance of the user per month and per year.
There will be a user page and when the user logs in i want to store the date and time in the client side and then send it to the database. So that based on the time and date the admin can see when the user has logged in and mark the user as present for that particular day.
I want to know how to store the date and time in the client side and then pass it onto the database for calculations. Also wanted to know that is it necessary to authenticate in the front end as well?
May be I am late, but I can try to answer your query.
You can store date and time as an object and pass it via request parameters to the backend to store it in the database.
You can take a look a the following on how to get date and time in Javascript How do I get the time of day in javascript/Node.js?

Square API - Changing Charge Dates to CaptureTransaction Dates

We're using the Square v2 API.
We're setting the delay_capture field to true in our charge API calls. When we then call the CaptureTransaction for that charge, the date of the transaction is the date the original charge call was sent.
Is there a way to set the date of the transaction to the date the CaptureTransaction call was sent rather than the original charge date?
I don't see any support for this in the documentation but I figured I would ask.
Thank you.
No, you cannot change the recorded dates. I'd recommend using another database to store this additional data and just key on the transaction id.

Using workflows in Dynamics CRM. Static fields?

My first question here. I am relatively new to Dynamics CRM and I am looking to do a customization using workflows and I have run into some issues.
I need to trigger an email to a user if I have 5 records with a specific value chosen in an option set within the last 15 days.I thought I might need a static variable kind of field for the entity. I don't really know how to get that in CRM.
While I have been able to use workflows to get the records within the 2 dates and increment the count for that condition, the count maintained is not static and so it is basically useless for my requirements.
Any suggestions to work around this?
One way of doing it is to have a custom workflow.
Whenever a new record for that entity is created, run this custom workflow and get the count and return it via an Output parameter. Check for the output value and if that is more than the threshold as in the requirement, then consider the step for sending an email to the user, otherwise complete the workflow as succeeded.

How do I restrict a users access to an object?

Hi Sitepoint wizard people,
Say we have an admin application that has multiple users and various objects. What I'd like to do is control access within the object itself - that is, it will behave one way for one type of user, and another way for other users. For example...
Director Mike can override Reception user Sally's registration date. One would assume that Mike could set any date both in the past or in the future. Then we have Payroll user Steve who can also modify Sally's registration date, but only for dates in the past up until (for example) one year ago. To spice things up, then we have the HR Manager Mary who can also amend Sally's registration date, but only for dates from precisely 23rd June 2007 up until one month from now...
How can I program the access restrictions so that on the front end, the form control is restricted with a min and max date, and in the backend, the validator checks the entered date to make sure it falls between those dates? I'd obviously need to be able to tweak the min and max dates for each user type. Other objects might have different parameters - maximum amount on a discount field or days of the week for overtime, for example.
I've asked this question in different ways, but each time I get bogged down by the implementation. I'm currently developing it as a php/MySQL web-based application, but thoughts and comments from other platforms very welcome! This time I'm looking at first principles, so it doesn't matter what your background is, if you have any ideas, please let me know! What do you even call this type of access control...?
Depending of how you application is based, you could ask for credentials at the start of the application and depending on who is requiring access, you could load a different xml file containing different settings.
As for security issue, make sure that the different xml files can't be reached by the users.
Edit:
Since you are using MySQL you could do something like this.
Let's say you have a table of users that has those fields : UserId, UserName, RestrictionId.
And with a Restriction table that looks like : RestrictionId, FieldName, FieldCondition.
This way, in your php app, when a user is authenticated, you can go fetch the correct "Restrictions" on the field and apply them in your code. If it happens that you have multiple fields that require different rules then you can simply add them with the correct RestrictionId.
This DB design is far from perfect, I'm pretty sure you can do better
Since, you are already using MySql db. You can maintain the UserRole Master table details in DB itself. Load the user role data based on login, then you can easily validate the changes made by the user accordingly.

Resources