Skip to content

Instantly share code, notes, and snippets.

View tashrifbillah's full-sized avatar

Tashrif Billah tashrifbillah

  • Harvard Medical School
  • Boston, MA
View GitHub Profile
@tashrifbillah
tashrifbillah / chrpsychs_scr_ac8.py
Last active July 13, 2022 21:21
chrpsychs_scr_ac8 calc outside REDCap
import numpy as np
# initialize blank data
dict1={}
for i in range(1,16):
dict1[f'chrpsychs_scr_{i}a10']=''
dict1[f'chrpsychs_scr_{i}a10_on']=''
dict1[f'chrpsychs_scr_{i}a6_on']=''
# test data for chrpsychs_scr_ac8=1
@tashrifbillah
tashrifbillah / replicate.py
Last active June 21, 2022 03:09
Script for replicating 1c and 1d formulae in PSYCHS Follow Up
#!/usr/bin/env python
import pandas as pd
import numpy as np
# replicate 1c and 1d for p2-p8 ===============================================
df= pd.read_csv('instrument.csv')
calc_col='Choices, Calculations, OR Slider Labels'
@tashrifbillah
tashrifbillah / manipulate.py
Last active July 8, 2022 15:16
PSYCHS debug
#!/usr/bin/env python
import numpy as np
import pandas as pd
import re
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)
pd.set_option("display.max_colwidth", None)
@tashrifbillah
tashrifbillah / launch_pnl_website.md
Last active March 8, 2022 16:20
Essentials of launching PNL website from local mysql database

1. Create mysql database and user

$ mysql -u root -p
(provide your mysql root password to log in to mysql shell)
mysql> create database pnl
mysql> use pnl;
#!/usr/bin/env python
# cleaned up Kevin's work to make DPdash compatible files
# inserted codes for mtime: the latest time when a subject's data was downloaded
from pathlib import Path
import pandas as pd
import numpy as np
from datetime import time, timedelta, datetime, date
@tashrifbillah
tashrifbillah / files_status.py
Created January 12, 2022 18:18
Combines subject-level DPdash comptabile files to a project-level DPdash file
#!/usr/bin/env python
import pandas as pd
import sys
from os.path import abspath
import numpy as np
COMBINED_STUDY='files'
COMBINED_SUBJECT='combined'
@tashrifbillah
tashrifbillah / make_dpdash_files.py
Last active December 22, 2021 22:36
Make DPdash compatible files from flow check CSVs
#!/usr/bin/env python
import pandas as pd
import sys
from os.path import abspath
filename= abspath(sys.argv[1])
# read Kevin's dataframe
df= pd.read_csv(filename)
@tashrifbillah
tashrifbillah / dash_umap.py
Last active September 14, 2021 02:41
UMAP plot generation using https://dash.plotly.com/
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from scipy.stats import zscore
import umap
from dash.exceptions import PreventUpdate
import plotly.graph_objects as go
@tashrifbillah
tashrifbillah / OpenFaceInstall.md
Last active May 12, 2022 11:22
OpenFace installation on CentOS 7
/*
The file is available as a plain text at
http://ftp.nmr.mgh.harvard.edu/pub/dist/freesurfer/tutorial_packages/centos6/fsl_507/src/tbss/tbss_skeleton.cc
I find that hard to read because of one color
So, I created this gist for better legibility
It has all the colors for a .cc file
*/
/* tbss_skeleton.cc