Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: How to use a map in Power BI
url: https://github.com/CodeWithBehnam/map-powerbi/blob/main/docs/power-bi-guide.md
about: Step-by-step guide and fixes for common problems. Check here first.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/map-problem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Problem with a map file
description: A map does not load, shows the wrong shapes or does not match your data.
labels: [bug]
body:
- type: input
id: file
attributes:
label: Which file?
description: Paste the path of the map file.
placeholder: maps/2021/lsoa/swansea/geographic/swansea-lsoa-2021.json
validations:
required: true
- type: textarea
id: happened
attributes:
label: What happened?
description: Say what you did and what you saw. A screenshot helps.
validations:
required: true
- type: textarea
id: expected
attributes:
label: What did you expect?
validations:
required: true
- type: input
id: version
attributes:
label: Power BI version
description: In Power BI Desktop, go to Help > About. Leave empty if you use another tool.
placeholder: "2.150.1234.0 (November 2026)"
- type: checkboxes
id: checks
attributes:
label: Checks
options:
- label: The map version (2001, 2011 or 2021) matches the area codes in my data.
- label: I compared my codes with **View map type key** in Power BI.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/map-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Request a map
description: Ask for another area, boundary level or version.
labels: [enhancement]
body:
- type: input
id: area
attributes:
label: Area
description: Which council or region?
placeholder: Bridgend
validations:
required: true
- type: dropdown
id: level
attributes:
label: Boundary level
multiple: true
options:
- Output Area (OA)
- LSOA
- MSOA
- Council outline
- Something else (describe below)
validations:
required: true
- type: input
id: version
attributes:
label: Version
placeholder: "2021"
- type: textarea
id: use
attributes:
label: What will you use it for?
description: A sentence is enough. It helps decide which map types to build.
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## What changed

<!-- One or two sentences. -->

## How it was checked

- [ ] `bun run typecheck`
- [ ] `bun run check`
- [ ] `bun run site:build`, and the dashboard looked right in a browser (if the site or maps changed)
- [ ] The README and guides still match (paths, area counts, map keys)

## Notes for the reviewer

<!-- Anything uncertain, skipped or worth a second look. -->
38 changes: 38 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

env:
BUN_VERSION: "1.4.4"

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Type check
run: bun run typecheck
# The maps are committed, so this validates them without downloading
# from ONS or needing R.
- name: Check map files, images and sample data
run: bun run check
- name: Build the site
run: bun run site:build
51 changes: 51 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy site

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

# Let a running deployment finish, and queue only the newest one behind it.
concurrency:
group: pages
cancel-in-progress: false

env:
BUN_VERSION: "1.4.4"

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build the site
run: bun run site:build
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: _site

deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
node_modules/
# Raw ONS downloads, rebuilt by `bun run build`
# Raw ONS downloads and computed hexagons, rebuilt by `bun run build`
.cache/
# Dashboard build output, rebuilt by `bun run site:build`
_site/
# Local Claude Code files
.claude/
CLAUDE.md
.DS_Store
41 changes: 0 additions & 41 deletions CLAUDE.md

This file was deleted.

68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Contributing

Thanks for helping. This page explains how to set up, what to run and what to check before you open a pull request.

## Ways to help

- Report a map that does not load or does not match your data: open a **Problem with a map file** issue.
- Ask for another area, level or version: open a **Request a map** issue.
- Fix or improve a guide in [`docs/`](docs).
- Improve the build scripts or the dashboard.

## Set up

You need [Bun](https://bun.sh).

```sh
git clone https://github.com/CodeWithBehnam/map-powerbi.git
cd map-powerbi
bun install
```

Rebuilding the hex maps also needs R 4.1 or newer with four packages. See [Install the R packages](docs/your-own-map.md#install-the-r-packages). You do not need R to work on guides, checks or the dashboard.

## Commands

| Command | What it does | Needs |
|---|---|---|
| `bun run typecheck` | Type-checks the scripts and the dashboard. | Bun |
| `bun run check` | Checks every map file, image and sample data file. | Bun |
| `bun run site:serve` | Builds the dashboard and serves it at `http://127.0.0.1:4173`. | Bun |
| `bun run data` | Rewrites the synthetic sample data. | Bun, a finished build |
| `bun run build` | Rebuilds `maps/` and `images/`, reusing downloads and hexagons in `.cache/`. | Bun, R |
| `bun run build:rehex` | Same, but computes the hexagons again. Slow. | Bun, R |
| `bun run build:refresh` | Downloads from ONS again and rebuilds everything. Slowest. | Bun, R, internet |

## How the repository fits together

| Path | What it holds | Edit by hand? |
|---|---|---|
| `scripts/sources.ts` | Which ONS layers, councils and hex methods to build. | Yes |
| `scripts/build.ts`, `scripts/hex.R` | The build. | Yes |
| `maps/`, `images/` | Generated map files and previews. | No. Change the scripts and rebuild. |
| `data/synthetic/` | Generated sample data. | No. Change `scripts/synthetic.ts`. |
| `site/` | The dashboard source. | Yes |
| `docs/` | The guides. | Yes |

Generated files are committed, because people download them straight from GitHub.

## Before you open a pull request

1. Run `bun run typecheck` and `bun run check`.
2. If you changed the maps or the dashboard, run `bun run site:serve` and look at the page.
3. If paths, area counts or map keys changed, update `README.md` and the guides.
4. Keep the change small and say what you checked in the pull request.

## Style

- British English in prose and comments.
- Commit messages follow [Conventional Commits](https://www.conventionalcommits.org), for example `fix: correct 2011 MSOA key name`.
- TypeScript is strict. Keep logic in pure functions and file or network access at the edges.
- Comments explain why, not what.

## Licences

- Code and guides: [MIT](LICENSE).
- Boundary data: [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/), from the Office for National Statistics. Keep the attribution in `README.md`.

By contributing, you agree that your work is released under the MIT licence.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Behnam Ebrahimi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading