def get_summary_data(row): woreda_hc = Dataset.merged_woreda_hc_mb() woreda_hc = woreda_hc[woreda_hc['woreda'] == row['woreda']].sum() woreda_hp = Dataset.merged_woreda_hp_mb() woreda_hp = woreda_hp[woreda_hp['woreda'] == row['woreda']].sum() return [[ Utils.p('II. Baseline Malaria Burden, 2008 EFY', 10, True, '#0085B7', align=Align.LEFT), '', '', '' ], [ Utils.p('Malaria cases reported by', 8, True, align=Align.LEFT), Utils.p('Health Centers', 7, True, '#5A5A5C'), Utils.p('Health Posts', 7, True, '#5A5A5C'), Utils.p('Total', 7, True, '#5A5A5C') ], [ '', Utils.p(woreda_hc['mb_2008_y']), Utils.p(woreda_hp['mb_2008_y']), Utils.p(woreda_hc['mb_2008_y'] + woreda_hp['mb_2008_y']) ]]
def get_dx_hc_data(row): data = [[ Utils.p('Malaria diagnosis method used by HCs', 8, True, align=Align.LEFT), '', '', '' ], [ '', Utils.p('Light Microscopy', 7, True, '#5A5A5C'), Utils.p('RDT', 7, True, '#5A5A5C'), Utils.p('Both', 7, True, '#5A5A5C') ]] woreda_hc = Dataset.merged_woreda_hc() for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): data.append([ Utils.p(Utils.short(r['hfname']), 7, align=Align.LEFT), Utils.p(r['dxmic'], 7), Utils.p(r['dxrdt'], 7), Utils.p(r['dxboth'], 7) ]) return data
def get_data(row): data = [[ Utils.p('IV. Finance', 10, True, '#0085B7', align=Align.LEFT), '', '', '', '' ], [ Utils.p('Woreda', 8, True, align=Align.LEFT), '', '', Utils.p('Health center', 8, True, align=Align.LEFT), '' ], [ Utils.p('Woreda allocate funds for malaria activities', 7, align=Align.LEFT), Utils.p(row['bgt'], 7, align=Align.LEFT), '', '', Utils.p('Participate in health insurance', 7, True, '#5A5A5C') ]] woreda_hc = Dataset.merged_woreda_hc() for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): data.append([ '', '', '', Utils.p(Utils.short(r['hfname']), 7, align=Align.LEFT), Utils.p('Yes' if r['insu'] == 1 else 'No', 7) ]) return data
def get_thc_data(row): data = [[ ' Health center level', 'HCs', 'Vector control', 'Diagnosis', 'Treatment', 'Severe case mngt.', 'IRT', 'M&E', 'ICCM', 'Supply Management', 'SBCC' ]] woreda_hc = Dataset.merged_woreda_hc() for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): data.append([ '', Utils.short(r['hfname']), Utils.n(r['vect_y']), Utils.n(r['dx_y']), Utils.n(r['rx_y']), Utils.n(r['mxsevr']), Utils.n(r['IRT']), Utils.n(r['sme_y']), Utils.n(r['iccm_y']), Utils.n(r['scm_y']), Utils.n(r['sbcc_y']) ]) return data
def get_data(row): data = [[Utils.p('V. Health Information System', 10, True, '#0085B7', align=Align.LEFT), '', '', '', '', '', ''], [Utils.p('Woreda', 8, True, align=Align.LEFT), '', '', Utils.p( 'Health center', 8, True, align=Align.LEFT), '', '', ''], [Utils.p('Have malaria epidemic monitoring charts', 7, align=Align.LEFT), Utils.p(row['chart'], 7), '', '', Utils.p('Have epidemic chart', 7, True, '#5A5A5C', align=Align.LEFT), Utils.p('Calculate API', 7, True, '#5A5A5C', align=Align.LEFT), Utils.p('Calculate TPR', 7, True, '#5A5A5C', align=Align.LEFT)], [Utils.p('Calculate Total Positive Rate(TPR)', 7, align=Align.LEFT), Utils.p(row['tpr'], 7), '', '', '', '', ''], [Utils.p('Calculate Annual Parasitic Incidence(API)', 7, align=Align.LEFT), Utils.p(row['api'], 7), '', '', '', '', ''], [Utils.p('Include NGO and private Health Facilities in PHEM report', 7, align=Align.LEFT), Utils.p(row['priv'], 7), '', '', '', '', ''] ] woreda_hc = Dataset.merged_woreda_hc() i = 0 for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): if i < 3: data[i+3][3] = Utils.p(Utils.short(r['hfname']), 7, align=Align.LEFT) data[i+3][4] = Utils.p(r['chart_y'], 7) data[i+3][5] = Utils.p(r['api_y'], 7) data[i+3][6] = Utils.p(r['tpr_y'], 7) else: data.append(['', '', '', Utils.p(Utils.short(r['hfname']), 7, align=Align.LEFT), Utils.p( r['chart_y'], 7), Utils.p(r['api_y'], 7), Utils.p(r['tpr_y'], 7)]) i += 1 return data
def get_data(row): data = [[ Utils.p('VII. Health Service Delivery', 10, True, '#0085B7', align=Align.LEFT), '', '', '', '', '', '', '', '' ], [ Utils.p('Availability of Manuals and Guideline at', 8, True, align=Align.LEFT), '', '', '', '', '', '', '', '' ], [ '', Utils.p('Laboraotory diagnosis of malaria', 7, True, '#5A5A5C'), Utils.p('External qauallity assessment', 7, True, '#5A5A5C'), Utils.p('Bloold sample collection', 7, True, '#5A5A5C'), Utils.p('Giemsa preparation', 7, True, '#5A5A5C'), Utils.p('Blood film prepartion', 7, True, '#5A5A5C'), Utils.p('Blood film staining', 7, True, '#5A5A5C'), Utils.p('Microscopy job aid', 7, True, '#5A5A5C'), Utils.p('Malaria treatment', 7, True, '#5A5A5C') ], [ Utils.p('Woreda', 7, align=Align.LEFT), Utils.em(row['labdxbk'], False), Utils.em(row['eqabk'], False), Utils.em(row['smplcolbk'], False), Utils.em(row['gmsbk'], False), Utils.em(row['bfbk'], False), Utils.em(row['bfsbk'], False), Utils.em(row['micjbk'], False), Utils.em(row['malrxbk'], False) ]] woreda_hc = Dataset.merged_woreda_hc() for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): data.append([ Utils.p(Utils.short(r['hfname']), 7, align=Align.LEFT), Utils.em(r['labdxbk_y'], False), Utils.em(r['eqabk_y'], False), Utils.em(r['splcolbk'], False), Utils.em(r['gmsbk_y'], False), Utils.em(r['bfbk_y'], False), Utils.em(r['bfsbk_y'], False), Utils.em(r['micbk_y'], False), Utils.em(r['malrxbk_y'], False) ]) return data
def generate_hew_bar_chart(row): woreda_hp = Dataset.merged_woreda_hp() woreda_hp = woreda_hp[woreda_hp['woreda'] == row['woreda']] sorted_data = woreda_hp.sort_values(by=['total_extension']) category = sorted_data['hpname'].apply(lambda x: Utils.short(str(x))) data = sorted_data['total_extension'] return Utils.generate_bar_chart(category, data, ylabel='# of HEWs')
def generate_pie_chart(row): woreda_hp = Dataset.merged_woreda_hp_mb() categories, data = Utils.rearrange( woreda_hp[(woreda_hp['woreda'] == row['woreda']) & (woreda_hp['mb_2008_y'] > 0)], 'name_hp', 'mb_2008_y') # shorten the name of each health post categories = categories.apply(lambda x: Utils.short(x)) return Utils.generate_pie_chart(categories, data)
def generate_bar_chart(row): woreda_hc = Dataset.merged_woreda_hc_mb() woreda_hc = woreda_hc[woreda_hc['woreda'] == row['woreda']] sorted_data = woreda_hc.sort_values(by=['mb_2008_y']) category = sorted_data['name_hc'].apply(lambda x: Utils.short(x)) data = sorted_data['mb_2008_y'] return Utils.generate_bar_chart(category, data, ylabel='# of malaria cases')
def get_hew_tree_map(row): woreda_hp = Dataset.merged_woreda_hp() sizes = [] labels = [] for index, r in woreda_hp[(woreda_hp['woreda'] == row['woreda']) & ( woreda_hp['total_extension'] > 0)].iterrows(): sizes.append(r['total_extension']) labels.append('{}\n{:.0f}'.format(Utils.short(r['hpname']), r['total_extension'])) return Utils.generate_tree_map(labels, sizes)
def get_data(row): data = [[Utils.p('VI. Supply Chain Management', 10, True, '#0085B7', align=Align.LEFT), '', '', '', ''], [Utils.p('Woreda', 8, True, align=Align.LEFT), '', '', Utils.p( 'Health center', 8, True, align=Align.LEFT), ''], [Utils.p('Uses Integrated Pharmaceutical Logistics System (IPLS)', 7, align=Align.LEFT), Utils.p( row['ipls'], 7), '', '', Utils.p('IPLS use', 7, True, '#5A5A5C')], ] woreda_hc = Dataset.merged_woreda_hc() for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): data.append(['', '', '', Utils.p(Utils.short( r['hfname']), 7, align=Align.LEFT), Utils.p(r['ipls_y'], 7)]) return data
def get_stock_out_data(row): data = [ [Utils.p('Stocked out of commodities in the last 6 months at', 8, True, align=Align.LEFT), '', '', '', '', '', '', ''], ['', Utils.p('Giemsa', 7, True, '#5A5A5C'), Utils.p('RDT', 7, True, '#5A5A5C'), Utils.p('Coartum', 7, True, '#5A5A5C'), Utils.p('Chloroquine tablet', 7, True, '#5A5A5C'), Utils.p( 'Chloroquine syrups', 7, True, '#5A5A5C'), Utils.p('Artesunate Injection', 7, True, '#5A5A5C'), Utils.p('Artesunate suppository', 7, True, '#5A5A5C')], [Utils.p('Woreda', 7, align=Align.LEFT), Utils.em(row['gmsa']), Utils.em(row['rdt']), Utils.em(row['crtm']), Utils.em( row['chlrqntb']), Utils.em(row['chlrqnsyp']), Utils.em(row['artsntinj']), Utils.em(row['artsntsp'])] ] woreda_hc = Dataset.merged_woreda_hc() for index, r in woreda_hc[woreda_hc['woreda'] == row['woreda']].iterrows(): data.append([Utils.p(Utils.short(r['hfname']), 7, align=Align.LEFT), Utils.em(r['gmsa_y']), Utils.em(r['rdt_y']), Utils.em(r['crtm_y']), Utils.em( r['chlrqntb_y']), Utils.em(r['chlrqnsyp_y']), Utils.em(r['artsntinj_y']), Utils.em(r['artsntsp_y'])]) return data
def get_stacked_bar_chart(row): woreda_hc = Dataset.merged_woreda_hc() woreda_hc = woreda_hc[woreda_hc['woreda'] == row['woreda']] categories = np.array( woreda_hc['hfname'].apply(lambda x: Utils.short(x))) clinical = np.array(woreda_hc['clncstaff']) lab = np.array(woreda_hc['labstaff']) pharmacy = np.array(woreda_hc['pharm']) phem = np.array(woreda_hc['phem_y']) hmis = np.array(woreda_hc['hmis_y']) values = [clinical, lab, pharmacy, phem, hmis] color_label = [('#009076', 'Clinical'), ('#00dca6', 'Laboratory'), ('#ff483a', 'Pharmacy'), ('#18a1cd', 'PHEM'), ('#15607a', 'HMIS')] return Utils.generate_stacked_bar_chart(categories, values, color_label, ylabel='# of staff')
def __generate_malaria_burden(self, row): data = MalariaBurden.get_summary_data(row) t = Table(data, colWidths='*', spaceBefore=0) t.setStyle(MalariaBurden.get_table_style()) self.__story.append(t) woreda_hp = Dataset.merged_woreda_hp_mb() woreda_hp = woreda_hp[(woreda_hp['woreda'] == row['woreda'])] data = MalariaBurden.get_chart_data(row, woreda_hp) if woreda_hp.shape[0] > MAX_HF: t = Table( data, colWidths=[None, None, 12 * mm, None, 12 * mm, None, 12 * mm], spaceBefore=2) else: t = Table(data, colWidths='*', spaceBefore=2) t.setStyle( MalariaBurden.get_chart_table_style(woreda_hp.shape[0], data.__len__())) self.__story.append(t)