Skip to content

Instantly share code, notes, and snippets.

@albert-decatur
Created July 8, 2015 02:51
Show Gist options
  • Save albert-decatur/13d9da54c329dbb08845 to your computer and use it in GitHub Desktop.
Save albert-decatur/13d9da54c329dbb08845 to your computer and use it in GitHub Desktop.
chartpipe of doctor malpractice data

get example D3 of a graph of your data!

example using over one million US Medical Malpractice Cases, 1990-2015

  • input data from the National Practitioner Database here
  • example output here
    • note the huge decline in medical malpractice cases - this is just due to lack of data for 2015!

prerequisites

Just takes about 10 seconds on a pitiful 2GB RAM machine:

cat NPDB1501.DAT |\
# get year field
cut -c 14-17 |\
# give it a header - this is a character delimited DAT file
sed '1 i\year' |\
# get the counts of each unique year
sortfreq |\
# swap column positions - chartpipe wants counts to go second
col_swap 1 2 |\
# sort by year - notice this sort keeps header in place
sortkh "-k1 -n" |\
# send TSV over to chartpipe to make a D3 line example!!!
chartpipe --format=tsv --type=line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment