refactoring

This commit is contained in:
frankknoll
2022-02-20 12:09:06 +01:00
parent 928aface1d
commit be6ee46445
3 changed files with 19 additions and 9 deletions

View File

@@ -67,16 +67,21 @@
input.select(); input.select();
} }
function displayCountry(country, batchCodeTable) {
document.querySelector('.heading').textContent = `Batch Codes for ${country}`;
batchCodeTable.ajax.url(`data/${country}.json`).load();
selectInput();
}
$(document).ready(function () { $(document).ready(function () {
const batchCodeTable = createEmptyBatchCodeTable(); const batchCodeTable = createEmptyBatchCodeTable();
document.querySelector('#country').addEventListener( document.querySelector('#countrySelect').addEventListener(
'change', 'change',
event => { event => {
const country = event.target.value; const country = event.target.value;
const result = document.querySelector('.result'); if (country != 'Select country ...') {
result.textContent = `Batch Codes for ${country}`; displayCountry(country, batchCodeTable);
batchCodeTable.ajax.url(`data/${country}.json`).load(); }
selectInput();
}); });
}); });
</script> </script>
@@ -87,8 +92,8 @@
<h1>International Batch Codes</h1> <h1>International Batch Codes</h1>
<p> <p>
<label>Select country: <label>Select country:
<select id="country" name="country"> <select id="countrySelect" name="country">
<option value="">Select One …</option> <option value="Select country ...">Select country ...</option>
<option value="Afghanistan">Afghanistan</option> <option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option> <option value="Albania">Albania</option>
<option value="Algeria">Algeria</option> <option value="Algeria">Algeria</option>
@@ -254,7 +259,7 @@
<option value="Zimbabwe">Zimbabwe</option> <option value="Zimbabwe">Zimbabwe</option>
</select> </select>
</label> </label>
<h2 class="result"></h2> <h2 class="heading"></h2>
<p> <p>
<b>Check out your batch code</b> (last updated 16th February 2022) <b>Check out your batch code</b> (last updated 16th February 2022)
</p> </p>

View File

@@ -182,6 +182,7 @@
" def createSummationTable(\n", " def createSummationTable(\n",
" groupBy,\n", " groupBy,\n",
" columnNameMappingsDict = {\n", " columnNameMappingsDict = {\n",
" # FK-TODO: rename \"Total Number of Adverse Reaction Reports\" to \"Adverse Reaction Reports\" everywhere\n",
" \"DIED_size\": \"Total Number of Adverse Reaction Reports\",\n", " \"DIED_size\": \"Total Number of Adverse Reaction Reports\",\n",
" \"DIED_sum\": \"Deaths\",\n", " \"DIED_sum\": \"Deaths\",\n",
" \"L_THREAT_sum\": \"Life Threatening Illnesses\",\n", " \"L_THREAT_sum\": \"Life Threatening Illnesses\",\n",
@@ -1262,6 +1263,8 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"def saveBatchCodeTable(vaers, file):\n", "def saveBatchCodeTable(vaers, file):\n",
" # FK-TODO: show \"Sever Reports\"\n",
" # FK-TODO: show combination of ALL doses\n",
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(vaers, dose = '1', minADRsForLethality = 100)\n", " batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(vaers, dose = '1', minADRsForLethality = 100)\n",
" batchCodeTable.index.set_names(\"Batch\", inplace = True)\n", " batchCodeTable.index.set_names(\"Batch\", inplace = True)\n",
" display(batchCodeTable)\n", " display(batchCodeTable)\n",

View File

@@ -46,3 +46,5 @@ u039k20a
df[df.index.duplicated(False)].to_excel('results/pfizer_duplicates.xlsx') df[df.index.duplicated(False)].to_excel('results/pfizer_duplicates.xlsx')
http://www.howbadismybatch.info/internationalBatchCodeTables.html