An open API service indexing awesome lists of open source software.

https://github.com/smwa/wsdc_points_server

Server-rendered West Coast Swing (WSDC) competition points site — FastAPI + PostgreSQL, replacing the old static Jekyll site
https://github.com/smwa/wsdc_points_server

dance fastapi postgresql python west-coast-swing

Last synced: 9 days ago
JSON representation

Server-rendered West Coast Swing (WSDC) competition points site — FastAPI + PostgreSQL, replacing the old static Jekyll site

Awesome Lists containing this project

README

          

# WSDC Points — server

> The collected WSDC data can be downloaded at .

A server-rendered site for **West Coast Swing** competition data from the
[WSDC](https://worldsdc.com) registry: look up dancers' points and division
eligibility, browse past events and their competitors, and see upcoming
sanctioned events. It replaces an older Jekyll static-site + flat-file approach
with HTML rendered on the server from PostgreSQL.

## Stack

FastAPI · Jinja2 (server-rendered HTML, minimal progressive-enhancement JS) ·
PostgreSQL (`asyncpg`) · uvicorn · Docker.

## Quick start (Docker)

```bash
cp .env.example .env # add OPEN_WEATHER_MAP_API_KEY for event geocoding
docker compose up --build
```

This starts PostgreSQL, the app on , and the data
importer. The app/importer apply migrations on startup from the SQL baked into
the image (`python -m src.migrate`), so no source or initdb mount is needed on
the server. Credentials are `postgres:postgres` / db `wsdc` (dev only).

To load data without hitting WSDC, point the importer at the legacy cached files
and run a single offline pass (set `IMPORTER_OFFLINE=true` in `.env`):

```bash
docker compose run --rm importer python -m src.importer --once
```

## Pages

`/` home · `/dancers` · `/dancer/{id}` · `/events` · `/event/{id}` ·
`/event-competitors/{occurrence_id}` · `/upcoming-events` (+ `/wsdc_events.ics`) ·
`/dancers-over-time` · `/about`. `/health` is the JSON health check.

Feeds & data: `/feed/{feed_token}.xml` is a per-user RSS feed of your starred
dancers' newest points (the home page links it next to "Starred Dancers"), and
`/data.json` streams the whole dataset (the dancer/event/placement tables; the
private and operational tables are excluded) for anyone who wants to download it.

## Data importer

`python -m src.importer` fetches each dancer from WSDC and upserts it in its own
transaction, prioritising recent competitors and looping forever; `--once` runs a
single pass and `IMPORTER_OFFLINE=1` reads the legacy cache files instead of the
network. See [AGENTS.md](AGENTS.md) for the full design.

## Local development (without Docker)

```bash
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # set DATABASE_URL
./database/migrate.sh # needs DATABASE_URL in the environment
uvicorn src.main:app --reload
```

## More

[AGENTS.md](AGENTS.md) is the detailed reference (schema, importer internals,
theme conventions, deployment). The image is published to GHCR by
`.github/workflows/docker-publish.yml`.