# aitullalimon/earthquake-risk-predictor---japan architecture

> Architecture diagram of the GitHub repository aitullalimon/earthquake-risk-predictor---japan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aitullalimon/earthquake-risk-predictor---japan
- Repository: https://github.com/aitullalimon/earthquake-risk-predictor---japan

## Overview

This repository is a Japanese-prefecture earthquake-risk web application: users choose a prefecture or enter coordinates, request a prediction, and view risk insights. The documented runtime pairs a static browser interface with an R Plumber API and a trained Random Forest model; the map also consumes USGS events and uses OpenStreetMap tiles. The README documents these capabilities and connections, but no source excerpts were available to verify finer-grained frontend or API behavior.

Main entry points: [`index.html`](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html) (Web app), [`Earthquake Risk Predictor model dev/api.R`](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/Earthquake%20Risk%20Predictor%20model%20dev/api.R) (Plumber API), [`Earthquake Risk Predictor model dev/rf_model_final.rds`](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/Earthquake%20Risk%20Predictor%20model%20dev/rf_model_final.rds) (Random Forest model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_webapp["Web app<br/>[index.html]"]
  node_riskinput["Risk inputs<br/>[index.html]"]
  node_languagehelp["Language and help<br/>[index.html]"]
  node_riskinsights["Risk insights<br/>[index.html]"]
  node_earthquakemap["Earthquake map<br/>[index.html]"]
end

subgraph group_prediction["Risk prediction"]
  node_api["Plumber API<br/>[api.R]"]
  node_model["Random Forest model<br/>[rf_model_final.rds]"]
end

subgraph group_mapdata["Map data"]
  node_usgs["USGS feed"]
  node_osm["OpenStreetMap"]
end

node_user(("User"))

node_user -->|"opens"| node_webapp
node_user -->|"provides inputs"| node_riskinput
node_webapp -->|"offers"| node_riskinput
node_webapp -->|"offers"| node_languagehelp
node_riskinput -->|"requests prediction"| node_api
node_api -->|"predicts with"| node_model
node_api -->|"returns prediction"| node_webapp
node_webapp -->|"shows"| node_riskinsights
node_usgs -->|"provides events"| node_earthquakemap
node_osm -->|"provides basemap"| node_earthquakemap
node_webapp -->|"shows"| node_earthquakemap

click node_webapp "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html"
click node_riskinput "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html"
click node_languagehelp "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html"
click node_riskinsights "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html"
click node_earthquakemap "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html"
click node_api "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/Earthquake%20Risk%20Predictor%20model%20dev/api.R"
click node_model "https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/Earthquake%20Risk%20Predictor%20model%20dev/rf_model_final.rds"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_riskinput,node_languagehelp,node_riskinsights,node_earthquakemap,node_user toneBlue
class node_api,node_model toneAmber
class node_usgs,node_osm toneMint
```

## Components

### Web interface

- [Web app](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html): `index.html`
- [Risk inputs](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html): `index.html`
- [Language and help](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html): `index.html`
- [Risk insights](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html): `index.html`
- [Earthquake map](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/index.html): `index.html`

### Risk prediction

- [Plumber API](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/Earthquake%20Risk%20Predictor%20model%20dev/api.R): `Earthquake Risk Predictor model dev/api.R`
- [Random Forest model](https://github.com/aitullalimon/earthquake-risk-predictor---japan/blob/main/Earthquake%20Risk%20Predictor%20model%20dev/rf_model_final.rds): `Earthquake Risk Predictor model dev/rf_model_final.rds`

### Map data

- **USGS feed**
- **OpenStreetMap**

### Other components

- **User**

## Connections

- User → Web app: opens
- User → Risk inputs: provides inputs
- Web app → Risk inputs: offers
- Web app → Language and help: offers
- Risk inputs → Plumber API: requests prediction
- Plumber API → Random Forest model: predicts with
- Plumber API → Web app: returns prediction
- Web app → Risk insights: shows
- USGS feed → Earthquake map: provides events
- OpenStreetMap → Earthquake map: provides basemap
- Web app → Earthquake map: shows
