Exemplo n.º 1
0
    def _getNonNullLabs(self):
        query = SQLQuery()
        # SELECT
        query.addSelect('proc_code')
        # FROM
        query.addFrom('stride_order_proc')
        # WHERE
        query.addWhereLike('proc_code', 'LAB%')
        query.addWhere('abnormal_yn is not null')

        query.addGroupBy('proc_code')
        query.addOrderBy('proc_code')

        results = DBUtil.execute(query)

        df = pd.DataFrame(results, columns=query.select).to_csv(
            DATA_FOLDER + 'proc_codes.csv', index=False)
Exemplo n.º 2
0
	def _getLabs(self):
		query = SQLQuery()
		# SELECT
		query.addSelect(CLINICAL_ITEM_ID)
		query.addSelect('name')
		query.addSelect('description')
		# FROM
		query.addFrom('clinical_item')
		# WHERE
		query.addWhereLike('name','LAB%')
		# OTHER
		query.addOrderBy(CLINICAL_ITEM_ID, dir='asc')

		print(query)
		print(query.getParams())
		DBUtil.runDBScript(self.SCRIPT_FILE, False)
		results = DBUtil.execute(str(query), query.getParams())

		pd.DataFrame(results, columns=query.select).to_csv('data_summary_stats/labs.csv', index=False)