Safe-Sri-Lanka is a comprehensive mobile application specially developed for women's safety, designed to enhance security for female residents and visitors in Sri Lanka. The app features an SOS button for emergency situations, real-time location tracking, access to helplines, and an AI-powered chatbot for intelligent assistance. With additional features like danger zone alerts and relationship management, Safe-Sri-Lanka aims to provide women with peace of mind and immediate support when needed. This user-friendly interface empowers people to navigate their surroundings with confidence and access help quickly in potentially unsafe situations.
- Features
- Prerequisites
- Project Structure
- Database Setup
- Network Configuration
- Running the Application
- Troubleshooting
- Contributing
- License
- SOS Button: Instantly send your location and alert emergency contacts.
- Real-Time Location Tracking: Monitor your whereabouts in real-time.
- AI Chatbot: Get instant assistance through an agentic, RAG-based implementation that provides intelligent and context-aware support.
- Helpline Access: Direct access to various emergency and support helplines.
- Fake Call: Simulate incoming calls to manage personal situations discreetly.
- Customizable Settings: Tailor the app according to your preferences.
- Danger Zone Alerts: Receive notifications about nearby danger zones.
- Relationship Management: Connect with friends and family for enhanced safety.
- npm (Node package manager)
- Git
- Expo Go app on your mobile device
- Ballerina runtime (for backend development)
- MySQL database (version 5.7 or higher recommended)
-
api/: Contains the Ballerina backend code.
- safe-srilanka/: Main backend application directory.
-
apiControllers/: Contains TypeScript controllers for API interactions.
-
app/: Contains the React Native frontend components.
-
Python_backend/: Python backend services.
- Chatbots/: Chatbot implementation.
- Call and sms services/: Services for calls and SMS.
-
services/: Contains service layer for the application.
-
db.sql: SQL file for setting up the database schema.
-
Create a new database locally using the
db.sql
file provided in the project. -
Update the database configuration:
- Open
api/safe-srilanka/modules/database/database.bal
- Modify the
dbUsers
anddbPasswords
arrays with your local MySQL username and password.
- Open
For the application to communicate with the backend properly, you need to update the IP address in two files:
-
For the backend:
- Open
api/safe-srilanka/main.bal
- Locate the
const string backendIp
line - Change it to your PC's IP address
Example:
const string backendIp = "192.168.56.2";
- Open
-
For the frontend:
- Open
app/const.tsx
- Find the
BASE_URL
constant - Update it with your PC's IP address
Example:
const BASE_URL = 'http://192.168.56.2';
- Open
Note:
- The structure of these configurations is different between the backend and frontend files. Make sure to use the correct syntax for each.
- If you're using an emulator, use your PC's IP address.
- If you're using a physical device, use the Expo link shown in the terminal after running
npx expo start
.
-
Start the Ballerina backend: Navigate to the project root directory and run:
bal.bat run api\safe-srilanka
-
Start the Expo development server:
npx expo start
-
Launch the app on your device or emulator:
- On Android Emulator/Device: Press
a
in the terminal. - On iOS Simulator (macOS only): Press
i
in the terminal. - Using Expo Go App: Open the Expo Go app and scan the QR code displayed in the terminal.
- On Android Emulator/Device: Press
-
Python Servers (Not Required already deployed in AWS):
All Python servers have been deployed on our AWS server, so you don't need to worry about running them locally. However, if you need to run and test them:
- Request the
.env
file from us by emailing teamcognic.ai@gmail.com - To run the chatbot part:
python "Python_backend/Chatbots/main_chatbot.py"
- To run the call server:
python "Python_backend/Call and sms services/call_server.py"
- For the call server, you also need to:
- Download and install ngrok
- In the ngrok terminal, run:
ngrok http 5000
- Take the public forwarding URL provided by ngrok
- Replace the
server_address
in thecall.py
file with this URL for smooth integration
- Request the
Make sure your device/emulator and development machine are on the same network for the app to communicate with the backend properly.
If you encounter any issues:
- Ensure all dependencies are correctly installed.
- Verify that your environment is set up correctly for the Expo app.
- Check if the required ports (19000 for Expo) are available.
- If you need further assistance, please contact us at teamcognic.ai@gmail.com.
Contributions are welcome! Please fork the repository and create a pull request with your features or fixes.
This project is licensed under the MIT License.