ptcapao/Supply-chain-and-compliance
MVP Supply‑Chain Analytics & Compliance SaaS
This directory contains a minimal proof‑of‑concept for an AI‑driven supply‑chain analytics and regulatory compliance platform. The application demonstrates two core pieces of functionality:
- Demand Forecasting – given a list of historical demand or inventory values, the back‑end computes a simple moving average to forecast the next period. This placeholder logic can be replaced with more advanced statistical or machine‑learning models as the product matures.
- Regulatory Information – a static endpoint returns sample information about serialization mandates and the EU Critical Medicines Act. In a production system this would be replaced with a dynamic database and rules engine that delivers country‑specific compliance guidance. The current responses are derived from public sources which note that serialization is required in about 80 % of countries and that EU proposals emphasise stockpiling and supply chain transparency【545870487958921†L125-L134】【272964295138225†L26-L37】.
Project structure
├── app.py # Flask back‑end with forecasting and regulation endpoints
├── requirements.txt # Python package dependencies
├── README.md # This file
└── static/
└── index.html # Simple front‑end UI to interact with the APIapp.py
Runs a Flask server that exposes two REST endpoints:
POST /predict– accepts JSON of the form{"data": [number, …]}and returns a JSON object containing a basic forecast. If invalid data is provided, the server returns a 400 error and an explanatory message.GET /regulations– returns a fixed JSON structure describing high‑level regulatory requirements. This data is for demonstration only and should not be relied on for real compliance decisions.
When executed directly, the server listens on port 5000 by default or on the port specified by the PORT environment variable.
static/index.html
A small HTML page that provides two interactive sections: one for submitting historical data and receiving a forecast, and another for fetching the regulatory information. The page uses the Fetch API to call the Flask endpoints and display results to the user.
Getting started
- Install Python dependencies
From within the mvp_saas directory, create a virtual environment (optional but recommended) and install the requirements:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt- Run the server
Start the Flask application:
python app.py The server will be available at http://localhost:5000. Navigate your browser to that address to see the UI.
- Try it out
- Enter a series of comma‑separated numbers (e.g.,
10, 12, 11, 15) and click Predict to see the forecast for the next period. - Click Get Regulations to view the sample compliance information.
Extending the MVP
This project is intentionally simple to highlight core concepts. Possible next steps include:
- Integrating more advanced forecasting algorithms such as ARIMA, Prophet or neural networks.
- Connecting to real‑time data sources (ERP systems, inventory management tools) via API.
- Building a database of global regulatory requirements and implementing a rule‑based engine to deliver tailored compliance guidance.
- Adding user authentication, logging, and a persistent data store.
We encourage you to treat this repository as a starting point for building a full‑featured SaaS platform.
