Skip to content

Vanessa#49

Open
vfobid wants to merge 50 commits into
NEU-CS3200:mainfrom
YuYongJu:vanessa
Open

Vanessa#49
vfobid wants to merge 50 commits into
NEU-CS3200:mainfrom
YuYongJu:vanessa

Conversation

@vfobid

@vfobid vfobid commented Apr 19, 2026

Copy link
Copy Markdown

added last few pages (manage users, user profile, see acessibility)

MarkFontenot and others added 30 commits March 21, 2026 05:26
Merging 26S updates into main
… to match. will create a persona 1, etc branches for future changes
…vigation panel.Need to change method names within nav.py to match usage
…change method names in nav.py. ***API TEST CODE FROM TEMPLATE IS NOW PAGE 12
Blueprints: users (11 routes), reports (8), locations_tickets (10),
analytics (5). Registered in rest_entry alongside the template
blueprints (template cleanup deferred until DDL merges cleanly).

Also fixes api/.env.template DB_NAME to match the bostonability
schema. Template remnants left in place to minimize merge risk with
concurrent teammate branches.
README now describes Bostonability specifically: team, personas,
architecture, Docker quickstart, .env setup, and links to docs.

docs/rest-api-matrix.{md,html,docx} — revised matrix after cross-
checking Phase 2 user stories and SQL queries. Closes flagged
persona mistags, documents DDL gaps (action_log, past_report_status).

docs/api-reference.md — endpoint-level reference for the frontend
team, with request bodies, query params, and curl examples.

Project PDFs and local AI memory file remain untracked.
… data

Brings in 01-main-ddl.sql (the Bostonability schema) and 02-mock-data.sql
(Phase-2 sample data placeholder — Allison's real mock data will land
separately).

Note: this branch is missing the accessibility_ticket CREATE TABLE
(was present in bridget/add-ddl but dropped in bridget/fixed-ddl).
Followup commit restores it to match the Phase 2 ER diagram, SQL
queries, and the REST matrix.

# Conflicts:
#	README.md
The accessibility_ticket CREATE TABLE was accidentally dropped in
bridget/fixed-ddl but the mock-data file still INSERTs into it (15
rows). Without this restoration the MySQL container would fail to
boot. Definition verbatim from bridget/add-ddl@d4801d4 and Phase 2
Updated.pdf p.32.

Also adds action_log to back the GET /users/{id}/actions route
(Wilson-2 "view logs of user actions"). Columns match the
action_log entity in Wilson's persona ER diagram (Phase 2 p.18).
Allison's schema used ngo_db + CamelCase and diverged from the
Phase 2 submitted deliverable. Backend and graders both expect the
Phase 2 schema. Changes:

- Rename database ngo_db -> bostonability across all 16 files
- Rename CamelCase tables -> snake_case (Role, Permission, User,
  Report, etc.) to match Phase 2 DDL on pages 30-32
- Keep `user` backticked since it's a MySQL reserved word
- Convert 100 mock-data dates from M/D/YYYY -> YYYY-MM-DD (MySQL
  strict mode rejects the slash format)
- Add report.past_report_status column (Phase 2 SQL 2.5, 4.3)
- Add report.user_id column + FK (Phase 2 p.32; backend uses it)
- Add action_log table for Wilson-2 "view user action log" route
- New 17_backfill.sql: set report.user_id from accessibility_report
  so reports are linked to submitters after the schema change
- Fix one string-literal munge in 02_role.sql where my rename
  script accidentally backticked a 'User' role-name value
Adds:
- 4 Flask Blueprints (users, reports, locations_tickets, analytics)
  implementing 34 routes against the Phase 2 REST matrix
- api/.env.template DB_NAME update to bostonability
- README.md full Bostonability rewrite (team, personas, quickstart)
- docs/rest-api-matrix.{md,html,docx} — revised REST matrix
- docs/api-reference.md — endpoint-level reference

Also brings in Bridget's 01-main-ddl.sql and 02-mock-data.sql from
bridget/fixed-ddl. These are superseded by Allison's 16-file layout
(now reconciled to Phase 2 naming) and will be removed in the
followup commit to avoid duplicate INSERTs at container boot.
After merging addison/backend into main we had two competing layouts:
- Bridget's 01-main-ddl.sql + 02-mock-data.sql (2 files)
- Allison's 01_schema.sql + NN_tablename.sql (16 files, just reconciled
  to bostonability + snake_case)

Both DROP+CREATE the bostonability database and both INSERT mock data
into the same tables, so running both would cause duplicate-key errors
on container boot. Keeping Allison's 16-file layout because:
- It has the richer mock data (40 users, 125 location_obstructions)
- It's already on main as the team's established layout
- The reconciliation commit already aligns it with the Phase 2 spec
The Bridget DDL had a typo (demographics_ethinicity) that my users
blueprint inherited. Allison's schema has the correct spelling
and won out in the reconciliation, so the backend needs to match.
- description VARCHAR(500) -> TEXT (some Lorem Ipsum descriptions
  exceeded 500 chars, causing ER_DATA_TOO_LONG on init)
