joseph-data commited on
Commit
3dbcaaa
·
verified ·
1 Parent(s): e9e555d

Sync from GitHub via hub-sync

Browse files
Files changed (1) hide show
  1. README.md +92 -1
README.md CHANGED
@@ -8,4 +8,95 @@ app_file: app.py
8
  pinned: false
9
  ---
10
 
11
- # DAIOE Monthly Explorer: Swedish Occupations
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  pinned: false
9
  ---
10
 
11
+ # DAIOE Monthly Explorer: Swedish Occupations
12
+
13
+ An interactive dashboard that brings together monthly employment statistics from Statistics Sweden (SCB) and AI-exposure scores from the DAIOE framework. Built to support research into how AI may be reshaping labour market outcomes across Swedish occupations.
14
+
15
+ ## Features
16
+
17
+ **Single Occupation**
18
+ Inspect one occupation at a time. View a scrolling ribbon of all occupations, employment value boxes (all-sexes aggregate), an AI exposure bar chart ranked by percentile across sub-domains, a monthly employment change line chart, and an absolute employment count chart. An optional sex breakdown overlays per-sex lines on the employment charts.
19
+
20
+ **Compare Occupations**
21
+ Select up to five occupations side by side. Includes a summary table with employment and percentage changes, a radar chart comparing AI percentile scores across sub-domains, and a combined employment change line chart.
22
+
23
+ **Download Data**
24
+ Filter by year range, occupation, and sex, then export the underlying row-level data as CSV, Parquet, or Excel.
25
+
26
+ **About**
27
+ Data sources, key concept definitions, coverage details, and caveats.
28
+
29
+ ## Data Sources
30
+
31
+ | Source | Description |
32
+ | --- | --- |
33
+ | [Swedish Occupational Register, SCB](https://www.scb.se/en/finding-statistics/statistics-by-subject-area/labour-market/labour-force-supply/the-swedish-occupational-register-with-statistics/) | Monthly employment counts and changes by occupation and sex |
34
+ | [DAIOE Framework](https://www.ai-econlab.com/ai-exposure-daioe) | Data-driven AI Occupational Exposure scores across multiple AI capability sub-domains |
35
+
36
+ **Coverage:** Sweden, SSYK 2012 major groups (1-digit, 9 categories), updated monthly.
37
+
38
+ ## Tech Stack
39
+
40
+ - **[Shiny for Python](https://shiny.posit.co/py/)** (Express syntax) for the interactive UI
41
+ - **[Polars](https://pola.rs/)** for all data wrangling via lazy evaluation
42
+ - **[Plotly](https://plotly.com/python/)** for interactive charts
43
+ - **[Great Tables](https://posit-dev.github.io/great-tables/)** for styled summary tables
44
+ - **[uv](https://github.com/astral-sh/uv)** for dependency management
45
+ - **Docker** for containerised deployment on Hugging Face Spaces
46
+
47
+ ## Local Development
48
+
49
+ ```bash
50
+ # Install dependencies
51
+ uv sync
52
+
53
+ # Run the app with auto-reload
54
+ uv run shiny run app.py --reload
55
+
56
+ # Lint and format
57
+ uv tool run ruff check src/ app.py
58
+ uv tool run ruff format src/ app.py
59
+
60
+ # Build and run the Docker image
61
+ docker build -t ai-econ-daioe-months .
62
+ docker run --rm -p 7860:7860 ai-econ-daioe-months
63
+ ```
64
+
65
+ ## Project Structure
66
+
67
+ ```
68
+ app.py # Shiny Express app (UI + reactive graph)
69
+ src/
70
+ data.py # Parquet scan, input choices, markdown loading
71
+ constants.py # METRICS dict, AI column lists, exposure labels
72
+ calcs.py # Pure Polars query functions (no UI)
73
+ visuals.py # Plotly figure builders and value box renderer
74
+ utils.py # Great Tables rendering and download helpers
75
+ css/
76
+ ticker.css # Occupation ribbon / ticker styles
77
+ data/
78
+ scb_months_lvl1.parquet # Runtime dataset (auto-updated by CI)
79
+ md_files/
80
+ intro.md # Sidebar intro text
81
+ about.md # About tab content
82
+ .github/workflows/ # CI pipeline (see below)
83
+ ```
84
+
85
+ ## CI Pipeline
86
+
87
+ ```
88
+ scb_pull -> daioe_pull -> development -> main -> Hugging Face Spaces
89
+ ```
90
+
91
+ Each stage runs on push, daily cron at 00:00 UTC, or manual `workflow_dispatch`.
92
+
93
+ | Stage | Workflow | What it does |
94
+ | --- | --- | --- |
95
+ | `scb_pull` | `01_scb_pull_to_daioe_pull.yml` | Fetches SCB employment data, produces `scb_months.parquet`, commits to `daioe_pull` |
96
+ | `daioe_pull` | `02_daioe_pull_to_development.yml` | Merges DAIOE AI-exposure scores, produces `scb_months_lvl1.parquet`, commits to `development` |
97
+ | `development` | `03_development_to_main.yml` | Validates and promotes all deploy files to `main` |
98
+ | `main` | `sync_to_hub.yml` | Syncs `main` to the Hugging Face Space, triggering a Docker rebuild |
99
+
100
+ ## About the Project
101
+
102
+ Developed by the [AI-Econ Lab](https://www.ai-econlab.com) as part of ongoing research into the intersection of artificial intelligence and labour markets.