Risk Score Calculater, how to make?

I am an internist in Japan and I use Text Blaze to fill out electronic medical records.

I would like to use Text Blaze to calculate a patient's risk score. For example, for a CHADS2 score, the score is determined by 5 questions and the indication for oral medication is determined.

With Text Blaze, I would like to set up a function and use an if statement to get +1 or +2 points when a question is answered.

I would like to create something like the following

Translated with DeepL Translate: The world's most accurate translator (free version)

Hey @Naritatsu_Saito, glad to see you coming up with some many cool ideas for Text Blaze. This is definitely possible. I've created the CHADS2 score calculator that you linked as a snippet:

{note: trim=yes}
CHF history? {formmenu: Yes; default=No; name=CHF; cols=6}
Hypertension history? {formmenu: Yes; default=No; name=hypertension; cols=6}
Age >= 75? {formmenu: Yes; default=No; name=age; cols=6}
Diabetes mellitus history? {formmenu: Yes; default=No; name=diabetes; cols=6}
Stroke or TIA symptoms previously? {formmenu: Yes; default=No; name=stroketia; trim=right; cols=6}
{if: CHF=="Yes"; trim=yes}{chfscore=1}{else}{chfscore=0}{endif}{if: hypertension=="Yes"}{hypertensionscore=1}{else}{hypertensionscore=0}{endif}{if: age=="Yes"}{agescore=1}{else}{agescore=0}{endif}{if: diabetes=="Yes"}{diabetesscore=1}{else}{diabetesscore=0}{endif}{if: stroketia=="Yes"}{stroketiascore=2}{else}{stroketiascore=0}{endif}
{chads2=chfscore+hypertensionscore+agescore+diabetesscore+stroketiascore}
{endnote: trim=yes}
CHADS₂ Score: {=chads2}

{if: chads2==0}Low risk of thromboembolic event. 1.9% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.
{elseif: chads2==1}Intermediate risk of thromboembolic event. 2.8% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.
{elseif: chads2==2}Intermediate risk of thromboembolic event. 4.0% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.
{elseif: chads2==3}High risk of thromboembolic event. 5.9% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.
{elseif: chads2==4}High risk of thromboembolic event. 8.5% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.
{elseif: chads2==5}Note: While history of stroke provides 2 points, most physicians would move these patients directly to the high risk group (>8.5% risk of event per year if no coumadin.)

By points directly:
High risk of thromboembolic event. 12.5% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.
{elseif: chads2==6}Note: While history of stroke provides 2 points, most physicians would move these patients directly to the high risk group (>8.5% risk of event per year if no coumadin.)

By points directly:
High risk of thromboembolic event. 18.2% risk of event per year if no coumadin.

The adjusted stroke rate was the expected stroke rate per 100 person-years derived from the multivariable model assuming that aspirin was not taken.{endif}

I wasn't sure if you wanted each contributing factor to be included in what's inserted when you use the snippet, but if you do you can just remove the {note} and {endnote} commands around them.

To give you a breakdown of what is happening in this snippet:

  • Each factor has a yes/no selector
  • Using the if/else command, each factor is given a score (0, 1 or 2)
  • The CHADS2 score is the total of each one of those factor's scores
  • Using an if and elseif command looking at the CHADS2 score, advice is placed at the bottom appropriate to the score
4 Likes

Thanks, that's what I want!!!

If anyone has other calculators they wanted, please post. Some of us can help make them and it helps multiple people.

1 Like

It would be great if you could recreate the PECARN score for me in Peds.

Thanks

1 Like

@Andre_Persaud welcome to the community! ask and ye shall receive :slight_smile:

