Merge branch 'main' into pages
This commit is contained in:
35
docs/ColumnSearch.js
Normal file
35
docs/ColumnSearch.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// adapted from https://datatables.net/examples/api/multi_filter_select.html
|
||||||
|
class ColumnSearch {
|
||||||
|
|
||||||
|
#column;
|
||||||
|
#select;
|
||||||
|
|
||||||
|
constructor(column) {
|
||||||
|
this.#column = column;
|
||||||
|
const clazz = this;
|
||||||
|
$('<br/>').appendTo($(this.#column.header()));
|
||||||
|
this.#select = $('<select></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('<option value=""></option>');
|
||||||
|
const clazz = this;
|
||||||
|
this.#column
|
||||||
|
.data()
|
||||||
|
.unique()
|
||||||
|
.sort()
|
||||||
|
.each(function (d, _) {
|
||||||
|
clazz.#select.append('<option value="' + d + '">' + d + '</option>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -4,6 +4,7 @@ class BatchCodeTableInitializer {
|
|||||||
#countrySelect;
|
#countrySelect;
|
||||||
#batchCodeTableElement;
|
#batchCodeTableElement;
|
||||||
#batchCodeTable;
|
#batchCodeTable;
|
||||||
|
#columnSearch;
|
||||||
|
|
||||||
constructor({ heading, countrySelect, batchCodeTableElement }) {
|
constructor({ heading, countrySelect, batchCodeTableElement }) {
|
||||||
this.#heading = heading;
|
this.#heading = heading;
|
||||||
@@ -13,6 +14,7 @@ class BatchCodeTableInitializer {
|
|||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.#batchCodeTable = this.#createEmptyBatchCodeTable();
|
this.#batchCodeTable = this.#createEmptyBatchCodeTable();
|
||||||
|
this.#columnSearch = new ColumnSearch(this.#batchCodeTable.column(this.#getColumnIndex('Company')));
|
||||||
this.#countrySelect.addEventListener('change', event => this.#displayCountry(event.target.value));
|
this.#countrySelect.addEventListener('change', event => this.#displayCountry(event.target.value));
|
||||||
this.#displayCountry('Global');
|
this.#displayCountry('Global');
|
||||||
this.#initializeHistogramView();
|
this.#initializeHistogramView();
|
||||||
@@ -48,7 +50,6 @@ class BatchCodeTableInitializer {
|
|||||||
this.#getColumnIndex('Deaths'),
|
this.#getColumnIndex('Deaths'),
|
||||||
this.#getColumnIndex('Disabilities'),
|
this.#getColumnIndex('Disabilities'),
|
||||||
this.#getColumnIndex('Life Threatening Illnesses'),
|
this.#getColumnIndex('Life Threatening Illnesses'),
|
||||||
this.#getColumnIndex('Company'),
|
|
||||||
this.#getColumnIndex('Countries'),
|
this.#getColumnIndex('Countries'),
|
||||||
this.#getColumnIndex('Severe reports'),
|
this.#getColumnIndex('Severe reports'),
|
||||||
this.#getColumnIndex('Lethality')
|
this.#getColumnIndex('Lethality')
|
||||||
@@ -56,7 +57,7 @@ class BatchCodeTableInitializer {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
orderable: false,
|
orderable: false,
|
||||||
targets: this.#getColumnIndex('Countries')
|
targets: [this.#getColumnIndex('Countries'), this.#getColumnIndex('Company')]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
render: (data, type, row) => {
|
render: (data, type, row) => {
|
||||||
@@ -105,6 +106,7 @@ class BatchCodeTableInitializer {
|
|||||||
})
|
})
|
||||||
.then(json => {
|
.then(json => {
|
||||||
this.#setTableRows(json.data);
|
this.#setTableRows(json.data);
|
||||||
|
this.#columnSearch.columnContentUpdated();
|
||||||
this.#selectInput();
|
this.#selectInput();
|
||||||
this.#displayControlColumn(country == 'Global');
|
this.#displayControlColumn(country == 'Global');
|
||||||
});
|
});
|
||||||
|
|||||||
15
src/help.txt
15
src/help.txt
@@ -4,7 +4,6 @@ FK-FIXME:
|
|||||||
|
|
||||||
FK-TODO:
|
FK-TODO:
|
||||||
- Histogramme auch speziell für die einzelnen Länder berechnen und anzeigen.
|
- Histogramme auch speziell für die einzelnen Länder berechnen und anzeigen.
|
||||||
- make Company column searchable: https://datatables.net/examples/api/multi_filter_select.html
|
|
||||||
|
|
||||||
anacron job:
|
anacron job:
|
||||||
sudo cp src/intensivstationen_howbadismybatch.sh /etc/cron.daily/intensivstationen_howbadismybatch
|
sudo cp src/intensivstationen_howbadismybatch.sh /etc/cron.daily/intensivstationen_howbadismybatch
|
||||||
@@ -21,3 +20,17 @@ www.HowBadIsMyBatch.info
|
|||||||
|
|
||||||
https://datatables.net/examples/api/row_details.html
|
https://datatables.net/examples/api/row_details.html
|
||||||
https://www.datatables.net/blog/2017-03-31
|
https://www.datatables.net/blog/2017-03-31
|
||||||
|
|
||||||
|
Profiling:
|
||||||
|
==========
|
||||||
|
from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory
|
||||||
|
import cProfile
|
||||||
|
cProfile.run(
|
||||||
|
'SymptomByBatchcodeTableFactory.createSymptomByBatchcodeTable(international_VAERSVAX_Covid19, international_VAERSSYMPTOMS)',
|
||||||
|
'tmp/restats')
|
||||||
|
|
||||||
|
import pstats
|
||||||
|
from pstats import SortKey
|
||||||
|
|
||||||
|
p = pstats.Stats('tmp/restats')
|
||||||
|
p.strip_dirs().sort_stats(SortKey.CUMULATIVE).print_stats()
|
||||||
|
|||||||
Reference in New Issue
Block a user