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