starting SymptomVsSymptomChartDataProviderTest
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
<script src="../Utils.js"></script>
|
<script src="../Utils.js"></script>
|
||||||
<script src="../UIUtils.js"></script>
|
<script src="../UIUtils.js"></script>
|
||||||
<script src="../NumberWithBarElementFactory.js"></script>
|
<script src="../NumberWithBarElementFactory.js"></script>
|
||||||
|
<script src="./js/Sets.js"></script>
|
||||||
<script src="./js/PrrByKey2CsvConverter.js"></script>
|
<script src="./js/PrrByKey2CsvConverter.js"></script>
|
||||||
<script src="./js/PageInitializer.js"></script>
|
<script src="./js/PageInitializer.js"></script>
|
||||||
<script src="./js/PrrByVaccineProvider.js"></script>
|
<script src="./js/PrrByVaccineProvider.js"></script>
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
<script src="./js/PrrByVaccineTableView.js"></script>
|
<script src="./js/PrrByVaccineTableView.js"></script>
|
||||||
<script src="./js/PrrBySymptomTableView.js"></script>
|
<script src="./js/PrrBySymptomTableView.js"></script>
|
||||||
<script src="./js/SymptomVsSymptomChartView.js"></script>
|
<script src="./js/SymptomVsSymptomChartView.js"></script>
|
||||||
|
<script src="./js/SymptomVsSymptomChartDataProvider.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
"DOMContentLoaded",
|
"DOMContentLoaded",
|
||||||
|
|||||||
20
docs/SymptomsCausedByCOVIDLots/js/Sets.js
Normal file
20
docs/SymptomsCausedByCOVIDLots/js/Sets.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class Sets {
|
||||||
|
|
||||||
|
static filterSet(set, predicate) {
|
||||||
|
return new Set([...set].filter(predicate));
|
||||||
|
}
|
||||||
|
|
||||||
|
static union(sets) {
|
||||||
|
return sets.reduce(
|
||||||
|
(union, set) => new Set([...union, ...set]),
|
||||||
|
new Set());
|
||||||
|
}
|
||||||
|
|
||||||
|
static intersection(set1, set2) {
|
||||||
|
return new Set([...set1].filter(x => set2.has(x)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static isEmpty(set) {
|
||||||
|
return set.size == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
class SymptomVsSymptomChartDataProvider {
|
||||||
|
|
||||||
|
static retainCommonLots({ prrByLotX, prrByLotY }) {
|
||||||
|
const commonLots = SymptomVsSymptomChartDataProvider.#getCommonKeys(prrByLotX, prrByLotY);
|
||||||
|
return {
|
||||||
|
prrByLotX: SymptomVsSymptomChartDataProvider.#retainKeysOfDict(prrByLotX, commonLots),
|
||||||
|
prrByLotY: SymptomVsSymptomChartDataProvider.#retainKeysOfDict(prrByLotY, commonLots)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static #getCommonKeys(dict1, dict2) {
|
||||||
|
return Sets.intersection(
|
||||||
|
SymptomVsSymptomChartDataProvider.#getKeySet(dict1),
|
||||||
|
SymptomVsSymptomChartDataProvider.#getKeySet(dict2));
|
||||||
|
}
|
||||||
|
|
||||||
|
static #getKeySet(dict) {
|
||||||
|
return new Set(Object.keys(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
static #retainKeysOfDict(dict, keys2Retain) {
|
||||||
|
const entries2Retain =
|
||||||
|
Object
|
||||||
|
.entries(dict)
|
||||||
|
.filter(([key, _]) => keys2Retain.has(key));
|
||||||
|
return Object.fromEntries(entries2Retain);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,13 +14,13 @@ class SymptomVsSymptomChartView {
|
|||||||
// FK-TODO: fetch multiple files: https://stackoverflow.com/a/31711496 or https://stackoverflow.com/a/53892713
|
// FK-TODO: fetch multiple files: https://stackoverflow.com/a/31711496 or https://stackoverflow.com/a/53892713
|
||||||
PrrByVaccineProvider.getPrrByVaccine(symptom1)
|
PrrByVaccineProvider.getPrrByVaccine(symptom1)
|
||||||
.then(
|
.then(
|
||||||
prrByKey1 => {
|
prrByLot1 => {
|
||||||
PrrByVaccineProvider.getPrrByVaccine(symptom2)
|
PrrByVaccineProvider.getPrrByVaccine(symptom2)
|
||||||
.then(
|
.then(
|
||||||
prrByKey2 => {
|
prrByLot2 => {
|
||||||
const myData =
|
const myData =
|
||||||
Object
|
Object
|
||||||
.values(prrByKey2)
|
.values(prrByLot2)
|
||||||
.map(
|
.map(
|
||||||
val =>
|
val =>
|
||||||
({
|
({
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
QUnit.module('SymptomVsSymptomChartDataProviderTest', function () {
|
||||||
|
|
||||||
|
QUnit.test.each(
|
||||||
|
'shouldRetainCommonLots',
|
||||||
|
[
|
||||||
|
[
|
||||||
|
{
|
||||||
|
prrByLotX: {
|
||||||
|
"lotX": 1.0
|
||||||
|
},
|
||||||
|
prrByLotY: {
|
||||||
|
"lotY": 2.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prrByLotX: {
|
||||||
|
},
|
||||||
|
prrByLotY: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
prrByLotX: {
|
||||||
|
"lotX": 1.0,
|
||||||
|
"lotCommon": 2.0
|
||||||
|
},
|
||||||
|
prrByLotY: {
|
||||||
|
"lotCommon": 3.0,
|
||||||
|
"lotY": 4.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prrByLotX: {
|
||||||
|
"lotCommon": 2.0
|
||||||
|
},
|
||||||
|
prrByLotY: {
|
||||||
|
"lotCommon": 3.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
(assert, [dataSets, mergedDataSets]) => {
|
||||||
|
// Given
|
||||||
|
|
||||||
|
// When
|
||||||
|
const mergedDataSetsActual = SymptomVsSymptomChartDataProvider.retainCommonLots(dataSets);
|
||||||
|
|
||||||
|
// Then
|
||||||
|
assert.deepEqual(mergedDataSetsActual, mergedDataSets);
|
||||||
|
});
|
||||||
|
});
|
||||||
37
docs/SymptomsCausedByCOVIDLots/test/index.test.html
Normal file
37
docs/SymptomsCausedByCOVIDLots/test/index.test.html
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Safety Signals for COVID Batches</title>
|
||||||
|
<script src="../../Utils.js"></script>
|
||||||
|
<script src="../../UIUtils.js"></script>
|
||||||
|
<script src="../../NumberWithBarElementFactory.js"></script>
|
||||||
|
<script src="../js/Sets.js"></script>
|
||||||
|
<script src="../js/PrrByKey2CsvConverter.js"></script>
|
||||||
|
<script src="../js/PageInitializer.js"></script>
|
||||||
|
<script src="../js/PrrByVaccineProvider.js"></script>
|
||||||
|
<script src="../js/PrrByKeyTable.js"></script>
|
||||||
|
<script src="../js/PrrByKeyTableView.js"></script>
|
||||||
|
<script src="../js/PrrByVaccineTableView.js"></script>
|
||||||
|
<script src="../js/PrrBySymptomTableView.js"></script>
|
||||||
|
<script src="../js/SymptomVsSymptomChartView.js"></script>
|
||||||
|
<script src="../js/SymptomVsSymptomChartDataProvider.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.17.2.css">
|
||||||
|
<script src="https://code.jquery.com/qunit/qunit-2.17.2.js"></script>
|
||||||
|
<script type="text/javascript" src="./jshamcrest.js"></script>
|
||||||
|
<script type="text/javascript" src="./jsmockito-1.0.4.js"></script>
|
||||||
|
<script>
|
||||||
|
JsHamcrest.Integration.QUnit();
|
||||||
|
JsMockito.Integration.QUnit();
|
||||||
|
</script>
|
||||||
|
<script src="./SymptomVsSymptomChartDataProviderTest.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="qunit"></div>
|
||||||
|
<div id="qunit-fixture"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
1500
docs/SymptomsCausedByCOVIDLots/test/jshamcrest.js
Normal file
1500
docs/SymptomsCausedByCOVIDLots/test/jshamcrest.js
Normal file
File diff suppressed because it is too large
Load Diff
1019
docs/SymptomsCausedByCOVIDLots/test/jsmockito-1.0.4.js
Normal file
1019
docs/SymptomsCausedByCOVIDLots/test/jsmockito-1.0.4.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ FK-TODO:
|
|||||||
- Symptomhistogramm
|
- Symptomhistogramm
|
||||||
- http://www.howbadismybatch.info/SymptomsCausedByVaccines/index.html
|
- http://www.howbadismybatch.info/SymptomsCausedByVaccines/index.html
|
||||||
- http://www.howbadismybatch.info/SymptomsCausedByCOVIDLots/index.html
|
- http://www.howbadismybatch.info/SymptomsCausedByCOVIDLots/index.html
|
||||||
|
http://www.howbadismybatch.info/SymptomsCausedByCOVIDLots/test/index.test.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
|
||||||
|
|||||||
Reference in New Issue
Block a user