This project is a web application that combines a hospital locator and a chatbot powered by OpenAI's GPT API. The backend is implemented in Python using Flask, and the frontend is built using ReactJS with Tailwind CSS, Next.js, and TypeScript.
-
Backend:
- Flask (Python web framework)
- Geocoder library
- Requests library
- Nominatim API (OpenStreetMap)
-
Frontend:
- ReactJS
- Tailwind CSS
- Next.js
- TypeScript
- HTML5
- CSS3
- JavaScript
-
Chatbot:
- OpenAI GPT API
- Navigate to the frontend directory:
Copy code
cd frontend- Install dependencies:
Copy code
npm install- Run the React app:
Copy code
npm startThe React app will start, and you can access it at http://localhost:3000/.
-
Ensure you have Python installed on your system. If not, download and install it from python.org.
-
Set up a virtual environment (optional but recommended):
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt- Run the Flask app:
python app.pyThe Flask app will start, and you can access it at http://127.0.0.1:5000/nearest_hospitals.
- The web app includes a hospital locator feature.
- Users can find the 10 nearest hospitals based on their current location.
- The list includes distances, and clicking on a hospital shows it on an embedded map with directions.
- app.py: Main Flask application file.
- main.py: Contains functions for distance calculation, location retrieval, and hospital search.
- frontend/src/App.tsx: Main React component.
- frontend/src/pages/api/hospitals.ts: API endpoint for hospital data.
- frontend/src/pages/index.tsx: Homepage component.
- frontend/public/index.html: HTML template for the React app.
- Make sure the backend Flask app is running before accessing the frontend.
- Modify API endpoints in the React app if Flask app runs on a different port.