- ticket_time AM/PM strings -> 24-hour HH:MM:SS (MySQL strict mode
  rejects 12-hour clock format for TIME columns; converted 50 rows
  in 11_accessibility_ticket.sql)
- Add AUTO_INCREMENT to user.user_id, report.report_id,
  accessibility_ticket.ticket_id so POST routes can INSERT without
  specifying an id. Phase 2 DDL specifies these as AUTO_INCREMENT.

Verified via docker compose smoke test:
- MySQL boots with zero errors, all 16 tables populated
- GET /users returns 40 users; GET /analytics/issues-by-neighborhood
  returns 22 grouped rows; GET /locations/1 shows embedded obstructions
- POST /reports + DELETE /reports/{id} round-trip works
- PUT /reports/1 persists changes
- GET /analytics/export streams CSV correctly
adding frontend[O
Brings the bostonability schema closer to the Phase 2 submitted DDL
(pages 30-32). Changes (all verified non-breaking against existing
mock data via pre-check query):

- Add AUTO_INCREMENT to role, permission, disability, issue_type,
  location, obstructions, and disability_obstruction primary keys
- Add UNIQUE constraint on user.user_email (confirmed zero
  duplicates in current mock data)
- Add NOT NULL to report.report_date, report.report_status,
  accessibility_report.issue_type_id/report_status/user_id, and
  accessibility_ticket.ticket_status/ticket_date
- Add missing accessibility_report.report_date column (Phase 2 has
  it) and backfill from parent report.report_date in 17_backfill.sql
- Add ON DELETE CASCADE to all bridge-table FKs (user_role,
  user_disability, role_permission, location_obstruction,
  disability_obstruction) so deletes propagate per Phase 2
- Add ON DELETE CASCADE/RESTRICT on accessibility_report FKs
- Add ON DELETE SET NULL on accessibility_ticket FKs

Intentional deviations from Phase 2 kept:
- urgency INT (not VARCHAR) — matches Allison's mock data
- disability_obstruction surrogate PK — matches Allison's layout
- description TEXT (not VARCHAR(255)) — holds longer mock values
- action_log table added (appears in Phase 2 ER diagram for Wilson-2
  but not in Phase 2 DDL)

Smoke-tested: container boots clean, all 16 tables populated,
backfill sets report_date on 50/50 accessibility_report rows,
API GET /users still returns 40 users unchanged.
Phase 3 Requirements section 3c: "please remove any sample code/
files from the Project Repo that you are not directly using."

Deleted:
- api/backend/ngos/ (NGO sample blueprint)
- api/backend/simple/ (playlist + prediction demo)
- api/backend/ml_models/ (hypothetical ML model skeleton; we
  don't use ML in Bostonability)

Unregistered the corresponding Blueprints from rest_entry.py.

Smoke-tested: API still returns 200 on /users (40 users), old
template routes now correctly 404 (/ngo/ngos, /playlist).
Routes that SELECTed accessibility_ticket.ticket_time returned HTTP 500
because MySQL TIME values arrive in Python as datetime.timedelta, which
Flask's default JSON provider can't serialize.

Register a custom Flask JSON provider (BostonabilityJSONProvider) that
renders timedelta as an HH:MM:SS string. Uses Flask 2.3+'s
DefaultJSONProvider extension point, kept minimal.

Fixes the 4 routes that were 500ing:
- GET /tickets
- GET /tickets?status=Open
- GET /tickets/{id}
- GET /reports/{id} (LEFT JOINs accessibility_ticket)

Exhaustive 44-check route sweep now passes all checks end-to-end:
every route across users/reports/locations_tickets/analytics blueprints
returns correct HTTP status and valid JSON.
Routes that SELECTed accessibility_ticket.ticket_time returned HTTP 500
because MySQL TIME values arrive in Python as datetime.timedelta, which
Flask's default JSON provider can't serialize.

Register a custom Flask JSON provider (BostonabilityJSONProvider) that
renders timedelta as an HH:MM:SS string. Uses Flask 2.3+'s
DefaultJSONProvider extension point, kept minimal.

Fixes the 4 routes that were 500ing:
- GET /tickets
- GET /tickets?status=Open
- GET /tickets/{id}
- GET /reports/{id} (LEFT JOINs accessibility_ticket)

Exhaustive 44-check route sweep now passes all checks end-to-end:
every route across users/reports/locations_tickets/analytics blueprints
returns correct HTTP status and valid JSON.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants