changing some names from Vaccine to Drug

This commit is contained in:
Frank Knoll
2024-07-12 08:48:27 +02:00
parent 2cc3b29ed3
commit ca4d47bbac
5 changed files with 20 additions and 20 deletions

View File

@@ -10,8 +10,8 @@ class PageInitializer {
PageInitializer.#initializeSelectElement( PageInitializer.#initializeSelectElement(
{ {
selectElement: symptomSelectElement, selectElement: symptomSelectElement,
onValueSelected: symptom => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(symptom), onValueSelected: (id, text) => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(id, text),
minimumInputLength: 4 minimumInputLength: 0
}); });
} }
@@ -20,7 +20,7 @@ class PageInitializer {
PageInitializer.#initializeSelectElement( PageInitializer.#initializeSelectElement(
{ {
selectElement: vaccineSelectElement, selectElement: vaccineSelectElement,
onValueSelected: vaccine => prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(vaccine), onValueSelected: (id, text) => prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(id ,text),
minimumInputLength: 0 minimumInputLength: 0
}); });
} }
@@ -30,8 +30,9 @@ class PageInitializer {
selectElement.on( selectElement.on(
'select2:select', 'select2:select',
function (event) { function (event) {
const value = event.params.data.id; const id = event.params.data.id;
onValueSelected(value); const text = event.params.data.text;
onValueSelected(id, text);
}); });
} }
} }

View File

@@ -2,7 +2,7 @@ class PrrByKeyTableView {
#prrByKeyTable; #prrByKeyTable;
#downloadPrrByKeyTableButton; #downloadPrrByKeyTableButton;
#value; #text;
#valueName; #valueName;
#prrByKeyProvider; #prrByKeyProvider;
@@ -14,11 +14,11 @@ class PrrByKeyTableView {
this.#prrByKeyProvider = prrByKeyProvider; this.#prrByKeyProvider = prrByKeyProvider;
} }
displayPrrByKeyTable4Value(value) { displayPrrByKeyTable4Value(id, text) {
UIUtils.disableButton(this.#downloadPrrByKeyTableButton); UIUtils.disableButton(this.#downloadPrrByKeyTableButton);
this.#prrByKeyProvider(value) this.#prrByKeyProvider(id)
.then(prrByKey => { .then(prrByKey => {
this.#value = value; this.#text = text;
this.#prrByKeyTable.display(prrByKey); this.#prrByKeyTable.display(prrByKey);
UIUtils.enableButton(this.#downloadPrrByKeyTableButton); UIUtils.enableButton(this.#downloadPrrByKeyTableButton);
}); });
@@ -36,9 +36,8 @@ class PrrByKeyTableView {
UIUtils.downloadUrlAsFilename( UIUtils.downloadUrlAsFilename(
window.URL.createObjectURL( window.URL.createObjectURL(
new Blob( new Blob(
[this.#prrByKeyTable.getDisplayedTableAsCsv(`# ${this.#valueName}: ${this.#value}`)], [this.#prrByKeyTable.getDisplayedTableAsCsv(`# ${this.#valueName}: ${this.#text}`)],
{ type: 'text/csv' })), { type: 'text/csv' })),
this.#value this.#text);
);
} }
} }

View File

@@ -6,12 +6,12 @@ class PrrBySymptomTableView {
this.#delegate = new PrrByKeyTableView( this.#delegate = new PrrByKeyTableView(
this.#createPrrBySymptomTable(prrBySymptomTableElement), this.#createPrrBySymptomTable(prrBySymptomTableElement),
downloadPrrBySymptomTableButton, downloadPrrBySymptomTableButton,
'Vaccine', 'Drug',
PrrByVaccineProvider.getPrrBySymptom); PrrByVaccineProvider.getPrrBySymptom);
} }
displayPrrBySymptomTable4Vaccine(vaccine) { displayPrrBySymptomTable4Vaccine(id, text) {
this.#delegate.displayPrrByKeyTable4Value(vaccine); this.#delegate.displayPrrByKeyTable4Value(id, text);
} }
#createPrrBySymptomTable(tableElement) { #createPrrBySymptomTable(tableElement) {

View File

@@ -1,10 +1,10 @@
class PrrByVaccineProvider { class PrrByVaccineProvider {
static getPrrByVaccine(symptom) { static getPrrByVaccine(symptom) {
return fetch(`./data/ProportionalReportingRatios/symptoms/${symptom}`).then(response => response.json()); return fetch(`./data/ProportionalReportingRatios/symptoms/${symptom}.json`).then(response => response.json());
} }
static getPrrBySymptom(vaccine) { static getPrrBySymptom(vaccine) {
return fetch(`./data/ProportionalReportingRatios/vaccines/${vaccine}`).then(response => response.json()); return fetch(`./data/ProportionalReportingRatios/vaccines/${vaccine}.json`).then(response => response.json());
} }
} }

View File

@@ -10,14 +10,14 @@ class PrrByVaccineTableView {
PrrByVaccineProvider.getPrrByVaccine); PrrByVaccineProvider.getPrrByVaccine);
} }
displayPrrByVaccineTable4Symptom(symptom) { displayPrrByVaccineTable4Symptom(id, text) {
this.#delegate.displayPrrByKeyTable4Value(symptom); this.#delegate.displayPrrByKeyTable4Value(id, text);
} }
#createPrrByVaccineTable(tableElement) { #createPrrByVaccineTable(tableElement) {
return new PrrByKeyTable({ return new PrrByKeyTable({
tableElement: tableElement, tableElement: tableElement,
keyColumnName: 'Vaccine', keyColumnName: 'Drug',
prrColumnName: 'Lower Confidence Limit of Proportional Reporting Ratio', prrColumnName: 'Lower Confidence Limit of Proportional Reporting Ratio',
shallMarkRowIfPrrTooHigh: true shallMarkRowIfPrrTooHigh: true
}); });