refactoring
This commit is contained in:
@@ -3,6 +3,7 @@ class PrrByVaccineTable {
|
||||
#tableElement;
|
||||
#table;
|
||||
#sumPrrs;
|
||||
#prrByVaccine;
|
||||
|
||||
constructor(tableElement) {
|
||||
this.#tableElement = tableElement;
|
||||
@@ -13,10 +14,23 @@ class PrrByVaccineTable {
|
||||
}
|
||||
|
||||
display(prrByVaccine) {
|
||||
this.#prrByVaccine = prrByVaccine;
|
||||
const vaccine_prr_pairs = Object.entries(prrByVaccine);
|
||||
this.#setTableRows(vaccine_prr_pairs);
|
||||
}
|
||||
|
||||
getDisplayedTableAsCsv(heading) {
|
||||
return PrrByKey2CsvConverter.convertPrrByKey2Csv(
|
||||
{
|
||||
heading: heading,
|
||||
columns: {
|
||||
keyColumn: 'Vaccine',
|
||||
prrColumn: 'Proportional Reporting Ratio'
|
||||
},
|
||||
prrByKey: this.#prrByVaccine
|
||||
});
|
||||
}
|
||||
|
||||
#createEmptyTable() {
|
||||
return this.#tableElement.DataTable(
|
||||
{
|
||||
|
||||
@@ -35,17 +35,7 @@ class PrrByVaccineTableView {
|
||||
UIUtils.downloadUrlAsFilename(
|
||||
window.URL.createObjectURL(
|
||||
new Blob(
|
||||
[
|
||||
PrrByKey2CsvConverter.convertPrrByKey2Csv(
|
||||
{
|
||||
heading: '# Symptom: ' + this.#symptom,
|
||||
columns: {
|
||||
keyColumn: 'Vaccine',
|
||||
prrColumn: 'Proportional Reporting Ratio'
|
||||
},
|
||||
prrByKey: this.#prrByVaccine
|
||||
})
|
||||
],
|
||||
[this.#prrByVaccineTable.getDisplayedTableAsCsv('# Symptom: ' + this.#symptom)],
|
||||
{ type: 'text/csv' })),
|
||||
this.#symptom
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user