# openshift-roadshow/nationalparks-py architecture

> Architecture diagram of the GitHub repository openshift-roadshow/nationalparks-py, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openshift-roadshow/nationalparks-py
- Repository: https://github.com/openshift-roadshow/nationalparks-py

## Overview

This is a small Flask backend serving National Parks geolocation data from MongoDB. The main client workflow is a bounding-box request to `/ws/data/within`, which queries MongoDB and formats matching parks for JSON output; `/ws/data/all` provides the unfiltered alternative. A separate load endpoint imports the bundled dataset and creates the geospatial index. Health and service-information endpoints support monitoring and discovery. The runtime is concentrated in `wsgi.py`; relationships below are based on its excerpt and the README.

Main entry points: [`wsgi.py`](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py) (Collection access), [`nationalparks.json`](https://github.com/openshift-roadshow/nationalparks-py/blob/master/nationalparks.json) (Park dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_service["Flask service<br/>[wsgi.py]"]
  node_health["Health check<br/>[wsgi.py]"]
  node_info["Service info<br/>[wsgi.py]"]
  node_all["All parks<br/>[wsgi.py]"]
  node_within["Bounding-box search<br/>[wsgi.py]"]
end

subgraph group_data["Data handling"]
  node_load["Dataset loader<br/>[wsgi.py]"]
  node_format["Result formatter<br/>[wsgi.py]"]
  node_dataset["Park dataset<br/>[nationalparks.json]"]
end

subgraph group_storage["MongoDB access"]
  node_collection["Collection access<br/>[wsgi.py]"]
  node_mongodb[("MongoDB")]
end

node_client(("Parksmap client"))

node_client -->|"checks"| node_health
node_client -->|"requests info"| node_info
node_client -->|"requests load"| node_load
node_client -->|"requests parks"| node_all
node_client -->|"searches area"| node_within
node_load -->|"reads"| node_dataset
node_load -->|"inserts and indexes"| node_collection
node_all -->|"fetches all"| node_collection
node_within -->|"queries box"| node_collection
node_all -->|"formats results"| node_format
node_within -->|"formats results"| node_format
node_collection -->|"reads and writes"| node_mongodb

click node_service "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_health "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_info "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_load "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_all "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_within "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_format "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"
click node_dataset "https://github.com/openshift-roadshow/nationalparks-py/blob/master/nationalparks.json"
click node_collection "https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py"

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_service,node_health,node_info,node_all,node_within,node_client toneBlue
class node_load,node_format,node_dataset toneAmber
class node_collection,node_mongodb toneMint
```

## Components

### HTTP API

- [Flask service](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- [Health check](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- [Service info](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- [All parks](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- [Bounding-box search](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`

### Data handling

- [Dataset loader](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- [Result formatter](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- [Park dataset](https://github.com/openshift-roadshow/nationalparks-py/blob/master/nationalparks.json): `nationalparks.json`

### MongoDB access

- [Collection access](https://github.com/openshift-roadshow/nationalparks-py/blob/master/wsgi.py): `wsgi.py`
- **MongoDB**

### Other components

- **Parksmap client**

## Connections

- Parksmap client → Health check: checks (evidence: `README.adoc`)
- Parksmap client → Service info: requests info (evidence: `README.adoc`)
- Parksmap client → Dataset loader: requests load (evidence: `README.adoc`)
- Parksmap client → All parks: requests parks (evidence: `README.adoc`)
- Parksmap client → Bounding-box search: searches area (evidence: `README.adoc`)
- Dataset loader → Park dataset: reads (evidence: `wsgi.py`)
- Dataset loader → Collection access: inserts and indexes (evidence: `wsgi.py`)
- All parks → Collection access: fetches all (evidence: `wsgi.py`)
- Bounding-box search → Collection access: queries box (evidence: `wsgi.py`)
- All parks → Result formatter: formats results (evidence: `wsgi.py`)
- Bounding-box search → Result formatter: formats results (evidence: `wsgi.py`)
- Collection access → MongoDB: reads and writes (evidence: `wsgi.py`)
