Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jhonyes04/new-wayfy/llms.txt

Use this file to discover all available pages before exploring further.

WayFy’s community review system lets authenticated users contribute ground-truth accessibility data for any OpenStreetMap place. Each place (identified by its osm_id) holds one canonical review that any logged-in user can create or update, keeping the data current without fragmentation. Reviews combine a wheelchair accessibility rating, boolean feature flags, a freetext description, and up to five photos — giving travelers the verified detail they need before visiting a place.

How Reviews Work

Every review is tied to an osm_id — the unique OpenStreetMap identifier for a node, way, or relation. WayFy enforces a one review per place rule: submitting a review for an osm_id that already has data performs an upsert, updating all fields in place. The last_modified_by_id column records which authenticated user made the most recent edit.
The osm_id field is always stored as a string, even when it looks like a number. Use the same format consistently across favorites, reviews, and trip day places.

Wheelchair Rating

The core of every review is the wheelchair field, which uses the same vocabulary as OpenStreetMap:
ValueMeaning
yesFully accessible — step-free entry, adequate space throughout
limitedPartially accessible — some barriers exist but access is possible
noNot accessible — significant barriers prevent independent access
This value drives the color-coded markers on the Accessibility Map and the activeFilters state in the global store.

Accessibility Feature Flags

Beyond the overall wheelchair rating, reviews include boolean flags for specific accessibility features:
FieldDescription
has_rampRamp present at the entrance
has_elevatorElevator available (for multi-floor venues)
has_accessible_toiletAccessible/adapted toilet on-site
has_accessible_parkingAccessible parking spaces near the venue
automatic_doorAutomatic or power-assisted door at the entrance
These flags are displayed in the OsmAccessibilitySection and CommunityReviewSection components inside the map’s place detail panel.

Submitting a Review

Send a POST request to /api/accessibility/:osm_id with a JSON body. The endpoint creates a new review if none exists, or updates all fields if one already does.
curl -X POST http://localhost:3001/api/accessibility/1234567 \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "wheelchair": "yes",
    "has_ramp": true,
    "has_elevator": false,
    "has_accessible_toilet": true,
    "has_accessible_parking": false,
    "automatic_door": true,
    "description": "Wide doorways, ramp at main entrance, accessible toilet on ground floor.",
    "place_name": "Museo del Prado",
    "osm_type": "way"
  }'
A successful response returns the full review object:
{
  "id": 42,
  "osm_id": "1234567",
  "osm_type": "way",
  "place_name": "Museo del Prado",
  "last_modified_by_id": 7,
  "last_modified_by_name": "Maria García",
  "wheelchair": "yes",
  "has_ramp": true,
  "has_elevator": false,
  "has_accessible_toilet": true,
  "has_accessible_parking": false,
  "automatic_door": true,
  "description": "Wide doorways, ramp at main entrance, accessible toilet on ground floor.",
  "photos": [],
  "created_at": "2025-01-15T10:30:00",
  "updated_at": "2025-01-15T10:30:00"
}

Uploading Photos

Photos are uploaded separately after a review exists. Send a POST request to /api/accessibility/:review_id/photos as multipart/form-data with the field name photos. You can upload multiple files in a single request. Constraints:
  • Maximum 5 photos per place
  • Accepted formats: png, jpg, jpeg, webp
  • Photos are stored on Cloudinary; only the filename/public_id is saved in the database
curl -X POST http://localhost:3001/api/accessibility/42/photos \
  -H "Authorization: Bearer <your_token>" \
  -F "photos=@entrance.jpg" \
  -F "photos=@toilet.webp"
Response returns an array of created photo objects:
[
  {
    "id": 15,
    "user_id": 7,
    "url": "/api/accessibility/photos/1736934600_7_0.jpg",
    "caption": "entrance.jpg",
    "created_at": "2025-01-15T10:35:00"
  }
]
Photos can be deleted by their uploader using DELETE /api/accessibility/photos/:photo_id. Only the user who uploaded the photo can delete it.

Reading Reviews

Get aggregated review data

GET /api/accessibility/:osm_id returns the review for a place along with a consensus summary. Because WayFy enforces one review per osm_id via upsert, total_reviews is always 0 or 1 and wheelchair_consensus equals the single review’s wheelchair value (or null if none exists yet).
{
  "osm_id": "1234567",
  "total_reviews": 1,
  "wheelchair_consensus": "yes",
  "wheelchair_counts": {
    "yes": 1,
    "limited": 0,
    "no": 0
  },
  "reviews": [...]
}
wheelchair_consensus is determined by max(counts, key=counts.get) — the value with the highest count wins. The map uses GET /api/accessibility/wheelchair-map to fetch a {osm_id: wheelchair} dictionary for all reviewed places at startup, overlaying community ratings on top of raw OSM data.

Get a single place review

GET /api/accessibility/:osm_id/review returns the canonical review for a place, or 404 if none exists yet.

Community Pins

In addition to reviewing existing OSM places, authenticated users can submit entirely new place pins that don’t exist in OpenStreetMap yet. These are managed through the /api/places endpoints.
1

User submits a pin

A logged-in user POST /api/places/ with the place name, coordinates, category, and label. The pin is created with status: "pending".
2

Pin appears on the user's map

The submitting user sees their own pending pin on the map via the community-pending Mapbox layer. Other users do not see it yet.
3

Admin reviews and approves

An admin reviews the submission at /admin/places (Flask-Admin panel) or via PATCH /api/places/:id/status and sets status: "approved".
4

Pin goes live for everyone

Approved pins appear as the community-approved layer on the map for all users.
The admin moderation panel at /admin/places is built with Flask-Admin. Only users with is_admin: true in their JWT claims can access it.

How Community Data Overlays OSM Data

The Accessibility Map renders four distinct Mapbox GL layers in this order:
  1. clusters / unclustered-point — OSM wheelchair data fetched via the Overpass API
  2. community-approved — admin-approved community pins from /api/places
  3. community-pending — the current user’s own unmoderated pins
When a user opens a place detail panel, the CommunityReviewSection component fetches any existing review from /api/accessibility/:osm_id and displays it alongside the raw OSM tags from the OsmAccessibilitySection. This gives travelers both the structured OSM data and the richer community-validated information in a single view.

Build docs developers (and LLMs) love