How dev-strzx9/sop-template works
SOP Studio is a browser-based SOP editor backed by a FastAPI service and external PostgreSQL. Users open the editor, browse or search documents, open and edit a SOP, then save a new version; the server validates and derives searchable fields, resolves cross-SOP references, and persists document/version data. Separate capabilities include version history and diffs, edit locks, reference browsing, and the flowchart editor. The graph reflects the README and sampled source; unsampled implementation details are omitted where relationships are not evidenced.
Main entry points: main.py FastAPI app · sops.py Document API · db.py DB connection pool · versions.py Version history
Components 21
Editor
- SOP Studio editor
static/sop/sopstudio.html - Flowchart editor
static/sop/flowchart.html
API service
- Server startup
app.py - FastAPI app
app/main.py - User header
app/core/deps.py - Error responses
app/core/errors.py - Runtime settings
app/core/config.py - Health schemas
app/core/schemas.py
SOP domain
- Document API
app/sop/sops.py - Document validation
app/sop/derive.py - SOP references
app/sop/refs.py - Shared SOP helpers
app/sop/common.py - Version history
app/sop/versions.py - Edit locks
app/sop/locks.py - SOP API schemas
app/sop/schemas.py
Persistence
- DB connection pool
app/core/db.py - Schema setup
app/core/apply_schema.py - PostgreSQL
- SOP tables
sql/sop/schema.sql - Schema migrations
sql/sop/migrations
Other components
- SOP editor user
Connections 34
- SOP editor user → SOP Studio editor: opens
README.md - SOP Studio editor → FastAPI app: uses API
README.md - SOP editor user → Flowchart editor: edits flows
- Server startup → FastAPI app: starts
- FastAPI app → Runtime settings: loads settings
app/main.py - FastAPI app → DB connection pool: opens pool
app/main.py - FastAPI app → User header: guards APIs
app/main.py - FastAPI app → Error responses: installs handlers
app/main.py - FastAPI app → Health schemas: returns health
app/main.py - FastAPI app → Document API: mounts router
app/main.py - FastAPI app → SOP Studio editor: serves page
README.md - FastAPI app → DB connection pool: pings
app/main.py - DB connection pool → Runtime settings: uses settings
app/core/db.py - DB connection pool → PostgreSQL: connects
README.md - Schema setup → Runtime settings: reads connection
app/core/apply_schema.py - Schema setup → PostgreSQL: applies schema
README.md - Schema setup → SOP tables: loads design
- Schema setup → Schema migrations: applies changes
- Document API → DB connection pool: queries
app/sop/sops.py - Document API → Document validation: validates
app/sop/sops.py - Document API → SOP references: resolves references
app/sop/sops.py - Document API → Shared SOP helpers: uses helpers
app/sop/sops.py - Document API → SOP API schemas: uses models
app/sop/sops.py - Version history → DB connection pool: queries
app/sop/versions.py - Version history → SOP references: loads references
app/sop/versions.py - Version history → Shared SOP helpers: uses helpers
app/sop/versions.py - Version history → SOP API schemas: uses models
app/sop/versions.py - Edit locks → DB connection pool: queries
app/sop/locks.py - Edit locks → User header: gets user
app/sop/locks.py - Edit locks → Shared SOP helpers: uses helpers
app/sop/locks.py - Edit locks → SOP API schemas: uses models
app/sop/locks.py - Shared SOP helpers → SOP API schemas: returns lock model
app/sop/common.py - Document API → Error responses: raises API errors
app/sop/sops.py - Document validation → Error responses: raises validation errors
app/sop/derive.py