---
# System prepended metadata

title: Sales Dashboard - MERN

---

# Sales Dashboard - MERN

*MERN*

## General Requirements
#### Setup
Assume we have the following 2 folders where files come in, in regular intervals as mentioned below.
* **`data/sales`** - arrival interval: every 60 seconds
* **`data/products`** - arrival interval every 90 seconds

Say we have around 100 products separated into 10 different files with 10 products each. The products data file should contain the following information with the headers mentioned below.

| product_id | product_name | brand_name | cost_price | selling_price | category | expiry_date |
| ---------- | ------------ | ---------- | ---------- | ------------- | -------- | ----------- |
| `uuid`     | `string`     | `string`   | `float`    | `float`       | `string` | `date`      |


The sales file should have the following information with the headers as mentioned below.

| transaction_id | product_id | quantity | total_transacion_amount | transaction_date |
| -------------- | ---------- | -------- | ----------------------- | ---------------- |
| `uuid`         | `uuid`     | `float`  | `float`                 | `date`           |

#### Assumptions
* Assume each sales data file has an irregular number of rows, in other words, different numbers or rows for different files with a maximum of a hundred rows for a file and 20 sales files in total.

**Note**
Please use any fake data generation library to generate fake sales and products data in **`CSV`** format, namely `sales_1.csv`, `sales_2.csv`, etc and `products_1.csv`, `products_2.csv` and so on.


---

#### Node + Mongo Requirements
Once the files are generated into the corresponding folders, your application should

* Simulate the arrival of files by reading them from the respective folders in the above mentioned time intervals in the order of the files by name, i.e., `sales_1.csv` is read first, `sales_2.csv` read second and so on, for both sales and product files.
* Process the information and store them in MongoDB.

---

#### React Requirements

* List the data from the data store in a decent webpage with the intention of providing a good sales report.
* Ask the user to refresh the page once new files have been processed.
* Sort the data by the header clicked on.
* Implement useful filters using your judgement.
* Implement the following pages/screens and all necessary endpoints as required.

###### **Sales by Products**

| S. No. | Product Name | Brand Name | Category | Total Quantity Sold | Total Revenue | Total Profit |
| ------ | ------------ | ---------- | -------- | ------------------- | ------------- | ------------ |

###### **Sales by Brand**

| S. No. | Brand Name | Most Sold Product | Total Quantity Sold | Total Revenue | Total Profit |
| ------ | ---------- | ----------------- | ------------------- | ------------- | ------------ |

###### **A simple dashboard showing (but not limited to)** *You can be creative here*
- Most profitable product
- Least profitable product
- Date of highest sales
- Date of least sales
- Implement required filters according your judgement.

---

### Your submission must include
- Unit tests
- API documentation
- The link to the source repository.
- A working application that is containerized.
- A proper `README.md` with all necessary instructions required to run the application.
