Skip to content

1AM6ADA/DWaV-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

World Values Survey Explorer (v3 - SQLite + Historical Events)

Python FastAPI SQLite Docker

Interactive web app for exploring World Values Survey data across 108 countries and 7 waves (1981-2022).

This version is fully SQLite-based and now includes historical events per wave/country shown directly in the detail panel.

image

What Is New In This Version

  • Core WVS analytics run from wvs_data.db (map/trend/distribution/compare).
  • Added historical timeline from wvs_events_final.json.
  • Events are imported into SQLite table wvs_events and served from DB.
  • Added an in-panel event type filter for easier use by new users.
  • Added global wave context events (e.g. international events) when country-specific events are missing.

Features

  • Interactive world choropleth map by selected metric.
  • 7 themes and 40+ metrics with descriptions and scale guidance.
  • Country detail panel:
    • Trend across waves
    • Response distribution
    • Historical events for selected wave
    • Event type filter
  • Country comparison (line + Welzel radar).
  • Wave selector (specific wave or latest).
  • Fast country search.
  • Compare up to 10 countries simultaneously (trend line chart + Welzel radar)

Project Structure

├── backend/
│   ├── main.py
│   └── requirements.txt
├── frontend/
│   ├── index.html
│   ├── css/style.css
│   └── js/
│       ├── app.js
│       ├── map.js
│       ├── charts.js
│       └── compare.js
├── json_to_sqlite.py
├── wvs_events_final.json
├── Dockerfile
├── docker-compose.yml
├── wvs_data.db
└── README.md

Database

Primary SQLite database file: wvs_data.db (~580 MB)

Place wvs_data.db in the project root (DWaV-v3/).

Setup

  1. Download wvs_data.db from: DWaV database (Google Drive)
  2. Put it into project root.
  3. Run app (Docker or local).

Prerequisites

  • Docker Desktop (for containerized run) OR
  • Python 3.11+ with pip (for local run)
  • 1 GB free disk space (for database + Docker images)

Run the app

Docker

docker compose up --build

Local

pip install -r backend/requirements.txt
uvicorn backend.main:app --host 0.0.0.0 --port 8000

Open http://localhost:8000.

Historical Events Behavior

  • On backend startup, wvs_events table is created if missing.
  • If wvs_events is empty and wvs_events_final.json exists, events are imported automatically.
  • After import, events are read from SQLite (the app can run without JSON file if DB already has events).

API Endpoints

Endpoint Description
GET /api/countries Country metadata
GET /api/themes Themes and metrics
GET /api/waves Wave labels
GET /api/map/{theme}/{metric}?wave=N Map means per country
GET /api/trend/{theme}/{metric}?countries=USA,DEU Wave trends
GET /api/distribution/{theme}/{metric}/{cc}?wave=N Distribution for one country
GET /api/events/{cc}?wave=N&event_type=TYPE&limit=24 Historical events for country + global context
GET /api/country/{cc} Full country data

Configuration

Optional environment variables:

Variable Default Description
HOST 0.0.0.0 Server host
PORT 8000 Server port

Tech Stack

  • Backend: Python, FastAPI, SQLite
  • Frontend: HTML, CSS, Vanilla JS
  • Charts/Map: Chart.js, D3.js, TopoJSON
  • Deployment: Docker / Docker Compose

Data Sources

  • World Values Survey — official survey data (waves 1-7, 1981-2022)
  • Historical events — scraped from Wikipedia (country-specific and global events for each wave period)
  • Welzel indices — calculated based on Christian Welzel's methodology (2013)

Team

  • Muhammadjon Aslonov
  • Irina Napalkova
  • Amaliya Kharisova

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 46.6%
  • JavaScript 35.7%
  • CSS 11.6%
  • HTML 5.8%
  • Dockerfile 0.3%