# Permit Desk

**permit-desk.infinity-sdg.com** — building and land-use permitting for a local government. An AI does the first completeness screen; staff make every decision.

```
applicant + parcel + permit type → application (draft)
  → submit ─ needs documents
  → screening ─ AI drafts "complete / incomplete, what's missing, how sure"
               staff confirm or override it
  → accept (needs a staff-confirmed complete screening)  ·  or return incomplete → resubmit
  → discipline reviews: building, zoning, fire, environmental, historic …
       approve  ·  corrections → re-review
  → approve (every review approved)  ·  or deny, with a reason
  → fees: pay (receipt) or waive (reason)
  → issue (permit number, expiry; fees settled)
  → inspections: pass · fail (notes) → reschedule
  → finalize (passed final inspection)   ·   nightly: unfinaled permits past expiry expire
```

## What it enforces

| Rule | Why |
|---|---|
| Submit needs at least one document | No empty applications in the queue |
| Accept needs a **staff-confirmed** complete screening | The AI triages; a person decides |
| An incomplete screening must list what's missing; an AI screening must report its confidence | Applicants get actionable feedback; staff see how sure the model was |
| Flood-zone parcels need an elevation survey before acceptance | Floodplain compliance |
| Approve needs every discipline review approved | No partial sign-off |
| Deny, return, corrections, failed inspections and fee waivers all require a written reason | Every adverse action is explainable |
| Issue needs fees assessed and all paid or waived | No permit before payment |
| Inspections only on issued permits; finalize only after a passed final | Field work follows the paperwork |
| Contractors must give a license number | Licensing check at intake |

Every resource is audited. Applications keep a readable history of each state change, with its reason.

## Resources, views, roles

- **Resources:**
  - Reference data: permittype, parcel, applicant
  - The application itself
  - Application records: submittal, screening, review, fee, inspection
- **Views:**
  - `reviewQueue`, with an overdue flag
  - `screeningsToConfirm` (AI screens waiting for a person)
  - `inspectionsToday`
  - `pipeline`
- **Roles:**
  - `clerk`: intake, screening, fees
  - `reviewer`: plan review
  - `inspector`: field inspections
  - `supervisor`: approve, deny, waive
  - `admin`

## Demo data

The demo is a fictional county with 10 permit types and 14 applications, at least one in every state:

- 4 finaled: a new home, a deck, rooftop solar with a waived surcharge, and a flood-zone pool
- 2 issued with inspections under way, one with a failed framing inspection that has been rescheduled
- 1 approved, with fees outstanding
- 1 in review with building corrections
- 1 where staff **overrode** an AI screening that missed the energy report
- 1 AI screening waiting for staff
- 1 returned incomplete (missing owner authorization)
- 1 denied (lit sign in a historic district)
- 1 draft
- 1 withdrawn

All people, places and parcel numbers are invented, and phone numbers use the 555 range. To regenerate the data, run `python3 seeds/gen_seed.py`.

## Run it

```bash
scripts/kalos.sh validate    # static checks
scripts/kalos.sh start       # kalosd on :9212
scripts/kalos.sh verify      # live checks
```

By default, `KALOS_REPO` is `../kalos`.

Sign in with `admin` / `Admin123!`. The other users are `clerk1`, `reviewer1`, `inspector1` and `supervisor1`, all with password `Demo123!`.

## Front-end assets

Run `scripts/check-assets.sh` to verify the photographs, share card, icons and their page references. The generated photographs' provenance and full prompts are in [CREDITS.md](frontend/assets/photos/CREDITS.md).

To rebuild the share card and touch icon from the existing SVG mark, run `node scripts/render-brand-assets.mjs` with Node.js and Google Chrome installed. Set `CHROME_BIN` for another Chrome executable. Rendering uses local fonts, as the site does; no packages or network requests are needed.

## Reselling

This is an original ISDG product for municipal and county permitting offices. It has no customer data and no third-party branding.
