Fuzzy Matches in Google Sheets

When trying to build our curriculum inventory I needed to match thousands of strings in Google Sheets. Doing this manually would have been tedious and prone to error. The EQ function would fail if there was one character different, forget about objectives that had words shifted around. Here’s my script that outputs the percentage of string A that is present in string B averaged with the percentage of string B that is in string A. I found that anything over 40% seems to be semantic match.

function howMuchMatches(string1, string2) {
  // clean both strings
  var array1 = string1.trim().toLowerCase().replace(/[^\w\s\d]/g,"").split(" ");
  var array2 = string2.trim().toLowerCase().replace(/[^\w\s\d]/g,"").split(" ");
  // how much of string1 is in string2
  var numberOfMatches12 = 0;
  for (i=0; i < array1.length; i++) {
    if (array2.indexOf(array1[i])>=0)
      { numberOfMatches12++; }

  // how much of string2 is in string1
  var numberOfMatches21 = 0;

  for (i=0; i < array2.length; i++) {
    if (array1.indexOf(array2[i])>=0)
      { numberOfMatches21++; }

  // convert those to percentages
  var percentMatch12 = numberOfMatches12/array1.length;
  var percentMatch21 = numberOfMatches21/array2.length;

  // return the average the two
  return (percentMatch12 + percentMatch21)/2; 

Infective Endocarditis

IE is an infection of native or prosthetic heart valves, endocardial surface or an indwelling cardiac device (such as a pacer or defibrillator). In recent years, we’re seeing it happen in older and more chronically ill patients. And more MRSA.

The diagnosis is tricky because the presentation can be fairly subtle. You need a high index of suspicion, fever and:

  • unclear infectious source
  • new regurgitant murmur
  • embolic events of unknown source

Get 3 sets of BCx in the ED before antibiotics and possibly a TTE. Patients should receive IV Abx and 1/2 of them require valve replacement or debridement surgery. Indications for surgery are:

  • development of heart failure
  • perivalvular abscess formation
  • uncontrolled infxn
  • Large, Mobile vegetations (that may flick off)

Continue reading “Infective Endocarditis”

How to Take Smart Notes

In his book1, Sönke Ahrens describes two things to improve writing productivity:

  1. Routines for writing
  2. A system for organizing notes and ideas

He breaks down the daunting task of writing by pointing out:

  • Writing a book or manuscript would be easy if someone gave you the first draft.
  • Writing the first draft would be easy if someone gave you an organized set of ideas.
  • Generating the ideas would be easy if someone gave you a set of properly referenced notes from the literature.

Obviously, the “someone” in each of these scenarios is the same person. The routine comes from reversing the process, starting with taking a properly referenced set of notes – hence the title of the book. Continue reading “How to Take Smart Notes”

True Grit: The Surprising, and Inspiring, Science of Success

The importance of perseverance

Angela Duckworth’s work suggests that perseverance is a predictor of success. During her graduate student days she created a “grit scale” which she subsequently tested throughout her career. She characterized “grit” as working hard and finishing what one begins and gives the example of Will Smith explaining in an interview that if he was in a competention on a treadmill, there would be only two outcomes: he would be the last one running or he’d die on that treadmill because he “will not be out worked.”

Continue reading “True Grit: The Surprising, and Inspiring, Science of Success”

Non-Traumatic Lower Back Pain

Most of us will have lower back pain in our lives (80–90% lifetime prevalence) and it accounts for 2–3% of ED visits (so quite a bit).

As with everything in EM, there are benign and serious causes and we need to differentiate between the two. The serious causes include diagnoses in the back and those in the abdomen or retroperitoneum.

  • Benign: muscular and ligament strain, sciatica (posterolateral disk herniation) and spinal stenosis
  • Serious back: cancer, spinal epidural abscess, vertebral osteomyelitis, infectious diskitis, spinal epidural hematoma and giant (central) disk hernation (cauda equina syndrome).
  • Serious non-back: AAA, renal stones, renal infarct, tumor, pancreatitis, pancreatic cancer, PUD, cholecystitis, retroperitoneal hemorrhage, psoas abscess

Continue reading “Non-Traumatic Lower Back Pain”

Graham-Cassidy Bill Doesn’t Add Up

The latest Republican health care bill meant to replace the Affordable Care act comes from Senators Bill Cassidy (LA) and Lindsey Graham (SC). This one presents a more substantial change to the way things are run. Most of this comes from an article in the 9/23/2017 issue of the Economist.

  • The Federal government would play a much smaller role, giving money to the states proportional to the number of inhabitants between 50% and 138% of the Federal Poverty Level.
  • The decisions on how to structure care is passed down to the states. They can petition Health and Human Services to drop ObamaCare provisions such as the Essential Health Benefits that were meant to provide a basal level of care in each plan.

The thought is that this may encourage experimentation in each of the states, however three problems exist.

  1. States are now responsible for structuring care. There is no guarantee they can do a better job. States are also required to have a balanced budget, so the Medicare money may go instead to paying other debts.
  2. There is no increase in money if conditions change. If a state is hit with a disaster, say an opiate epidemic, and requires more money to address this… there is no more money.
  3. Doesn’t fix existing problems with the health insurance marketplace. Premiums have already risen under the ACA and insurers are leaving markets. This new plan has the potential of further raising premium prices (with healthy people leaving the market without the pressure of a mandate) and discouraging insurers from participating (with less healthy people, they are taking more risk).

My Email Rules

Email can consume hours of your day stealing opportunities to do real work. Several people have devised plans to reclaim this time, so I stole the ones that work for me.

These rules have one main goal: to respect my time and that of the receiver.

1. Keep as short as possible.

“I’m sorry to write you a long letter, as I did not have time to write a short one.”

Mark Twain

Continue reading “My Email Rules”