Skip to content

Instantly share code, notes, and snippets.

View taylordelehanty's full-sized avatar

Taylor Delehanty taylordelehanty

View GitHub Profile
#! usr/bin/python
#currently python3
import py2neo as py
class MusicTraverser:
def getSong():
# gets the information needed from the neo4j graph and sends request to lastfm API to play song
pass
@taylordelehanty
taylordelehanty / postgres_v5_drug_era_nonstockpile.sql
Created July 13, 2015 15:36
PostgreSQL v5 CDM drug_era builder that uses the non-stockpile method to populate
/* THIS CODE IS NOT FULLY TESTED YET. It still needs to be verified, but it uses the same
* algorithm found in Chris_Knoll's script: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
*/
---TRUNCATE omop.v5drug_era;
WITH
ctePreDrugTarget(drug_exposure_id, person_id, ingredient_concept_id, drug_exposure_start_date, days_supply, drug_exposure_end_date) AS
(-- Normalize DRUG_EXPOSURE_END_DATE to either the existing drug exposure end date, or add days supply, or add 1 day to the start date
SELECT
@taylordelehanty
taylordelehanty / postgres_v5_drug_era_stockpile.sql
Last active December 5, 2017 17:21
PostgreSQL v5 CDM drug_era builder that uses stockpile method for gap_days
--------------------------------------------------------------------------------------------------------------
---Adapted to PostgreSQL drug_era from Pure SQL drug_era written by Chris_Knoll: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
---Upgraded to v5
---Uses STOCKPILE method to populate gap_days field
---INTERVAL set to 30 days
---Chris Knoll's comments are after two dashes
---Taylor Delehanty's comments are after three dashes
---proper schema for "<schema>" needs to be replaced in the code
---proper schema for "<vocabulary_and_concept_schema>" needs to be replaced in the code
@taylordelehanty
taylordelehanty / postgres_v4_drug_era.sql
Created July 7, 2015 21:11
PostgreSQL v4 CDM drug_era builder
--------------------------------------------------------------------------------------------------------------
---Adapted to PostgreSQL drug_era from Pure SQL drug_era written by Chris_Knoll: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
---INTERVAL set to 30 days
---Chris Knoll's comments are after two dashes
---Taylor Delehanty's comments are after three dashes
---proper schema for "<schema>" needs to be replaced in the code
---proper schema for "<vocabulary_and_concept_schema>" needs to be replaced in the code
--------------------------------------------------------------------------------------------------------------
@taylordelehanty
taylordelehanty / postgres_v4_condition_era.sql
Last active August 29, 2015 14:24
PostgreSQL v4 CDM condition_era builder
--------------------------------------------------------------------------------------------------------------
---Adapted to PostgreSQL condition_era from Pure SQL drug_era written by Chris_Knoll: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
---INTERVAL set to 30 days
---Chris Knoll's comments are after two dashes
---Taylor Delehanty's comments are after three dashes
---proper schema name needs to replace "<schema>" in the code
--------------------------------------------------------------------------------------------------------------
TRUNCATE <schema>.condition_era;
@taylordelehanty
taylordelehanty / postgres_v5_dose_era.sql
Last active August 29, 2015 14:24
v5_CDM_populate_dose_era.sql
--------------------------------------------------------------------------------------------------------------
---Adapted to PostgreSQL v5 dose_era from Pure SQL drug_era written by Chris_Knoll: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
---INTERVAL set to 30 days
---Chris Knoll's comments are after two dashes
---Taylor Delehanty's comments are after three dashes
---proper schema name needs to replace "<schema>" in the code
---<schema> needs to be replaced with actual schema where dose_era table is located
---<vocabulary_schema> needs to be replaced with actual schema where vocabularies and concepts are located
---works with dose_era_id being self-generated
@taylordelehanty
taylordelehanty / postgres_v5_condition_era.sql
Last active April 15, 2020 18:38
PostgreSQL v5 CDM condition_era builder
--------------------------------------------------------------------------------------------------------------
---Adapted to PostgreSQL condition_era from Pure SQL drug_era written by Chris_Knoll: https://gist.github.com/chrisknoll/c820cc12d833db2e3d1e
---Upgraded to v5 OMOP
---INTERVAL set to 30 days
---Chris Knoll's comments are after two dashes
---Taylor Delehanty's comments are after three dashes
--------------------------------------------------------------------------------------------------------------
TRUNCATE <schema>.condition_era;