# Project Overview: Life Plan Video Generator (PoC) ## 1\. Ultimate Goal To build an automated pipeline that transforms a static **Life Plan Report (PDF)** and raw **Interview Footage** into a **3-5 minute dynamic explanatory video (MP4)**. The system is designed to help insurance consultants visualize complex financial data (e.g., asset depletion, inflation risks) for clients, creating an emotional and logical narrative to support decision-making. ## 2\. Core Architecture The system follows a "Hybrid Local/Cloud" architecture to handle sensitive data and heavy video processing efficiently. ### **Backend (Python / Logic Layer)** - **Role:** The "Brain". Handles data extraction, logic calculation, and asset preparation. - **Tech Stack:** Python 3.10+, LangChain, Google Gemini 1.5 Pro (via API). - **Key Responsibilities:** 1. **Ingestion:** Parse complex Japanese PDFs (Sony Life Reports) using Gemini 1.5 Pro. 2. **Structured Output:** Convert unstructured text into strict JSON (Zod Schema compliant). 3. **Simulation Engine:** Calculate future asset projections (inflation, compound interest on deficits) to fill missing data points (Linear Interpolation). 4. **Asset Prep:** Use `FFmpeg` (stream copy) to slice raw interview videos based on timestamps. ### **Frontend / Rendering (Remotion / Visual Layer)** - **Role:** The "Renderer". Converts JSON data into video frames. - **Tech Stack:** TypeScript, React, Remotion, Recharts, Zod. - **Key Responsibilities:** 1. **Programmatic Video:** Render UI components as video frames. 2. **Dynamic Charts:** Visualize "Asset Depletion" and "Sufficiency Rates" using `Recharts`. 3. **Frame Synchronization:** Drive animations strictly via `useCurrentFrame()` (no CSS transitions). --- ## 3\. Remotion Specifics (Copilot Instructions) ### **What does Remotion do in this project?** Remotion is **NOT** just a video editor; it is a **code-based rendering engine**. It treats the video timeline as a function of state `f(frame) = UI`. ### **Critical Implementation Rules** 1. **No Internal Animations:** - When using `Recharts`, always set `isAnimationActive={false}`. - **Reason:** Remotion renders frame-by-frame. Internal library animations rely on real-time timers, which break during rendering, causing flickering or static frames. - **Solution:** Drive data slicing using `interpolate(frame, [start, end], [0, dataLength])`. 2. **Asset Handling:** - Do **NOT** import huge video files directly into React. Use URL references or local paths managed by the Python backend. - Use `