Skip to content

Sholontla/PlatformScienceCodeExercise-

Repository files navigation

Platform Science Code Exercise


About the project:

Run Project

  1. clone the repository

  2. In the root directory in your local file system where the project been cloned, run the Makefile command "make" to build the project and run the docker containers. *** Note: This commmand has been test in wsl/2 and Linux systems

  3.           CREATE PUBLISHER/USER:
     POST http://localhost:1004/service/access/register/user
     {
     "user_user_name": "user1",
     "user_user_last_name": "user1",
     "user_user_email": "user1",
     "password": "user1",
     "permissions": {
     "create_topic": true,
     "read_topic": false
     },
     "role": true
     }
    
  4.           USER LOGIN:
     POST http://localhost:1004/service/access/login/user
     body:
     {
     "user_user_email": "user1",
     "password": "user1"
     }
    
  5.            CREATE PUBLISH/ORDER
       POST http://localhost:1004/service/create/order
       body:
       {
       "store": {
       "region": "test1",
       "sub_region": "test1",
       "sale": {
       "product": "test1",
       "price": 45.25,
       "cost": 8.25,
       "unit_sold": 5,
       "region": "test1",
       "sub_region": "test1"
       }
       }
       }
    
  6.            VISUALIZE THE DATA
       localhost:3000/
    

Project structure by:

Publisher Service (publisher_service/):

Built With

- Golang (Go)
- Fiber (http framework)

Virtualization / Containers

- Docker
- Docker - Compose

O/I

- Windows(WSL2)
- Linux

Project OverView:
  * Create topics by http request
  * kafka Broker create and send topic to be consumed by financa_service/

Security:
  * have roles/permissions and socpe
  * JWT
  *


publisher_service have 4 end-point:

1.  This endpoint register a service/access/register/user
    \*\*\* Noticed that we have permissions and in this service, the next enpoints will only work with
    "create_topic": true and "role": true

    POST http://localhost:1004/service/access/register/user
    body:
    {
    "user_user_name": "user1",
    "user_user_last_name": "user1",
    "user_user_email": "user1",
    "password": "user1",
    "permissions": {
    "create_topic": true,
    "read_topic": false
    },
    "role": true
    }

2.  This service/access/login/user
    will Login the publisher/user into the service.

    POST http://localhost:1004/service/access/login/user
    body:
    {
    "user_user_email": "user1",
    "password": "user1"
    }

3.  the endpoint service/create/order will set a topic into the service.
    The service will have a Kafka Producer service where the finaince_service/ will consume
    the message from the publisher.
    Benefits of using Kafka Broker:
    - Ensure high concurrency, low concurrency and scalibilty
    - If the consumer goes down. we ensure the messages will not be lost.
    - Amoung others ...
      POST http://localhost:1004/service/create/order
      body:
      {
      "store": {
      "region": "test1",
      "sub_region": "test1",
      "sale": {
      "product": "test1",
      "price": 45.25,
      "cost": 8.25,
      "unit_sold": 5,
      "region": "test1",
      "sub_region": "test1"
      }
      }
      }

publisher service will save the raw data into MongoDB under users_db for database and users for collection.


Finance Service (finance_service/):

Built With

- Golang (Go)
- Fiber (http framework)

Virtualization / Containers

- Docker
- Docker - Compose

O/I

- Windows(WSL2)
- Linux

Project OverView: . This service use some basic logic to apply "Daily Revenue" for every topic/order consume by Kafka and render the data into a timeline chart using CORS and Next.js as a primary forntEnd framework. . Redis as Caching system to presist the data from the cosumer side ans will have a time limite to store data for 1 hour. ***Note: Redis services is only implemented over a high level of configuration and logic, depends on the busniess logic will change.

Post http://localhost:1003/finance/:param param: revenue avarage avarage_product top_selling profit_margin_all daily_cost

with this parameters listed yo can get some logic apply to the data.

Get http://localhost:1003/daily/revenue This endpoint list all the data store in Cache redis and this same endpoint is used in the front End to list all revenue process by the service.

For the moment only one chart is render into the frontend this is only for demo purposes.

The service have implemented the next finance operations and only redner by the frontend is CalculateDailyRevenueService:

  • CalculateDailyRevenueService
  • CalculateAverageRevenueService
  • CalculateAverageRevenuePerProductService
  • IdentifyTopSellingProductsService
  • CalculateAllProfitMarginService
  • CalculateDailyCostService
  • CalculateGrossProfitService
  • CalculateGrossProfitMarginService
  • AnalyzeSalesTrendsService
  • CalculateAverageDailyRevenueService
  • CalculateStoreRevenueService
  • AnalyzeProfitabilityByRegionService
  • IdentifyUnderperformingProductsService
  • AnalyzePricingStrategyService
  • ForecastFutureSales

Front End Finance Service (front-end-finance):

Built With

- javaScript
- TypeScript
- Next.js

Virtualization / Containers

- Docker
- Docker - Compose

O/I

- Windows(WSL2)
- Linux

Project OverView: . This is the front end to render the data and chart comign from the backend.

http://localhost:3000/


License

For testing and demostrations purposes.


Contact

Gerardo Ruiz Bustani - solbustani@gmail.com - +52 442 488 6193

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages