Skip to content

Instantly share code, notes, and snippets.

View johngrimes's full-sized avatar
🚴
coding and cycling

John Grimes johngrimes

🚴
coding and cycling
View GitHub Profile
@johngrimes
johngrimes / get_token.py
Created February 27, 2024 00:06
OAuth2 client credentials test harness
import requests
def get_oauth2_token(client_id, client_secret, token_url):
"""
Obtain an OAuth2 token using client credentials grant.
:param client_id: OAuth2 Client ID
:param client_secret: OAuth2 Client Secret
:param token_url: OAuth2 Token Endpoint URL
@johngrimes
johngrimes / prostate_cancer.ipynb
Created January 16, 2024 10:35
Pathling SQL on FHIR Demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johngrimes
johngrimes / checking-inactive-codes.md
Last active December 14, 2023 23:08
Method for checking for inactive codes within a set of JSON FHIR resources
@johngrimes
johngrimes / update_resources.py
Created August 8, 2022 04:23
Send any number of FHIR JSON resource files to a server as updates (in parallel)
import json
import multiprocessing as mp
import sys
from math import floor
from time import time
import requests
def update_resource(file):
@johngrimes
johngrimes / upload_bundles.py
Last active August 3, 2022 06:44
Upload FHIR JSON Bundles to a FHIR server (in parallel)
import multiprocessing as mp
import sys
from time import time
import requests
def upload_bundle(file):
with open(file) as bundle:
data = bundle.read()
@johngrimes
johngrimes / convert_search_to_update.py
Created August 2, 2022 06:54
Convert between FHIR search and update Bundles
import json
import sys
input_bundle = json.load(sys.stdin)
output_bundle = {
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
@johngrimes
johngrimes / terminology_functions.ipynb
Last active July 25, 2022 06:32
Pathling Python API - Terminology Functions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johngrimes
johngrimes / valueset_to_csv.sh
Created May 25, 2022 01:46
Convert a FHIR ValueSet to CSV using JQ
jq -r ".expansion.contains[] | { system: .system, code: .code, display: .display } | map(values) | @csv" ~/Desktop/source.ValueSet.json >~/Desktop/target.csv
@johngrimes
johngrimes / windowing-test-a.ipynb
Last active November 15, 2020 08:02
Testing windowing as a substitute for straight aggregation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johngrimes
johngrimes / JTI_upset.csv
Last active March 13, 2020 00:31
UpSet Demo
We can't make this file beautiful and searchable because it's too large.
SCTID,FSN,Body,External,Nature
100051000032108,Bat scratch (event),0,1,0
100071000032104,Bat scratch injury (disorder),0,0,1
10050004,Contusion of chest (disorder),0,0,1
10061007,Brain stem contusion without open intracranial wound AND with prolonged loss of consciousness (more than 24 hours) AND return to pre-existing conscious level (disorder),0,0,1
10065003,Excoriated acne (disorder),0,0,1
10070005,Poisoning caused by quinoline AND/OR hydroxyquinoline derivative (disorder),0,1,0
10132008,Burns of multiple sites (disorder),1,0,0
10186000,Toxic effect of selenium compound (disorder),0,1,0
10217006,Third degree perineal laceration (disorder),0,0,1