PS Suite: Tablet Rules for Immunization Prompts

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

(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;
  }
  return daysSince(latest(["influenza virus vaccine", "flu shot"])) > 180 && daysSinceLastCompleted > 180;
})();
Copy Rule

Prompting 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
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request