|
1 | | ---8<-- "README.md" |
| 1 | +# Fact Check-in |
| 2 | + |
| 3 | +REST API to validate conference attendees using multiple ticketing systems through a modular backend architecture. |
| 4 | + |
| 5 | +## Supported Ticketing Systems |
| 6 | + |
| 7 | +- **Tito** - Default backend with native activity support |
| 8 | +- **Pretix** - Full integration with category-based attribute mapping |
| 9 | + |
| 10 | +## Quick Start |
| 11 | + |
| 12 | +#### Build-In `attributes` |
| 13 | + |
| 14 | +The following attributes are built-in and default toi `False`: |
| 15 | + |
| 16 | +- is_onsite |
| 17 | +- is_remote |
| 18 | +- online_access |
| 19 | +- is_speaker |
| 20 | +- is_sponsor |
| 21 | +- is_volunteer |
| 22 | +- is_organizer |
| 23 | +- is_guest |
| 24 | + |
| 25 | +### 0. Ticketing System Setup: in Pretix |
| 26 | + |
| 27 | +It's important to follow a base structure when setting up the tickets in pretix already. |
| 28 | + |
| 29 | +Roles can bes assigned via: |
| 30 | + |
| 31 | +#### 1. Ticket categories ("Product categories" in Pretix) |
| 32 | + |
| 33 | +The category defines on-site and remote access baseline (e.g. attributes: is_remote, is_onsite, online_access) |
| 34 | + |
| 35 | +#### 2. Tickets including variations ("Products" in Pretix) |
| 36 | + |
| 37 | +This will update the attributes set in 1. |
| 38 | + |
| 39 | +A usual use case is to add is_speaker for speaker tickets for example. |
| 40 | + |
| 41 | +#### 3. Order ID ('ABCDE-1') ("Orders" in Pretix, note one order can have multiple items 'ABCDE-1, 'ABCDE-2',…) |
| 42 | + |
| 43 | +This will update the attributes set in 1. and 2. |
| 44 | + |
| 45 | +This is mostly used to handle multiple roles if a person is: |
| 46 | + |
| 47 | +- organizer_and_speaker: The person is an organizer and gives a talk. |
| 48 | +- organizer_and_sponsor: The person is an organizer and the employer is also sponsor. |
| 49 | +- speaker_and_sponsor: The person is a speaker and the employer is also sponsor. |
| 50 | +- speaker_add_keynote: The person is a keynote speaker. |
| 51 | +- add_speaker: The person is a speaker but has a non-speaker ticket for some reason. |
| 52 | + |
| 53 | +This is a **direct** assignment for that one ticket for that **one** person |
| 54 | + |
| 55 | +#### Access rights Assignment |
| 56 | + |
| 57 | +Access rights are assigned in the following order: |
| 58 | + |
| 59 | +1. Ticket category |
| 60 | +2. Ticket ID |
| 61 | +3. Order ID |
| 62 | + |
| 63 | +Any step might change attributes. The best practice is to only add access, i,e. setting attributes to True. A mix of adding and removing |
| 64 | +access will be confusing. |
| 65 | + |
| 66 | + |
| 67 | +#### **Pitfalls** |
| 68 | + |
| 69 | +##### Use case: Social Event |
| 70 | + |
| 71 | +You grant all ticket holders access to remote attendance `online_access: True`. |
| 72 | +But there are also social event tickets available for a +1, social event tickets does not include `online_access` |
| 73 | + |
| 74 | +- put event tickets in own category, e.,g. Social Event |
| 75 | + |
| 76 | +```yaml |
| 77 | +pretix_mapping: |
| 78 | + categories: |
| 79 | + by_id: |
| 80 | + 999: # ID of social event category |
| 81 | + online_access: False |
| 82 | + # OR exclude one or multiple ticket IDs |
| 83 | + by_ticket_id: |
| 84 | + 8888: # ID of social event ticket |
| 85 | + online_access: False |
| 86 | +``` |
| 87 | +
|
| 88 | +##### ⚠️: Change of Category |
| 89 | +
|
| 90 | +The category can very easily be changed in the Pretix backend. |
| 91 | +Other people might do that to: |
| 92 | +
|
| 93 | +- get a nicer look on the stats |
| 94 | +- improve the ticket shop order. |
| 95 | +
|
| 96 | +### 1. Install Dependencies |
| 97 | +
|
| 98 | +```bash |
| 99 | +# Requires Python 3.12+ |
| 100 | +uv pip install -e . |
| 101 | +``` |
| 102 | + |
| 103 | +### 2. Configure Ticketing System |
| 104 | + |
| 105 | +**Option A: Tito (Default)** |
| 106 | + |
| 107 | +```bash |
| 108 | +# Create .env file |
| 109 | +TITO_TOKEN="your_secret_token" |
| 110 | +ACCOUNT_SLUG="account_slug_from_tito" |
| 111 | +EVENT_SLUG="event_slug_from_tito" |
| 112 | +``` |
| 113 | + |
| 114 | +**Option B: Pretix** |
| 115 | + |
| 116 | +```bash |
| 117 | +# Create .env file |
| 118 | +PRETIX_TOKEN="your_pretix_api_token" |
| 119 | +PRETIX_BASE_URL="https://pretix.eu/api/v1" |
| 120 | +PRETIX_ORGANIZER_SLUG="your_organizer_slug" |
| 121 | +PRETIX_EVENT_SLUG="your_event_slug" |
| 122 | + |
| 123 | +# Set backend (environment variable takes precedence over config file) |
| 124 | +TICKETING_BACKEND=pretix |
| 125 | +``` |
| 126 | + |
| 127 | +### 3. Configure Event Mapping (Pretix only) |
| 128 | + |
| 129 | +Edit `event_config.yml` to map your event's ticket categories and special roles: |
| 130 | + |
| 131 | +```yaml |
| 132 | +# Set backend |
| 133 | +TICKETING_BACKEND: pretix |
| 134 | + |
| 135 | +pretix_mapping: |
| 136 | + categories: |
| 137 | + by_id: |
| 138 | + 227668: # Your category ID |
| 139 | + is_onsite: true |
| 140 | + online_access: true |
| 141 | + |
| 142 | + by_ticket_id: |
| 143 | + 819314: # Speaker ticket ID |
| 144 | + is_speaker: true |
| 145 | + |
| 146 | + # Special multi-role assignments |
| 147 | + speaker_and_sponsor: |
| 148 | + - "C3UAP-1" # Ticket code |
| 149 | +``` |
| 150 | +
|
| 151 | +### 4. Run the Application |
| 152 | +
|
| 153 | +**Option A: Direct Run** |
| 154 | +
|
| 155 | +```bash |
| 156 | +# IMPORTANT: Use single worker only! |
| 157 | +uvicorn app.main:app --port 8080 --host "0.0.0.0" |
| 158 | +``` |
| 159 | + |
| 160 | +**Option B: Docker** |
| 161 | + |
| 162 | +```bash |
| 163 | +# Set environment variables in .env file or export them |
| 164 | +export TITO_TOKEN="your_token" |
| 165 | +export ACCOUNT_SLUG="your_account" |
| 166 | +export EVENT_SLUG="your_event" |
| 167 | + |
| 168 | +# Build and run |
| 169 | +docker-compose up --build |
| 170 | + |
| 171 | +# Or run pre-built image |
| 172 | +docker-compose up |
| 173 | +``` |
| 174 | + |
| 175 | +**Note**: Startup takes ~30 seconds while loading ticket data. |
| 176 | + |
| 177 | +**API Documentation**: Once running, visit: |
| 178 | + |
| 179 | +- Interactive API docs: http://localhost:8080/docs |
| 180 | +- ReDoc: http://localhost:8080/redoc |
| 181 | + |
| 182 | +## Features |
| 183 | + |
| 184 | +- **Modular Backend Architecture**: Easily switch between ticketing systems or add new ones |
| 185 | +- **Dynamic Configuration**: Backend selection via environment variables or config files |
| 186 | +- **Smart Validation**: |
| 187 | + - Validate attendees by ticket code + name (with fuzzy matching) |
| 188 | + - Validate attendees by email |
| 189 | + - Configurable name matching thresholds |
| 190 | +- **Flexible Attribute Mapping**: |
| 191 | + - Tito: Native activity support |
| 192 | + - Pretix: Category and product name-based mapping |
| 193 | +- **Special Attendee Types**: Automatic detection of speakers, sponsors, volunteers, organizers |
| 194 | +- **Access Level Detection**: Distinguish between on-site, remote, and online attendees |
| 195 | +- **Day Pass Support**: Handle day-specific access (Monday, Tuesday, etc.) |
| 196 | + |
| 197 | +## Backend Architecture |
| 198 | + |
| 199 | +The application uses a modular backend system that allows seamless switching between different ticketing platforms: |
| 200 | + |
| 201 | +- **Abstract Interface**: `TicketingBackend` base class defines the contract |
| 202 | +- **Dynamic Loading**: Backends are loaded at runtime based on configuration |
| 203 | +- **Consistent API**: Same REST endpoints work with any backend |
| 204 | +- **Easy Extension**: Add new backends by implementing the interface |
| 205 | + |
| 206 | +## API Endpoints |
| 207 | + |
| 208 | +- `POST /tickets/validate_name/` - Validate by ticket ID and name |
| 209 | +- `POST /tickets/validate_email/` - Validate by email |
| 210 | +- `GET /tickets/refresh_all/` - Force reload ticket data |
| 211 | +- `GET /healthcheck/alive` - Health check |
| 212 | + |
| 213 | +## Development |
| 214 | + |
| 215 | +```bash |
| 216 | +# Install with dev dependencies |
| 217 | +uv pip install -e . |
| 218 | + |
| 219 | +# Set up pre-commit hooks |
| 220 | +pre-commit install --hook-type pre-commit --hook-type pre-push |
| 221 | + |
| 222 | +# Run tests |
| 223 | +pytest |
| 224 | + |
| 225 | +# Run linting/formatting |
| 226 | +ruff check . --fix |
| 227 | +ruff format . |
| 228 | +``` |
| 229 | + |
| 230 | +## Agentic API |
| 231 | + |
| 232 | +This project was partially updated with Claude CLI. Instructions for Claude are in [CLAUDE.md](CLAUDE.md) |
| 233 | + |
| 234 | +## Documentation |
| 235 | + |
| 236 | +- [Developer Guide](DEVELOPER.md) - Development setup and guidelines |
| 237 | +- [API Documentation](http://localhost:8080/docs) - Interactive API docs (when running) |
| 238 | + |
| 239 | + |
| 240 | +# Other |
| 241 | + |
| 242 | +There are issues of the library that created the social cards on macOS, the cairo svg library is required: `brew install cairo`. |
| 243 | +Even if installed cairo might not be found. Fixes: |
| 244 | + |
| 245 | +- `export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib` |
| 246 | +- Add a symlink in project root: `ln -s /opt/homebrew/opt/cairo/lib/libcairo.2.dylib` |
0 commit comments