diff --git a/.gitignore b/.gitignore index b55a8cf8..203fe916 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ target/ *.iml *.ipr +### Environments ### +.env + ### NetBeans ### /nbproject/private/ /nbbuild/ diff --git a/.idea/codestream.xml b/.idea/codestream.xml index 2d51d026..f6775c21 100644 --- a/.idea/codestream.xml +++ b/.idea/codestream.xml @@ -5,5 +5,6 @@ + diff --git a/Docs/Config Guide.md b/Docs/Config Guide.md index f3c7bf14..1377e39d 100644 --- a/Docs/Config Guide.md +++ b/Docs/Config Guide.md @@ -1,5 +1,40 @@ -# Instructions: -*Note:* Default configurations are setup for running the project on server. +# Instructions to set up project to local: +*Note:* Default configurations are set up for running the project on server. + +## Clone the repository: +```markdown +https://github.com/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform.git +``` + +## Pre requests +- Install Angular CLI 15.2.x +- Node version 16.19.0 +- Java JDK 17 +- Python 3.10 +- Different runnable environment supportive IDEA (intellij ultimate is recommended) + +## Frontend +- Move to the frontend branch + ```markdown + git switch frontend + ``` +- Move to the `client` directory + ```markdown + cd client + ``` +- Navigates to `src\environment\environment.development.ts` +- Commented out the production base url and uncomment the local (`port 3269 is recommended and default`) +- Move to the client directory in terminal and run `npm install --force` command + > [!IMPORTANT] + > Use --force for install deprecated packages. don't use --legacy-peers +- Run `ng serve` command to start the development server +- Project starts to run on `localhost:4200/` port + +## Backend +Move to the `backend` branch + ```markdown + git switch backend + ``` You have to change few files to run the project locally. 1. AIModel.java (*./src/main/java/com/api/air_quality/model/ai_models/AIModel.java*) @@ -28,3 +63,6 @@ Add Environment for Python Models. - pip install -r requirements.txt (recommended) - venv\Scripts\python.exe -m pip install -r requirements.txt (only if **not working** `pip install -r requirements.txt`) - deactivate + +> [!NOTE] +> If you're facing any idea error, delete the `.idea` directory and rebuild the project diff --git a/README.md b/README.md index f82e5d33..5aa54108 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,84 @@ # Urban Air Quality Monitoring and Prediction System +![commit activity](https://img.shields.io/github/commit-activity/y/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform/main) +![GitHub language count](https://img.shields.io/github/languages/count/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform) +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform/ci.yml?branch=main&label=CI%2FCD%20workflow) +![Netlify](https://img.shields.io/netlify/84cd0792-91fd-49b8-9fe9-bc52d7e78a3d) +![Website](https://img.shields.io/website?url=https%3A%2F%2Furban-air-quality-monitor.netlify.app) +![GitHub License](https://img.shields.io/github/license/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform) +![GitHub Release](https://img.shields.io/github/v/release/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform) + + +## System Config +*Note:* Default configurations are set up for running the project on server. + +## Clone the repository: +```markdown +https://github.com/kavicastelo/Ethical-AI-driven-Geographic-Analytics-Platform.git +``` + +## Pre requests +- Install Angular CLI 15.2.x +- Node version 16.19.0 +- Java JDK 17 +- Python 3.10 +- Different runnable environment supportive IDEA (intellij ultimate is recommended) + +## Frontend +- Move to the frontend branch + ```markdown + git switch frontend + ``` +- Move to the `client` directory + ```markdown + cd client + ``` +- Navigates to `src\environment\environment.development.ts` +- Commented out the production base url and uncomment the local (`port 3269 is recommended and default`) +- Move to the client directory in terminal and run `npm install --force` command + > [!IMPORTANT] + > Use --force for install deprecated packages. don't use --legacy-peers +- Run `ng serve` command to start the development server +- Project starts to run on `localhost:4200/` port + +## Backend +Move to the `backend` branch + ```markdown + git switch backend + ``` + +You have to change few files to run the project locally. +1. AIModel.java (*./src/main/java/com/api/air_quality/model/ai_models/AIModel.java*) + - Comment out line **143** and **145**. + - Uncomment line **142** and **144**. +2. All Python models except AIModelPython.py (*./src/main/java/com/api/air_quality/python/\*.py*) + - Replace all file paths in `class *ModelPython:` classes with actual file paths. + - Ex: `"/app/AI_Models/airHumidity_model.pkl"` to `"./AI_Models/airHumidity_model.pkl"` +3. CorsConfig.java (*./src/main/java/com/api/air_quality/CorsConfig.java*) + - Uncomment line **17** and **29**. + - Comment out line **18** and **30**. + +If you need to use your own localhost database, +- Create `.env` file in the root directory of the project. +- Add `SPRINGBOOT_URL_PYTHON` environment variable in `.env` file. (Optional) +- Add `PYTHON_EXE_PATH` environment variable in `.env` file. (Optional) +- Add `DATABASE` environment variable in `.env` file. (Default `Urban_Air`) +- Add `DATABASE_PORT` environment variable in `.env` file. +- Add `DATABASE_URI` environment variable in `.env` file. +- Add `SERVER_PORT` environment variable in `.env` file. (default 3269) + +Add Environment for Python Models. +- -m venv venv +- source venv\bin\activate (Linux or Mac) +- .\venv\Scripts\activate (Windows) +- pip install -r requirements.txt (recommended) +- venv\Scripts\python.exe -m pip install -r requirements.txt (only if **not working** `pip install -r requirements.txt`) +- deactivate + +> [!NOTE] +> If you're facing any idea error, delete the `.idea` directory and rebuild the project + + ## Data Dictionaries ### 1. Air Quality Data @@ -29,7 +108,7 @@ - **location:** Geographic location for which land use information is provided. - **land_type:** Type of land use (e.g., Residential, Commercial, Industrial, Park). -## Routes +## Open APIs ### Basic CRUD 1. Air Quality - /api/v1/saveAirQuality