joseph-data commited on
Commit
d7ca74c
·
verified ·
1 Parent(s): 24dcdf9

Sync from GitHub via hub-sync

Browse files
Files changed (1) hide show
  1. README.md +93 -1
README.md CHANGED
@@ -12,4 +12,96 @@ license: mit
12
 
13
  <p align="left">
14
  <img src="logos/lab.svg" alt="AI-Econ Lab logo" width="200" height="">
15
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  <p align="left">
14
  <img src="logos/lab.svg" alt="AI-Econ Lab logo" width="200" height="">
15
+ </p>
16
+
17
+ This repository builds and deploys a Shiny dashboard for exploring monthly Swedish
18
+ employment by occupation alongside DAIOE measures of AI exposure. The deployed app is
19
+ packaged with Docker and is intended to sync to Hugging Face Spaces from the `main`
20
+ branch.
21
+
22
+ The dashboard reads `data/scb_months_lvl1.parquet`, filters observations by year, sex,
23
+ occupation, AI exposure metric, and employment-change horizon, then shows summary value
24
+ boxes, a Plotly scatter plot, and the filtered data table.
25
+
26
+ ## Runtime Files
27
+
28
+ The deployable app is intentionally small:
29
+
30
+ - `app.py` defines the Shiny Express app.
31
+ - `_brand.yml` defines the Shiny theme and points to the lab logo.
32
+ - `logos/lab.svg` is shown in the app sidebar and README.
33
+ - `data/scb_months_lvl1.parquet` is the app dataset.
34
+ - `Dockerfile`, `.dockerignore`, `pyproject.toml`, and `uv.lock` define the containerized runtime.
35
+
36
+ ## Local Development
37
+
38
+ Install dependencies with `uv`:
39
+
40
+ ```bash
41
+ uv sync
42
+ ```
43
+
44
+ Run the app locally:
45
+
46
+ ```bash
47
+ uv run shiny run app.py --reload
48
+ ```
49
+
50
+ Or run with the project virtual environment directly:
51
+
52
+ ```bash
53
+ .venv/bin/python -m shiny run app.py --reload
54
+ ```
55
+
56
+ ## Docker
57
+
58
+ Build the image:
59
+
60
+ ```bash
61
+ docker build -t ai-econ-daioe-months .
62
+ ```
63
+
64
+ Run it locally:
65
+
66
+ ```bash
67
+ docker run --rm -p 7860:7860 ai-econ-daioe-months
68
+ ```
69
+
70
+ The container serves the app on `http://127.0.0.1:7860`.
71
+
72
+ ## Branch Workflow
73
+
74
+ This repository uses separate branches for each stage of the data and deployment
75
+ pipeline.
76
+
77
+ | Branch | Purpose | Main output |
78
+ | --- | --- | --- |
79
+ | `scb_pull` | Pulls or prepares the monthly SCB employment data. The `SCB Pull -> DAIOE Pull` workflow runs `main.py` on this branch. | `data/scb_months.parquet` |
80
+ | `daioe_pull` | Receives the SCB output and enriches or merges it with DAIOE exposure data. The `DAIOE Pull -> Development` workflow runs `main.py` here. | `data/scb_months_lvl1.parquet` |
81
+ | `development` | Integration branch for the merged dataset and deployable app files before promotion. The `Development -> Main` workflow promotes the deploy bundle from here. | deploy-ready app files |
82
+ | `main` | Production/deployment branch. This branch contains the Dockerized Shiny app and syncs to Hugging Face Spaces. | running dashboard |
83
+
84
+ The pipeline is therefore:
85
+
86
+ ```text
87
+ scb_pull -> daioe_pull -> development -> main -> Hugging Face Spaces
88
+ ```
89
+
90
+ ## GitHub Actions
91
+
92
+ The repository contains four workflows:
93
+
94
+ - `.github/workflows/01_scb_pull_to_daioe_pull.yml` builds the base SCB parquet and pushes it to `daioe_pull`.
95
+ - `.github/workflows/02_daioe_pull_to_development.yml` builds the DAIOE-enriched parquet and pushes it to `development`.
96
+ - `.github/workflows/03_development_to_main.yml` promotes deployable app files to `main`.
97
+ - `.github/workflows/sync_to_hub.yml` syncs `main` to the Hugging Face Space `joseph-data/app_months`.
98
+
99
+ The scheduled workflows run daily at `00:00 UTC`, and each can also be run manually
100
+ with `workflow_dispatch`.
101
+
102
+ ## Data Shape
103
+
104
+ The app dataset currently has monthly occupation-level rows with employment counts,
105
+ absolute and percentage changes over 1, 3, and 6 months, and multiple DAIOE exposure
106
+ families. The Shiny app uses weighted average DAIOE columns matching
107
+ `daioe_*_wavg` for its exposure selector.