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

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
class PrrByVaccineProvider {
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) {
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);
}
displayPrrByVaccineTable4Symptom(symptom) {
this.#delegate.displayPrrByKeyTable4Value(symptom);
displayPrrByVaccineTable4Symptom(id, text) {
this.#delegate.displayPrrByKeyTable4Value(id, text);
}
#createPrrByVaccineTable(tableElement) {
return new PrrByKeyTable({
tableElement: tableElement,
keyColumnName: 'Vaccine',
keyColumnName: 'Drug',
prrColumnName: 'Lower Confidence Limit of Proportional Reporting Ratio',
shallMarkRowIfPrrTooHigh: true
});