Esandi Herath
Created July 30, 2023

BeyondBound Adventures

Developing an Assistance Request System application to prevent onboard inconveniences.

26

Things used in this project

Hardware components

Assistive Devices
×1
IoT Devices
×1
Smartphones and Tablets
×1

Software apps and online services

Mobile Application (iOS/Android)
Assistance Matching Algorithm
Real-Time Communication
Indoor Navigation Software
Database and Server
Machine Learning and AI
Community Platform
Localization Tools
Accessibility Testing Tools

Story

Read more

Code

User Registration API for Accessible Travel Platform

Python
This title reflects the purpose of the code, which is to handle user registration for a platform focused on accessible travel for individuals with mobility impairments.
from flask import Flask, request, jsonify

app = Flask(__name__)

# Simulated database to store user profiles
users = []

class User:
    def __init__(self, username, password, mobility_needs):
        self.username = username
        self.password = password
        self.mobility_needs = mobility_needs

@app.route('/register', methods=['POST'])
def register_user():
    data = request.get_json()
    username = data['username']
    password = data['password']
    mobility_needs = data['mobility_needs']
    
    # Check if the username is already taken (in a real system, you'd use a database for this)
    if any(user.username == username for user in users):
        return jsonify({"message": "Username already exists"}), 400
    
    new_user = User(username, password, mobility_needs)
    users.append(new_user)
    
    return jsonify({"message": "User registered successfully"}), 201

if __name__ == '__main__':
    app.run(debug=True)

Credits

Esandi Herath

Esandi Herath

2 projects • 0 followers

Comments