Note: These rules depend upon the availability of the CPP "immu" data uploaded from the EMR, which is only supported by some EMRs (e.g. PS Suite using Ocean Custom Form 3.52 or later).
The following rules can be copied and pasted into a Tablet Rule to prompt automatically.
Prompting for a Flu Shot / Influenza Vaccine Each Season (from Oct 15 until Mar 31)
(function askForFluShot() {
function parseDate(s) { s=s.split("-"); return new Date(s[0],parseInt(s[1]-1),s[2]);}
function latest(vax) {
var dates = [], immu;
for (var i = 0; i < vax.length; i++) {
immu = pt.getCppItemData("immu", vax[i]);
if (immu && immu.date) { dates.push(parseDate(immu.date)); }
}
return dates.length > 0 ? dates.sort(function(a,b){return a-b}).pop() : null;
}
function daysSince(d) {
return d ? (new Date()-d) / (1000*60*60*24) : 99999999;
}
var curMonth = (1+new Date().getMonth());
var curDayOfMonth = new Date().getDate();
var inSeason = (curMonth == 10 && curDayOfMonth >= 15) || curMonth >= 11 || curMonth <= 3;
return inSeason && daysSince(latest(["influenza virus vaccine", "flu shot"])) > 180 && daysSinceLastCompleted > 180;
})();
Copy RulePrompting for Tetanus Shot Every 10 Years
(function askForTetanusShot() {
function parseDate(s) { s=s.split("-"); return new Date(s[0],parseInt(s[1]-1),s[2]);}
function latest(vax) {
var dates = [], immu;
for (var i = 0; i < vax.length; i++) {
immu = pt.getCppItemData("immu", vax[i]);
if (immu && immu.date) { dates.push(parseDate(immu.date)); }
}
return dates.length > 0 ? dates.sort(function(a,b){return a-b}).pop() : null;
}
function daysSince(d) {
return d ? (new Date()-d) / (1000*60*60*24) : 99999999;
}
var vaccines = pt.getCppItemKeys("immu").filter(function(key) { return key.indexOf("tetanus") >= 0; });
return daysSince(latest(vaccines)) > 365*10 && daysSinceLastCompleted >= 365;
})();
Copy Rule