Skip to content

Instantly share code, notes, and snippets.

@github-shakti
Last active September 10, 2017 22:12
Show Gist options
  • Select an option

  • Save github-shakti/e6f819dda77813dd958bd3f2aae63601 to your computer and use it in GitHub Desktop.

Select an option

Save github-shakti/e6f819dda77813dd958bd3f2aae63601 to your computer and use it in GitHub Desktop.
Test Code
import pandas as pd
df=pd.read_csv("IDSP.csv")
print 'Total Requests provided in the Data : ' + str(df.shape[0])
dfd = df.iloc[1:49692,:]
print 'Total Requests made during specified period : ' + str(dfd.shape[0])
cph_filter = (dfd["STOREROOM"] == "CPG") | (dfd["STOREROOM"] == "CPN")& (dfd["STOREROOM"] != "AC1")& (dfd["STOREROOM"] != "MC1")& (dfd["STOREROOM"] != "PMC")
filtered_reviews = dfd[cph_filter]
print 'Total Requests made during specified period at CPH ie (CPN & CPG): ' + str(filtered_reviews.shape[0])
print 'Total Unique EHR ID at CPH during specified period : ' + str(filtered_reviews.EHRID.nunique())
'''print dfd.groupby('USERNAME').EHRID.nunique()'''
'''print dfd.groupby('STOCK_CODE').EHRID.nunique()'''
print dfd.groupby('STOREROOM').EHRID.nunique()
print ""
print "*** Individual Assessment (Data to be Specified) ***"
filter2 = (dfd["USERNAME"] == "MEDICALOFFICER15.CPH")
filtered2 = dfd[filter2]
print 'Total Requests made during specified period at CPH ie (CPN & CPG) : ' + str(filtered2.shape[0])
print 'Total Unique IDs made during specified period at CPH ie (CPN & CPG): ' + str(filtered2.EHRID.nunique())
print "***"
print ""
dm_filter = ((dfd["STOREROOM"] == "CPG")|(dfd["STOREROOM"] == "CPN") & (dfd["STOREROOM"] != "AC1")& (dfd["STOREROOM"] != "MC1")& (dfd["STOREROOM"] != "PMC"))& ((dfd["STOCK_CODE"] == "TMETFORM500")|(dfd["STOCK_CODE"] == "TMETFORM1000")|(dfd["STOCK_CODE"] == "TGLIME2")|(dfd["STOCK_CODE"] == "TVOGLI3"))
diabetics = dfd[dm_filter]
print 'Total Requests that Dispensed Diabetic Medicines :' + str(diabetics.shape[0])
print 'Total Unique Diabetic Patients :' + str(diabetics.EHRID.nunique())
print ""
dyslip_filter = ((dfd["STOREROOM"] == "CPG")|(dfd["STOREROOM"] == "CPN") & (dfd["STOREROOM"] != "AC1")& (dfd["STOREROOM"] != "MC1")& (dfd["STOREROOM"] != "PMC"))& ((dfd["STOCK_CODE"] == "TATORVA10")|(dfd["STOCK_CODE"] == "TFINATE160"))
dyslip = dfd[dyslip_filter]
print 'Total Requests that Dispensed Dyslipidemia Medicines :' + str(dyslip.shape[0])
print 'Total Unique Dyslipidemia Patients :' + str(dyslip.EHRID.nunique())
print""
cipd_filter = ((dfd["STOREROOM"] == "CPG")|(dfd["STOREROOM"] == "CPN") & (dfd["STOREROOM"] != "AC1")& (dfd["STOREROOM"] != "MC1")& (dfd["STOREROOM"] != "PMC"))& ((dfd["STOCK_CODE"] == "TCIPZEND"))
cipd = dfd[cipd_filter]
print 'Total Requests that Dispensed Cip D Medicines :' + str(cipd.shape[0])
print 'Total Unique Cip D Patients :' + str(cipd.EHRID.nunique())
print ""
anemia_filter = ((dfd["STOREROOM"] == "CPG")|(dfd["STOREROOM"] == "CPN") & (dfd["STOREROOM"] != "AC1")& (dfd["STOREROOM"] != "MC1")& (dfd["STOREROOM"] != "PMC"))& ((dfd["STOCK_CODE"] == "CIRON"))
anemia = dfd[anemia_filter]
print 'Total Requests that Dispensed Anemia Medicines :' + str(anemia.shape[0])
print 'Total Unique Anemia Patients :' + str(anemia.EHRID.nunique())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment