Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
363eff2
feat: add time-series-preprocessor agent kit
baggasiddhant Apr 18, 2026
3a9a440
docs: add flow README
baggasiddhant Apr 18, 2026
4985047
fix: add missing flow README
baggasiddhant Apr 18, 2026
b726eff
fix: remove root package-lock.json
baggasiddhant Apr 18, 2026
03d6440
Fix: address Coderabbitai Review comments
baggasiddhant Apr 19, 2026
2b72304
fix: remove incorrect root package-lock.json
baggasiddhant Apr 19, 2026
651149f
fix: restore hiring kit globals.css to original
baggasiddhant Apr 19, 2026
3fadeaa
fix: restore hiring kit globals.css with correct encoding
baggasiddhant Apr 19, 2026
4d9842b
fix: restore hiring kit globals.css correctly
baggasiddhant Apr 19, 2026
268d758
fix: add missing dependencies, use Lamatic SDK, guard env variable
baggasiddhant Apr 19, 2026
1a7c4a2
Fix: add reInit listener cleanup in carousel effect
baggasiddhant Apr 20, 2026
07cb91a
security: Validate css values in chart component
baggasiddhant Apr 20, 2026
d9de8ed
Fix:change empty Description from div to p element
baggasiddhant Apr 20, 2026
7476d1d
Fix: format flow readme
baggasiddhant Apr 20, 2026
b815c93
fix: remove duplicate README.me file
baggasiddhant Apr 20, 2026
dbe2d0c
fix: remove state from useEffect Dependancy
baggasiddhant Apr 20, 2026
fb49fb5
docs: Fix flow docs
baggasiddhant Apr 20, 2026
acda769
fix: add missing imports and support textarea
baggasiddhant Apr 20, 2026
67a1de7
fix: correct kbdgroup component type
baggasiddhant Apr 20, 2026
20e1d8d
fix:add use client directive to navigation-menu
baggasiddhant Apr 20, 2026
6f236ea
fix: move aria-hidden to icon in PaginationEllipsis
baggasiddhant Apr 20, 2026
d2d53a6
fix: sync progress indicator transform with max prop
baggasiddhant Apr 20, 2026
a2af7de
fix: export SheetPortal and SheetOverlay primitives
baggasiddhant Apr 20, 2026
961aecd
fix: add ComponentProps type import to skeleton
baggasiddhant Apr 20, 2026
574df96
fix: add missing imports in sonner and spinner
baggasiddhant Apr 20, 2026
7f30ac5
fix:fix loosen update typing
baggasiddhant Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kits/automation/time-series-preprocessor/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TIME_SERIES_PREPROCESSOR="Your Flow ID from Lamatic Studio"
LAMATIC_API_URL="Your API Endpoint URL"
LAMATIC_PROJECT_ID="Your Project ID"
LAMATIC_API_KEY="Your API Key"
29 changes: 29 additions & 0 deletions kits/automation/time-series-preprocessor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# next.js
/.next/
/out/

# production
/build

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

.env.local
162 changes: 162 additions & 0 deletions kits/automation/time-series-preprocessor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Time-Series Preprocessor — Lamatic AgentKit

An automation kit that analyzes time-series dataset schemas and generates production-ready Python preprocessing pipelines using `pandas` and `scikit-learn`. Paste a JSON summary of your dataset and receive executable code in seconds.

---

## What It Does

By providing a JSON summary of your dataset, the agent generates a complete Python script that handles:

- **Missing value imputation** — forward-fill, mean, and median strategies selected based on column type
- **Feature scaling** — MinMaxScaler or StandardScaler applied appropriately
- **Datetime parsing and index management** — automatic timestamp detection and alignment
- **Categorical encoding** — label or one-hot encoding based on cardinality
- **Standardized implementation** — clean, readable `pandas` + `scikit-learn` code ready to run

---

## Project Background

This kit was developed to solve the repetitive nature of data cleaning in time-series projects.

The concept originated during the development of a **water demand forecasting model** for a college located in a rural area near Bhopal. Due to aging sensor hardware and inconsistent data streams, significant time was spent manually handling missing values and aligning disparate data sources — rainfall readings, local water levels, and consumption logs from different systems with mismatched timestamps.

The goal was to automate the boilerplate preprocessing code, allowing engineers to focus on model performance rather than manual cleanup. This kit is the result of that experience.

---

## Who Is It For

Data engineers and machine learning engineers who frequently work with time-series data and need a fast way to generate reliable, repeatable preprocessing pipelines without writing boilerplate code from scratch.

---

## Tech Stack

| Tool | Role |
|---|---|
| [Lamatic.ai](https://lamatic.ai) | Flow orchestration and Edge deployment |
| Gemini 2.5 Pro | AI-driven Python code generation |
| Next.js 14 | Interactive frontend sandbox |
| pandas + scikit-learn | Target libraries for generated pipelines |

---

## Setup

### 1. Build and Deploy Flow in Lamatic Studio

1. Sign in at [lamatic.ai](https://lamatic.ai)
2. Create a new project (if you don't have one)
3. Click **+ New Flow** and select **API Request** as the trigger
4. Add a **Generate Text** node and select **Gemini 2.5 Pro**
5. Set the input variable to `dataset_summary`
6. Configure the system prompt to act as an expert data engineer
7. Deploy the flow and copy your credentials from the Studio dashboard

### 2. Environment Variables

Create a `.env.local` file in the kit root directory:

```env
TIME_SERIES_PREPROCESSOR="Your Flow ID from Lamatic Studio"
LAMATIC_API_URL="Your API Endpoint URL"
LAMATIC_PROJECT_ID="Your Project ID"
LAMATIC_API_KEY="Your API Key"
```

| Variable | Where to Find It |
|---|---|
| `TIME_SERIES_PREPROCESSOR` | Studio → Your Flow → Settings |
| `LAMATIC_API_URL` | Studio → Your Flow → API Endpoint |
| `LAMATIC_PROJECT_ID` | Studio → Project Settings |
| `LAMATIC_API_KEY` | Studio → Project Settings → API Keys |

### 3. Install and Run

```bash
npm install
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) to access the frontend interface.

---

## Example Input

Provide a JSON object describing your dataset structure:

```json
{
"dataset_name": "sensor_readings",
"frequency": "1min",
"columns": [
{"name": "timestamp", "type": "datetime"},
{"name": "temperature", "type": "float", "missing_pct": 5},
{"name": "pressure", "type": "float", "missing_pct": 2},
{"name": "status", "type": "categorical", "missing_pct": 0}
],
"rows": 50000,
"target_column": "temperature"
}
```

## Example Output

The agent returns a fully executable Python script:

```python
import pandas as pd
from sklearn.preprocessing import MinMaxScaler

# Load and index
df = pd.read_csv("sensor_readings.csv", parse_dates=["timestamp"])
df.set_index("timestamp", inplace=True)

# Impute missing values
df["temperature"].fillna(method="ffill", inplace=True)
df["pressure"].fillna(df["pressure"].mean(), inplace=True)

# Scale numerical features
scaler = MinMaxScaler()
df[["temperature", "pressure"]] = scaler.fit_transform(df[["temperature", "pressure"]])

print("Preprocessing complete.")
print(df.head())
```

---

## Project Structure

````text
time-series-preprocessor/
├── actions/
│ └── orchestrate.ts # Server action calling the Lamatic flow
├── app/
│ └── page.tsx # Main UI — input form and output display
├── components/
│ └── ui/ # shadcn/ui components
├── flows/
│ └── time-series-preprocessor/
│ ├── config.json # Exported Lamatic flow graph
│ ├── inputs.json # Input schema definition
│ └── meta.json # Flow metadata
├── lib/
│ └── lamatic-client.ts # Lamatic SDK client
├── .env.example # Environment variable template
├── config.json # Kit metadata
└── README.md
````

---

## Contributing

Contributions are welcome. Open an issue or pull request in the [AgentKit repository](https://github.com/Lamatic/AgentKit).

## License

MIT License — see [LICENSE](../../../LICENSE).
31 changes: 31 additions & 0 deletions kits/automation/time-series-preprocessor/actions/orchestrate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use server";

import { createLamaticClient } from "@/lib/lamatic-client";

const client = createLamaticClient();

export async function preprocessTimeSeries(datasetSummary: string) {
if (!process.env.TIME_SERIES_PREPROCESSOR) {
throw new Error("TIME_SERIES_PREPROCESSOR environment variable is not set");
}

try {
const response = await client.executeFlow({
flowId: process.env.TIME_SERIES_PREPROCESSOR,
inputs: {
dataset_summary: datasetSummary,
},
});
Comment thread
baggasiddhant marked this conversation as resolved.

return {
success: true,
result: response?.data?.generatedText || "",
};
} catch (error) {
console.error("Error calling Lamatic flow:", error);
return {
success: false,
result: "Failed to generate preprocessing pipeline. Please try again.",
};
}
}
15 changes: 15 additions & 0 deletions kits/automation/time-series-preprocessor/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
Comment thread
baggasiddhant marked this conversation as resolved.

* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
font-family: 'Inter', sans-serif;
background-color: #f5f5f5;
color: #111;
}
29 changes: 29 additions & 0 deletions kits/automation/time-series-preprocessor/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { Metadata } from "next";
import { ThemeProvider } from "@/components/ThemeProvider"
import "./globals.css";

export const metadata: Metadata = {
title: "Time-Series Preprocessor — Lamatic AgentKit",
description: "AI-powered time-series preprocessing pipeline generator",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet" />
Comment on lines +18 to +20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Consider switching to next/font/google — the manual <link> tags leak performance.

The three manual <head> link tags for Inter add a network round-trip and can cause layout shift. next/font/google self-hosts the font at build time, zero runtime requests and zero layout shift — already a first-party capability in Next.js 14.

♻️ Proposed refactor
 import type { Metadata } from "next";
 import { ThemeProvider } from "@/components/ThemeProvider"
+import { Inter } from "next/font/google"
 import "./globals.css";

+const inter = Inter({ subsets: ["latin"] })

 export default function RootLayout({ children }: { children: React.ReactNode }) {
   return (
-    <html lang="en">
-      <head>
-        <link rel="preconnect" href="https://fonts.googleapis.com" />
-        <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
-        <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet" />
-      </head>
-      <body style={{ margin: 0, padding: 0 }}>
+    <html lang="en" className={inter.className}>
+      <body style={{ margin: 0, padding: 0 }}>
         <ThemeProvider>{children}</ThemeProvider>
       </body>
     </html>
   );
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/automation/time-series-preprocessor/app/layout.tsx` around lines 18 -
20, Replace the manual <link> tags in layout.tsx with Next's built-in Google
font loader: import Inter from 'next/font/google', create a font instance (e.g.,
const inter = Inter({ subsets: ['latin'], weight:
['400','500','600','700','800','900'], display: 'swap' })), remove the three
existing <link rel="preconnect"> and <link
href="https://fonts.googleapis.com..."> tags, and apply inter.className to your
root element (html or body) in the layout so the Inter font is self-hosted at
build time and avoids runtime network requests and layout shift.

</head>
<body style={{ margin: 0, padding: 0 }}>
<ThemeProvider>
{children}
</ThemeProvider>
</body>
</html>
);
}
Loading
Loading