Admin dashboard for managing billing records from a Google Sheet export.
- SQLite-backed records
- Signup/Signin with phone + 4-digit PIN
- OTP-based signup verification and PIN reset flow
- PIN policy + signin lockout controls + auth event logging
- Session login with role-based routing (
admin,encoder, orcustomer) - Server-side DataTables endpoint (search, sort, pagination)
- Filters: biller, transaction date range, due status
- CRUD: create, edit, delete records
- Transaction audit log for record state changes (create, update, delete, CSV import) with admin visibility
- CSV import endpoint for bulk loading sheet exports
- Duplicate detection by
txn_date + account + biller + amount(create, update, import) - Auto-generated unique reference code when missing
- Validation guards for due date and amount before save
- Phone validation: exactly 11 digits
- CP number validation: exactly 11 digits when provided
- Text normalization: form text values are standardized to uppercase before persistence
- Amount display formatting: comma separators with 2 decimal places on key views
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reloadOpen: http://127.0.0.1:8000/auth/signin
./scripts/dev.ps1 setup
./scripts/dev.ps1 run./scripts/dev.ps1 checkSignup now uses OTP verification before account creation. By default, OTP runs in local stub mode and logs the code in server output:
export OTP_PROVIDER=local
export OTP_TTL_SECONDS=300
export PIN_MAX_FAILED_ATTEMPTS=5
export PIN_LOCKOUT_MINUTES=15
export PIN_WEAK_LIST=0000,1111,1234,4321PIN recovery flow is available from Sign In via Forgot PIN (/auth/pin/reset).
Set admin phone numbers (comma-separated) so those users land on admin dashboard after login:
export ADMIN_PHONES=09171234567,09179998888If not listed, a signed-up user is treated as customer.
Set encoder phone numbers (comma-separated) so those users land on form-only page after login:
export ENCODER_PHONES=09175556666,09174443333encoder can access data entry form and create records, but not admin tables.
Headers supported (case-sensitive):
DATEorDATE/TIMEACCOUNTBILLERNAMENUMBERorCP NUMAMTorBILL AMTAMT2orLATE CHARGECHARGEorSERVICE CHARGETOTALCASHCHANGEDUE DATENOTESREFERENCE
A masked sample is included: sample_masked_records.csv
Use these files as your working system:
docs/WORKFLOW.mdfor the development loop and definition of donedocs/BACKLOG.mdforNOW / NEXT / LATERtask planningdocs/DECISIONS.mdfor architecture/product tradeoff history
Recommended cadence:
- Pick one
NOWitem and create a focused branch. - Build and verify with
./scripts/dev.ps1 check. - Update backlog + decisions, then commit with the task ID.