Age: {formmenu: \<2 years; \>\=2 years; name=age}
{if: age="<2 years"}
GCS ≤14, palpable skull fracture or signs of AMS? {formmenu: default=; no; yes; name=q1}
AMS: Agitation, somnolence, repetitive questioning, or slow response to verbal communication
{elseif: age=">=2 years"; trim=left}
GCS ≤14 or signs of basilar skull fracture or signs of AMS? {formmenu: default=; no; yes; name=q3}
AMS: Agitation, somnolence, repetitive questioning, or slow response to verbal communication{endif}
{if: age="<2 years" AND q1="no"}
Occipital, parietal or temporal scalp hematoma; history of LOC ≥5 sec; not acting normally per parent or severe mechanism of injury? {formmenu: default=; no; yes; name=q2}
Severe mechanism: MVC with patient ejection, death of another passenger, rollover; pedestrian or bicyclist w/o helmet struck by motorized vehicle; fall from >0.9m or 3ft; head struck by high-impact object{endif: trim=yes}
{if: age=">=2 years" AND q3="no"}
History of LOC or history of vomiting or severe headache or severe mechanism of injury {formmenu: default=; no; yes; name=q4}
Motor vehicle crash with patient ejection, death of another passenger, or rollover; pedestrian or bicyclist without helmet struck by a motorized vehicle; falls of more than 1.5m/5ft; head struck by a high-impact object{endif}

RESULTS
{if: age="<2 years" AND q1="no" AND q2="no"}PECARN recommends No CT; Risk of ciTBI <0.02%, “Exceedingly Low, generally lower than risk of CT-induced malignancies.”

{elseif: age="<2 years" AND q1="no" AND q2="yes"}PECARN recommends observation over imaging, depending on provider comfort; 0.9% risk of clinically important Traumatic Brain Injury.

Consider the following when making imaging decisions: Physician experience, worsening signs/symptoms during observation period, age <3 months, parent preference, multiple vs. isolated findings: patients with certain isolated findings (i.e., no other findings suggestive of TBI), such as isolated LOC, isolated headache, isolated vomiting, and certain types of isolated scalp hematomas in infants >3 months have ciTBI risk substantially <1%.

{elseif: age="<2 years" AND q1="yes"}PECARN recommends CT; 4.4% risk of clinically important Traumatic Brain Injury.

{elseif: age=">=2 years" AND q3="yes"}PECARN recommends CT; 4.3% risk of clinically important Traumatic Brain Injury.

{elseif: age=">=2 years" AND q3="no" AND q4="no"}PECARN recommends No CT; Risk <0.05%, “Exceedingly Low, generally lower than risk of CT-induced malignancies.”

{elseif: age=">=2 years" AND q3="no" AND q4="yes"}PECARN recommends observation over imaging, depending on provider comfort; 0.9% risk of clinically important Traumatic Brain Injury.

Consider the following when making imaging decisions: Physician experience, worsening signs/symptoms during observation period, age <3 months, parent preference, multiple vs. isolated findings: patients with certain isolated findings (i.e., no other findings suggestive of TBI), such as isolated LOC, isolated headache, isolated vomiting, and certain types of isolated scalp hematomas in infants >3 months have ciTBI risk substantially <1%.{endif}

important note: I am not a medical professional and the accuracy of this snippet should be independently reviewed. I recreated it exactly as it was in MDcalc and verified my results against theirs, but I do not have the expertise to say that the results and advice are accurate.

3 Likes

I was going to try working on this but @Andrew_Hall beat me. :laughing:

There is a design question though. If you want to minimize user input, you can have questions for the user that are dependent on the answer (as shown in Andrew's example). Or you can make all questions available for the user (age, GSC, other signs of AMS, skull fracture, severe injury, etc.). This way is more time-consuming but more thorough as it may make the user double-check a symptom was not missed.

So, there's a bit of a design question depending on what you want. One philosophy in medicine when designing things is that you don't want to make things too fast (which turns off critical thinking) and you don't want to make too slow (which is too resource-intensive).

1 Like

Thanks!

I think @Andrew_Hall stays true to the PECARN model. PECARN workflow is linear with Yes/No questions until/if you get a YES.