Have you ever wondered what happens when a viral trend in the US hits the reality of a power outage in Karachi?
As a Textile Engineering graduate from NED University who moved into Data Science, I’ve always lived in the space between the physical and the digital. I’ve seen how a great production plan can fall apart because the grid goes down, or how a US retailer loses thousands because they didn’t see a stockout coming.
I decided to stop wondering and start building. I call it the Loom-to-Linen Orchestrator.
The Heart of the Problem
The global supply chain is often treated like a math equation, but it’s actually a living thing. In Karachi, we deal with “local realities”—load shedding, shifting energy tariffs, and the rising cost of raw materials. In the US, retail managers deal with “market realities”—unpredictable demand and new carbon taxes.
My goal was to build a “Digital Bridge” that makes these two worlds talk to each other in real-time.
How the “Bridge” Works (Simply Put)
Instead of just a simple program, I built a system that “thinks” before it acts:
- The Watchdog: It monitors the Karachi power grid. If the lights go out (Load Shedding), the system doesn’t panic. it checks the backup generator fuel. If fuel is low, it automatically tells the US office: “Hey, stop spending money on ads today; we can’t make the towels right now.” That’s Site Reliability Engineering (SRE) in action.
- The Fortune Teller: Using something called a “Monte Carlo Simulation,” the system looks at 1,000 possible versions of the future. It predicts if a stockout is coming so we can buy raw yarn in Karachi before the price spikes.
- The Green Auditor: With new US carbon laws, I programmed the system to calculate the “Carbon Tax.” It chooses to run the looms at 11:00 AM when the Karachi sun is brightest, using Private Solar to keep the product cheap and eco-friendly.
The Hurdles: Where I Stumbled (and Learned)
No project is perfect on day one. I faced two major errors during development:
- The “Logic Gap” Error: Originally, my system was too “optimistic.” It would start the looms the moment power came back. But in Karachi, the grid can be unstable right after load shedding.
- The Correction: I added a “Stability Buffer” and a mandatory fuel check. Now, the system only commits to a batch if it knows it can finish it.
- The Security Scare: I realized that if someone hacked the Python script, they could send “fake” orders to a factory.
- The Correction: I built a “Security Handshake” using HMAC-SHA256 (a digital seal). Now, the loom literally won’t spin unless it receives a cryptographically signed “OK” from the head office.
Explore the Work
I believe in transparency and sharing knowledge. You can dive deeper into the technical side of this project through the links below:
- [Read the Full Product Brief (PDF Presentation)] – For the high-level business strategy.
- [View the Technical README] – For a deep dive into the SRE logic and hurdles.
- [Review the Code on GitHub] – Take a look at the Python and SQL logic under the hood.
Let’s Build Something Together
This project was born out of a passion for making industry smarter and more resilient. Whether it’s optimizing a supply chain, building a predictive model, or securing industrial data, I love solving problems where the digital meets the physical.
If you’re working on something similar or have a challenge that needs a “Logic-First” approach, I’d love to chat. No sales pitches—just a conversation about how we can make your systems more reliable.



Leave a comment