予約状況の傾向を分析・可視化するダッシュボードです。
履歴データは最大3年分保存されます(Cloud Storageの容量制限まで)。
Cloud Runサービスを更新して、履歴データを保存する機能を追加します。
timeslot-checker サービスを選択更新方法A: Cloud Shellを使う場合
# Cloud Shellを開く
cd ~
git clone https://github.com/nekonekoganka/reservation-status.git
cd reservation-status/docker-timeslot-checker
# Cloud Runにデプロイ
gcloud run deploy timeslot-checker \
--source . \
--region asia-northeast1 \
--allow-unauthenticated
更新方法B: ローカルからデプロイする場合
cd docker-timeslot-checker
gcloud run deploy timeslot-checker \
--source . \
--region asia-northeast1 \
--allow-unauthenticated
同様の手順で timeslot-checker-shiya サービスを更新:
cd docker-timeslot-checker-shiya
gcloud run deploy timeslot-checker-shiya \
--source . \
--region asia-northeast1 \
--allow-unauthenticated
更新完了後、以下のURLでダッシュボードにアクセスできます:
https://nekonekoganka.github.io/reservation-status/dashboard.html
履歴データは Cloud Storage に以下の形式で保存されます:
gs://fujimino-ophthalmology-reservations/
├── history/
│ ├── general/ # 一般予約の履歴
│ │ ├── 2024-12-07.json
│ │ ├── 2024-12-08.json
│ │ └── ...
│ └── shiya/ # 視野予約の履歴
│ ├── 2024-12-07.json
│ ├── 2024-12-08.json
│ └── ...
各JSONファイルの内容:
[
{
"time": "09:15",
"count": 5,
"status": "○ 空きあり",
"targetDate": 7
},
{
"time": "09:16",
"count": 4,
"status": "○ 空きあり",
"targetDate": 7
}
]
ダッシュボードを院内PCからのみアクセス可能にしたい場合の手順です。
# 院内サーバーにクローン
git clone https://github.com/nekonekoganka/reservation-status.git
cd reservation-status
# 簡易サーバーを起動(Python 3の場合)
python -m http.server 8080
ブラウザで http://localhost:8080/dashboard.html にアクセス
現在、履歴データは公開設定ですが、認証を必要にできます:
# 履歴データを非公開に設定
gsutil acl ch -d AllUsers gs://fujimino-ophthalmology-reservations/history/**
# サービスアカウントのみアクセス可能に
gsutil iam ch serviceAccount:YOUR_SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com:objectViewer \
gs://fujimino-ophthalmology-reservations
この場合、ダッシュボードからのアクセスには認証が必要になるため、 Cloud Run上でダッシュボードをホストする構成に変更する必要があります。
院内VPNを設定し、VPN接続時のみアクセス可能にする:
fujimino-ophthalmology-reservations バケットhistory/general/ フォルダに今日の日付のJSONファイルがあるか確認3年以上経過したデータを削除したい場合:
# 2021年のデータを削除する例
gsutil rm gs://fujimino-ophthalmology-reservations/history/general/2021-*.json
gsutil rm gs://fujimino-ophthalmology-reservations/history/shiya/2021-*.json
| 項目 | 詳細 |
|---|---|
| フロントエンド | HTML + JavaScript (Vanilla) |
| チャートライブラリ | Chart.js |
| データソース | Cloud Storage (JSON) |
| 更新頻度 | 1分ごと(Cloud Run稼働時) |
| 保存期間 | 最大3年 |