高齢者等のワクチン総接種回数の表を作成


Web で閲覧できる次の表を作成します。
接種回数の少ない順にソートしました。

高齢者等のワクチン総接種回数

都道府県別の実績、高齢者等の Excel をダウンロードします。

wget https://www.kantei.go.jp/jp/content/KOREI-kenbetsu-vaccination_data.xlsx

エクセルをJSON に変換します。

xlsx_to_json_vaccine.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
#   xlsx_to_json_vaccine.py
#
#                   May/07/2021
# ------------------------------------------------------------------
import sys
import pandas as pd
#
# ------------------------------------------------------------------
sys.stderr.write("*** 開始 ***\n")
#
file_xlsx = sys.argv[1]
file_json = sys.argv[2]
sys.stderr.write(file_xlsx + "\n")
sys.stderr.write(file_json + "\n")
#
df=pd.read_excel(file_xlsx,header=None)
#
#
df.to_json(file_json,orient='records')
sys.stderr.write("*** 終了 ***\n")
# ------------------------------------------------------------------

変換スクリプト

./xlsx_to_json_vaccine.py KOREI-kenbetsu-vaccination_data.xlsx KOREI-kenbetsu-vaccination_data.json

Web ページ

vaccine.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="vaccine.css">
<title>高齢者等のワクチン総接種回数</title>
</head>
<body>
<blockquote>
<h2>高齢者等のワクチン総接種回数</h2><p />
    <blockquote>
    (2021年5月5日時点)<p />
    </blockquote>
</blockquote>
    <blockquote>
    <div class="contents"></div>
    </blockquote>
</blockquote>
<hr />
データソース<br />
    <blockquote>
    <a href="https://www.kantei.go.jp/jp/headline/kansensho/vaccine.html">
新型コロナワクチンについて</a><br />   
    </blockquote>

<a href="../">Return</a><p />
May/07/2020 AM 08:00<p />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="vaccine.js"></script>
</body>
</html>
vaccine.js
// -----------------------------------------------------------------------
//  vaccine.js
//
//                Mar/30/2020
//
// -----------------------------------------------------------------------
jQuery (function ()
{
    jQuery("#outarea_aa").text ("*** vaccine *** start ***")

    const file_in = "./KOREI-kenbetsu-vaccination_data.json"

    jQuery.getJSON (file_in,function (data_in)
        {
        const data_aa = filter_proc(data_in)
        var str_out = ""
        str_out += "<table>"
        str_out += "<tr>"
        str_out += "<th>No</th>"
        str_out += "<th>都道府県名</th>"
        str_out += "<th>接種回数</th>"
        str_out += "<th>内1回目</th>"
        str_out += "<th>内2回目</th>"
        str_out += "</tr>"

        var count = 1
        for (var key in data_aa)
            {
            const unit_aa = data_aa[key]
            str_out += "<tr>"
            str_out += "<td>" + count + "</td>"
            str_out += "<td>" + unit_aa["0"] + "</td>"
            str_out += "<td>" + unit_aa["1"] + "</td>"
            str_out += "<td>" + unit_aa["2"] + "</td>"
            str_out += "<td>" + unit_aa["3"] + "</td>"
            str_out += "</tr>"

            count += 1
            }

        str_out += "</table>"

        jQuery(".contents").html (str_out)
        })

    jQuery("#outarea_hh").text ("*** vaccine *** end ***")

})

// -----------------------------------------------------------------------
function filter_proc(data_in)
{
    var data_out = []
    count = 0
    for (var key in data_in)
        {
        if ((4 <= key) && (key <= 50))
            {
            data_out.push(data_in[key])
            }
        }

    data_out.sort (compare_by_key_proc)

    return  data_out
}


// -----------------------------------------------------------------------
function compare_by_key_proc (left,right)
{
    var aa = left["1"]
    var bb = right["1"]

    var rvalue = 0

    if (aa < bb)
        {
        rvalue = -1
        }
    else if (aa > bb)
        {
        rvalue = 1
        }

    return  rvalue
}

// -----------------------------------------------------------------------
vaccine.css
/* -------------------------------------------------------------- */
/*

    vaccine.css

                        May/07/2021

*/
/* -------------------------------------------------------------- */
table.main,td,th {
table-layout:fixed;
border:1.5px #7e7e7e solid;
border-collapse: collapse;
height: 16px;
}

th {
    background: #c6c6c6;
}

/* -------------------------------------------------------------- */

関連ページ
日本のワクチン接種回数の表を作成