Example #1
0
    def export(self, out_dir):
        '''export results'''
        util.make_dir(out_dir)

        io.dict2csv(self.code2manifestation_of,
                    out_dir + 'manifestationof.csv')
        io.dict2csv(self.code2association, out_dir + 'association.csv')
    def export(self, out_dir):
        '''export results'''
        util.make_dir(out_dir)

        io.dict2csv(self.code2indications, out_dir + 'indication.csv')
        io.dict2csv(self.code2effects, out_dir + 'effect.csv')
        io.dict2csv(self.code2ingredients, out_dir + 'ingredient.csv')
	def export(self, out_dir):
		'''export results'''
		util.make_dir(out_dir)
		
		io.dict2csv(self.code2indications, out_dir + 'indication.csv')
		io.dict2csv(self.code2effects, out_dir + 'effect.csv')
		io.dict2csv(self.code2ingredients, out_dir + 'ingredient.csv')
        code2uri_sider = self.merge_dicts(code2uri, uri2uri)

        # print u'J05AB01', code2uri_sider[u'J05AB01']

        code2ingredients = self.merge_dicts(code2uri_sider, uri2ingredient)

        # print u'J05AB01', code2uri_sider[u'J05AB01']

        return code2ingredients


if __name__ == '__main__':
    # in terminal: python integrate.py ../Desktop/indication.csv ../Desktop/effects.csv ../Desktop/ingredients.csv

    # ... or import from SQL (uncomment)
    import cx_Oracle
    rows = cx_Oracle.connect('datamart', 'datamart',
                             '10.67.201.10:1521/XE').cursor()
    rows.execute('''SELECT med.atc_code
						FROM AA_KOP_patient_dates dts 
						LEFT JOIN medicaties med ON dts.patientnummer = med.patientnummer''')
    idx = 0  # we only query atc codes

    # enrich
    indications, effects, ingredients = atc_enrichment(rows, idx)

    # export
    io.dict2csv(indications, sys.argv[1])
    io.dict2csv(effects, sys.argv[2])
    io.dict2csv(ingredients, sys.argv[3])
	def export(self, out_dir):
		'''export results'''
		util.make_dir(out_dir)
		
		io.dict2csv(self.code2manifestation_of, out_dir + 'manifestationof.csv')
		io.dict2csv(self.code2association, out_dir + 'association.csv')
		code2uri_sider = self.merge_dicts(code2uri, uri2uri)
		
		# print u'J05AB01', code2uri_sider[u'J05AB01']

		code2ingredients = self.merge_dicts(code2uri_sider, uri2ingredient)

		# print u'J05AB01', code2uri_sider[u'J05AB01']

		return code2ingredients

if __name__ == '__main__':
	# in terminal: python integrate.py ../Desktop/indication.csv ../Desktop/effects.csv ../Desktop/ingredients.csv

	# ... or import from SQL (uncomment)
	import cx_Oracle
	rows = cx_Oracle.connect('datamart', 'datamart', '10.67.201.10:1521/XE').cursor()
	rows.execute('''SELECT med.atc_code
						FROM AA_KOP_patient_dates dts 
						LEFT JOIN medicaties med ON dts.patientnummer = med.patientnummer''')
	idx = 0 # we only query atc codes

	# enrich
	indications, effects, ingredients = atc_enrichment(rows, idx)
	
	# export
	io.dict2csv(indications, sys.argv[1])
	io.dict2csv(effects, sys.argv[2])
	io.dict2csv(ingredients, sys.argv[3])