From 5c205acd324404c8db402952c7b4748af4035a90 Mon Sep 17 00:00:00 2001
From: frankknoll
').appendTo($(this.#column.header()));
- this.#select = $('')
- .appendTo($(this.#column.header()))
- .on(
- 'change',
- function () {
- const val = $.fn.dataTable.util.escapeRegex($(this).val());
- clazz.#column
- .search(val ? '^' + val + '$' : '', true, false)
- .draw();
- });
- }
-
- columnContentUpdated() {
- this.#select.empty();
- this.#select.append('');
- const clazz = this;
- this.#column
- .data()
- .unique()
- .sort()
- .each(function (d, _) {
- clazz.#select.append('');
- });
- }
-}
\ No newline at end of file
diff --git a/docs/batchCodeTable.css b/docs/batchCodeTable.css
index 0e7b4389178..85c45a3fe41 100644
--- a/docs/batchCodeTable.css
+++ b/docs/batchCodeTable.css
@@ -1,11 +1,3 @@
-.dataTables_filter {
- float: left !important;
-}
-
-.dataTables_length {
- float: right !important;
-}
-
.chartWithSlider {
display: flex;
flex-wrap: nowrap;
diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html
index 3b5bab467f5..29c9ebf1e33 100644
--- a/docs/batchCodeTable.html
+++ b/docs/batchCodeTable.html
@@ -15,7 +15,6 @@
gtag('config', 'G-ERHYDH4P64');
-->
-
-
-
-
+
@@ -49767,21 +49762,6 @@
| - | Batch | -Adverse Reaction Reports | -Deaths | -Disabilities | -Life Threatening Illnesses | -Company | -Severe reports | -Lethality | -
|---|
Data Source: Vaccine Adverse Event Reporting System (VAERS) diff --git a/docs/batchCodeTable.js b/docs/batchCodeTable.js deleted file mode 100644 index 6ccb2c3e7fe..00000000000 --- a/docs/batchCodeTable.js +++ /dev/null @@ -1,156 +0,0 @@ -class BatchCodeTableInitializer { - - #batchCodeTableElement; - #batchCodeTable; - #batchCodeSelect; - #columnSearch; - - constructor({ batchCodeTableElement, batchCodeSelect }) { - this.#batchCodeTableElement = batchCodeTableElement; - this.#batchCodeSelect = batchCodeSelect; - } - - initialize() { - this.#batchCodeTable = this.#createEmptyBatchCodeTable(); - this.#columnSearch = new ColumnSearch(this.#batchCodeTable.column(this.#getColumnIndex('Company'))); - this.#initializeBatchCodeSelect(); - this.#display(); - this.#initializeHistogramView(); - } - - #createEmptyBatchCodeTable() { - return this.#batchCodeTableElement.DataTable( - { - initComplete: function () { - $('.dataTables_filter').append(' (press return key)'); - }, - language: - { - searchPlaceholder: "Enter Batch Code" - }, - search: - { - return: true - }, - processing: true, - deferRender: true, - order: [[this.#getColumnIndex('Adverse Reaction Reports'), "desc"]], - columnDefs: - [ - { - className: 'dt-control', - orderable: false, - data: null, - defaultContent: '', - targets: this.#getColumnIndex('control') - }, - { - searchable: false, - targets: [ - this.#getColumnIndex('Adverse Reaction Reports'), - this.#getColumnIndex('Deaths'), - this.#getColumnIndex('Disabilities'), - this.#getColumnIndex('Life Threatening Illnesses'), - this.#getColumnIndex('Severe reports'), - this.#getColumnIndex('Lethality') - ] - }, - { - orderable: false, - targets: [this.#getColumnIndex('Company')] - }, - { - render: (data, type, row) => { - const numberInPercent = parseFloat(data); - return !isNaN(numberInPercent) ? numberInPercent.toFixed(2) + " %" : ''; - }, - targets: [this.#getColumnIndex('Severe reports'), this.#getColumnIndex('Lethality')] - } - ] - }); - } - - #getColumnIndex(columnName) { - switch (columnName) { - case 'control': - return 0; - case 'Batch': - return 1; - case 'Adverse Reaction Reports': - return 2; - case 'Deaths': - return 3; - case 'Disabilities': - return 4; - case 'Life Threatening Illnesses': - return 5; - case 'Company': - return 6; - case 'Severe reports': - return 7; - case 'Lethality': - return 8; - } - } - - #display() { - // FK-TODO: show "Loading.." message or spinning wheel. - fetch(`data/batchCodeTables/Global.json`) - .then(response => response.json()) - .then(json => { - this.#_addEmptyControlColumn(json); - return json; - }) - .then(json => { - this.#setTableRows(json.data); - this.#columnSearch.columnContentUpdated(); - }); - } - - #_addEmptyControlColumn(json) { - json.columns.unshift('control'); - json.data.forEach(row => row.unshift(null)); - } - - #setTableRows(rows) { - this.#batchCodeTable - .clear() - .rows.add(rows) - .draw(); - } - - #initializeBatchCodeSelect() { - this.#batchCodeSelect.select2({ minimumInputLength: 4 }); - this.#batchCodeSelect.on( - 'select2:select', - function (event) { - const batchcode = event.params.data.id; - new HistogramView(document.querySelector("#batchCodeDetails")).displayHistogramView(batchcode); - GoogleAnalytics.click_batchcode(batchcode); - }); - this.#batchCodeSelect.select2('open'); - } - - #initializeHistogramView() { - const thisClassInstance = this; - $(`#${this.#batchCodeTableElement[0].id} tbody`) - .on( - 'click', - 'td.dt-control', - function () { - const tr = $(this).closest('tr'); - const row = thisClassInstance.#batchCodeTable.row(tr); - if (row.child.isShown()) { - row.child.hide(); - tr.removeClass('shown'); - } else { - const uiContainer = document.createElement("div"); - row.child(uiContainer).show(); - tr.addClass('shown'); - const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')]; - new HistogramView(uiContainer).displayHistogramView(batchcode); - GoogleAnalytics.click_batchcode(batchcode); - } - }); - } -} diff --git a/src/BatchCodeTablePersister.py b/src/BatchCodeTablePersister.py index 671e24d46f3..9c8e833e62c 100644 --- a/src/BatchCodeTablePersister.py +++ b/src/BatchCodeTablePersister.py @@ -22,5 +22,6 @@ def createAndSaveGlobalBatchCodeTable(minADRsForLethality, batchCodeTableFactory 'Severe reports', 'Lethality' ]] + # FK-TODO: remove Global.json IOUtils.saveDataFrameAsJson(batchCodeTable, '../docs/data/batchCodeTables/Global.json') return batchCodeTable diff --git a/src/help.txt b/src/help.txt index 159522a6898..72fc8945b8e 100644 --- a/src/help.txt +++ b/src/help.txt @@ -4,7 +4,6 @@ FK-FIXME: FK-TODO: - add google captcha to batchCodeTable.html -- remove batchCodeTable anacron job: sudo cp src/intensivstationen_howbadismybatch.sh /etc/cron.daily/intensivstationen_howbadismybatch