This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as dt | |
import pytest | |
import re | |
def parse_dicom_dt(dicom_dt): | |
""" | |
Parse a Dicom formatted datetime string and return a Python datetime. | |
The Dicom format is "YYYYMMDDHHMMSS.FFFFFF&ZZXX" described here: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple HTTPS server | |
Generate cert and key with: | |
```sh | |
openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes -subj '/CN=localhost' -out ./ssl/cert.pem -keyout ./ssl/key.pem | |
``` | |
Test with httpie: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Convert JSON output from V7 Darwin to csv. | |
""" | |
import json | |
import os.path | |
import pandas as pd | |
filenames = [f"{name}.json" for name in list('abcde')] | |
data_dir = "data/lizzie-reader-study-test-part-1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import io | |
import boto3 | |
import json | |
import csv | |
# grab environment variables | |
ENDPOINT_NAME = 'xgboost-2020-02-01-16-28-38-417' | |
runtime= boto3.client('runtime.sagemaker') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Look up ICD10 codes. | |
Using data from the CDC's refence page here: | |
https://www.cdc.gov/nchs/icd/icd10cm.htm | |
""" | |
import sys | |
from xml.etree import ElementTree as et | |
x = et.parse('/Users/christopherbare/Downloads/icd10cm_tabular_2020.xml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Reformat the output of Amazon Transcribe | |
usage: python3 speakers.py asrOutput.json | |
""" | |
import json | |
import sys | |
# read in the JSON output of Amazon Transcribe | |
with open(sys.argv[1]) as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library('RPostgreSQL') | |
library('dplyr') | |
library('lubridate') | |
library('tidyr') | |
# Get external reviews with UTC timestamps from the DB | |
# \copy (select distinct o.observation_id, o.collection_date, o.vendor_id, v.name, reviewed_at_utc, reviewed_by from ops.review r join analysis.observation o on r.observation_id=o.observation_id join analysis.vendor v on o.vendor_id=v.vendor_id where reviewed_at_utc >= '2017-05-01' order by reviewed_at_utc) TO '/Users/cbare/Desktop/external-reviews.tsv' WITH NULL AS ''; | |
# df <- read.table('/Users/cbare/Desktop/external-reviews.tsv', stringsAsFactors=F) | |
# get data via a query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a bit of Python code with type annotations. | |
To type check this code with [mypy](http://mypy-lang.org/) like this: | |
mypy mypy/type_check_me.py | |
""" | |
from typing import List, TypeVar, Optional, Sequence | |
def gcd(a: int, b: int) -> int: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compile stats on external clinical reviews | |
library('RPostgreSQL') | |
library('dplyr') | |
library('lubridate') | |
library('tidyr') | |
# Get external reviews with UTC timestamps from the DB | |
# \copy (select distinct o.observation_id, o.collection_date, o.vendor_id, v.name, reviewed_at_utc, reviewed_by from ops.review r join analysis.observation o on r.observation_id=o.observation_id join analysis.vendor v on o.vendor_id=v.vendor_id where reviewed_at_utc >= '2017-05-01' order by reviewed_at_utc) TO '/Users/cbare/Desktop/external-reviews.tsv' WITH NULL AS ''; | |
# get a table of addresses from user-management |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
gr = log --graph --full-history --all --color \n --pretty=tformat:\"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m\" | |
plog = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 20 | |
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat | |
cdiff = diff --cached | |
branches = branch --list -vva --color | |
remotes = remote --verbose | |
[color] | |
ui = auto |
NewerOlder