Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 63 additions & 178 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@


# entity-management
<div align="center">

# Entity Management
# Entity-Management Service

<a href="https://shikshalokam.org/elevate/">
<img
Expand All @@ -13,222 +10,110 @@
/>
</a>

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/ELEVATE-Project/notification/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/ELEVATE-Project/notification/tree/master)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=ELEVATE-Project_notification&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=ELEVATE-Project_notification)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ELEVATE-Project_notification&metric=coverage)](https://sonarcloud.io/summary/new_code?id=ELEVATE-Project_notification)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=ELEVATE-Project_notification&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=ELEVATE-Project_notification)
[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
[![Docs](https://img.shields.io/badge/Docs-success-informational)](https://elevate-docs.shikshalokam.org/mentorEd/intro)
[![Docs](https://img.shields.io/badge/API-docs-informational)](https://dev.elevate-apis.shikshalokam.org/notification/api-doc)
![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/notification?filename=src%2Fpackage.json)
![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Badge references wrong service (mentoring instead of entity-management).

Line 13 references the mentoring service in the package.json version badge URL, which is incorrect for this entity-management README.

🔧 Suggested fix
-![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json)
+![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/entity-management?filename=src%2Fpackage.json)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json)
![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/entity-management?filename=src%2Fpackage.json)
🤖 Prompt for AI Agents
In `@README.md` at line 13, Update the Shields badge URL in README.md so it points
to the entity-management package.json instead of mentoring: replace the
"mentoring" segment in the badge URL (the repository/service identifier used in
the img.shields.io link) with "entity-management" so the filename query
(src%2Fpackage.json) now references the correct service.

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

<details><summary>CircleCI insights</summary>

[![CircleCI](https://dl.circleci.com/insights-snapshot/gh/ELEVATE-Project/notification/master/buil-and-test/badge.svg?window=30d)](https://app.circleci.com/insights/github/ELEVATE-Project/notification/workflows/buil-and-test/overview?branch=master&reporting-window=last-30-days&insights-snapshot=true)

</details>
<!-- <details><summary>dev</summary>
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/ELEVATE-Project/mentoring/tree/dev.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/ELEVATE-Project/mentoring/tree/dev)
![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/user/dev?filename=src%2Fpackage.json)
[![CircleCI](https://dl.circleci.com/insights-snapshot/gh/ELEVATE-Project/mentoring/dev/buil-and-test/badge.svg?window=30d)](https://app.circleci.com/insights/github/ELEVATE-Project/mentoring/workflows/buil-and-test/overview?branch=integration-testing&reporting-window=last-30-days&insights-snapshot=true)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=ELEVATE-Project_mentoring&metric=duplicated_lines_density&branch=dev)](https://sonarcloud.io/summary/new_code?id=ELEVATE-Project_mentoring)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ELEVATE-Project_mentoring&metric=coverage&branch=dev)](https://sonarcloud.io/summary/new_code?id=ELEVATE-Project_mentoring)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=ELEVATE-Project_mentoring&metric=vulnerabilities&branch=revert-77-integration-test)](https://sonarcloud.io/summary/new_code?id=ELEVATE-Project_mentoring)
</details> -->

</br>
This Service enables the creation and management of various entities and entityType .It
provides functionalities for entities, ensuring seamless integration and
maintenance of entity-related data across the platform.
</div>

<br>

# System Requirements
## </br>

- **Operating System:** Ubuntu 22
- **Node.js:** v20
- **mongoDb:** v4
## 💻 Supported Operating Systems

# Setup Options
- **Ubuntu** (Recommended: Version 20 and above)
- **Windows** (Recommended: Version 11 and above)
- **macOS** (Recommended: Version 12 and above)

Elevate entity-management services can be setup in local using two methods:
---

<details><summary>Dockerized service with local dependencies(Intermediate)</summary>
## ✨ Setup & Deployment Guide

## A. Dockerized Service With Local Dependencies
This section outlines the different ways to set up the **Entity-Management Service**. Please select the deployment environment and setup method that best suits your needs.

**Expectation**: Run single docker containerized service with existing local (in host) or remote dependencies.
---

### Local Dependencies Steps


1. **Download Docker Compose File:** Retrieve the **[docker-compose.yml](https://raw.githubusercontent.com/ELEVATE-Project/entity-management/refs/heads/main/docker-compose.yml)** file from the entity-management service repository and save it to the entity-management directory.

2. Run the docker container.
<details>
<summary> 🚀 <b>Entity-Management Service</b> </summary>
<br>

- For Mac & Windows with docker v18.03+:
This setup is ideal for **local development and testing**, where only the core Entity-Management Service components are required.

```
$ docker run --name entity-management shikshalokamqa/elevate-entity-management:1.0.0
```
#### I. Docker Setup (Recommended)

- For Linux:
```
$ docker run --name entity-management --add-host=host.docker.internal:host-gateway shikshalokamqa/elevate-entity-management:1.0.0`
```
Refer [this](https://stackoverflow.com/a/24326540) for more information.
- [Setup guide for Linux](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md)
- [Setup guide for macOS](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/mac-os/README.md)
- [Setup guide for Windows](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/windows/README.md)
Comment on lines +42 to +44
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Setup links point to project-service, not entity-management.

These URLs appear to reference the project-service repo even though this PR adds 3.4.0 docs under entity-management. If the docs are intended to be local to this repo, update the links accordingly.

🔧 Example fix (entity-management repo)
--   [Setup guide for Linux](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md)
--   [Setup guide for macOS](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/mac-os/README.md)
--   [Setup guide for Windows](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/windows/README.md)
+-   [Setup guide for Linux](https://github.com/ELEVATE-Project/entity-management/blob/main/src/documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md)
+-   [Setup guide for macOS](https://github.com/ELEVATE-Project/entity-management/blob/main/src/documentation/3.4.0/setup/docker/stand-alone/mac-os/README.md)
+-   [Setup guide for Windows](https://github.com/ELEVATE-Project/entity-management/blob/main/src/documentation/3.4.0/setup/docker/stand-alone/windows/README.md)
...
--   [Setup guide for Linux](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md)
+-   [Setup guide for Linux](https://github.com/ELEVATE-Project/entity-management/blob/main/src/documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md)

Also applies to: 50-51

🤖 Prompt for AI Agents
In `@README.md` around lines 42 - 44, The three setup links labeled "Setup guide
for Linux", "Setup guide for macOS", and "Setup guide for Windows" point to the
project-service repo; update their URLs to point to the corresponding
entity-management documentation (or convert them to relative paths under the new
3.4.0/entity-management docs) so they resolve to the local repo’s README files;
ensure you update the same pattern used on the other lines mentioned (the
duplicate links around the later block) so all references consistently target
entity-management.


### Remote Dependencies Steps
<br>

1. Run the docker container.
#### II. Native Setup (PM2 Managed Services)

```
$ docker run --name entity-management shikshalokamqa/elevate-entity-management:1.0.0
```
- [Setup guide for Linux](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md)
- [Setup guide for macOS](https://github.com/ELEVATE-Project/project-service/blob/main/documentation/3.4.0/setup/docker/stand-alone/mac-os/README.md)
- [Setup guide for Windows](link/to/standalone/native/windows/README)

</details>

<details><summary>Local Service with local dependencies(Hardest)</summary>

## B. Local Service With Local Dependencies

**Expectation**: Run single service with existing local dependencies in host (**Non-Docker Implementation**).

## Installations

### Install Node.js LTS

Refer to the [NodeSource distributions installation scripts](https://github.com/nodesource/distributions#installation-scripts) for Node.js installation.

```bash
$ curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
```

### Install PM2

Refer to [How To Set Up a Node.js Application for Production on Ubuntu 22.04](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-22-04).

**Run the following command**

```bash
$ sudo npm install pm2@latest -g
```

## Setting up Repository

### Clone the entity-management repository to /opt/backend directory

```bash
opt/backend$ git clone -b develop-2.5 --single-branch "https://github.com/ELEVATE-Project/entity-management"
```

### Install Npm packages from src directory

```bash
backend/entity-management/src$ sudo npm i
```
---

### Create .env file in src directory

```bash
entity-management/src$ sudo nano .env
```

Copy-paste the following env variables to the `.env` file:

```env
# entity-management Service Config

# Port on which service runs
APPLICATION_PORT=5001

# Application environment
APPLICATION_ENV=development

# Route after the base URL
APPLICATION_BASE_URL=/entity/

# Api doc URL
API_DOC_URL= "https://project-dev.elevate-apis.shikshalokam.org/entity-management/api-doc"

#User service URL
USER_SERVICE_URL = http://localhost:3001/user


INTERNAL_ACCESS_TOKEN="internal_access_token"

#DB URL
MONGODB_URL=mongodb://mongo:27017/elevate-entity-management

#service name
SERVICE_NAME = elevate-entity-service

version=8
```

Save and exit.

## Setting up Databases

**Start MongoDB Service**

```bash
sudo systemctl start mongod
```

**Verify MongoDB is running**
<br>

```bash
sudo systemctl status mongod
## 📖 Related Documentation & Tools

```
### 🗂️ Database Architecture Diagrams

## Start the Service
Explore the database schemas for the ELEVATE-Entity services below.
Click on a service name to expand and view the diagram.

Navigate to the src folder of entity-management service and run pm2 start command:
<br>

```bash
entity-management/src$ pm2 start app.js -i 2 --name elevate-entity-management
```
<details>
<summary>📂 <b>Entity Management Service (EMS)</b></summary>
<br>
<p align="center">
<img src="https://github.com/ELEVATE-Project/entity-management/blob/dockerSetup/src/documentation/3.4.0/database-diagram/EMS-Entity-Service.drawio.png" alt="Entity Management Diagram" width="100%">
</p>
</details>

#### Run pm2 ls command
> **Tip:** If the diagrams appear too small, you can right-click the image and select
> **"Open image in new tab"** to view the full-resolution architectural details.

```bash
$ pm2 ls
```
---

</details>
### 🧪 Postman Collections and API DOC

<br>
- <a href="https://github.com/ELEVATE-Project/entity-management/tree/main/src/api-doc" target="_blank">
Entity-Management Service API Collection
</a>

# Postman Collections
---

- [Entity-Management Service](https://github.com/ELEVATE-Project/entity-management/tree/main/src/api-doc)
### 🔖 Versioning & Documentation Links

# Used in
This README is focused on the **3.4.0 Setup Guide** for the Entity-Management Service.

This project was built to be used with [Project Service](https://github.com/ELEVATE-Project/project-service) and [User Service](https://github.com/ELEVATE-Project/user.git).
- **Current Version (3.4.0) Documentation**
All setup links above point to the **3.4.0** guides.

The frontend/mobile application [repo](https://github.com/ELEVATE-Project/observation-survey-projects-pwa).
- **Legacy Version (1.0.0) Documentation**
<a href="https://github.com/ELEVATE-Project/entity-management/blob/dockerSetup/src/documentation/1.0.0/README.md" target="_blank">
View 1.0.0 Documentation
</a>

You can learn more about the full implementation of project-service [here](https://elevate-docs.shikshalokam.org/.project/intro) .
---

# Team
## 👥 Team

<a href="https://github.com/ELEVATE-Project/entity-management/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ELEVATE-Project/entity-management" />
</a>

<br>

# Open Source Dependencies
---

Several open source dependencies that have aided Mentoring's development:
### Open Source Dependencies

![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)
![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white)
![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white)
This Entity-Management Service uses several open-source tools and dependencies that supported its development

![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)
![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka)
![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white)
![MongoDB](https://img.shields.io/badge/MongoDB-4EA94B?style=for-the-badge&logo=mongodb&logoColor=white)
Loading