jacob-g-park

polaris-datainsight-doc-extract

数据分析v1.0.0
作者:jacob-g-park更新于 2026-05-11@clawhub_jacob-g-park/polaris-datainsight-doc-extract
数据清洗#Document#Rag

据 AlphaMoat 统计,截至 2026-09,polaris-datainsight-doc-extract 累计下载 842 次、获 1 个星标,在全部 5,078 个 AI 技能中排名第 5,078 位,在「数据分析」分类(399 个)中排名第 399 位。

累计安装
103
累计下载
842
星标
1
全站排名
#5,078
全站前 100% · 「数据分析」前 100%
平台累计安装累计下载星标评论
ClawHub ↗208361-
SkillHub ↗1038421—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

它描述将获准处理的文档上传到 Polaris 服务,提取文本、图片、表格、图表、形状和公式等内容,并返回结构化 JSON 或 ZIP 结果。使用需要 API 密钥及服务许可;文档本身会被发送到外部 API,因此上传前应核实文件授权、敏感信息处理、服务条款和密钥保管方式。

资料发布于 2026-10-29

可以用来做什么

  • 从支持的 Office 文档中提取文字和结构元素。
  • 将表格或图表内容整理为便于分析的结构化数据。
  • 把提取内容划分为适用于搜索或 RAG 的片段。

什么时候用

  • 需要从获准处理的 Office 文件中读取表格、图表或文本时。
  • 需要将结构化提取结果用于分析或检索增强工作流时。
  • 上传任何包含敏感数据的文件前,需要核实外部传输、服务许可和 API 密钥配置时。

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

概述从获准文档中提取表格并转为 CSV 的流程,但不要上传文件或调用 API。
检查哪些文档内容会被发送到外部服务,以及如何保护 API 密钥。

月度数据趋势

累计下载842
2455668862026-03 · 累计下载 2892026-05 · 累计下载 4722026-06 · 累计下载 5642026-07 · 累计下载 7272026-08 · 累计下载 7742026-09 · 累计下载 84226-0326-09
星标1
0122026-03 · 星标 12026-05 · 星标 12026-06 · 星标 12026-07 · 星标 12026-08 · 星标 12026-09 · 星标 126-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-09842—1
2026-08774+6.5%1
2026-07727+28.9%1
2026-06564+19.5%1
2026-05472—1
2026-03289—1

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

9.0 KB · ClawHub v1.0.0
---
name: polaris-datainsight-doc-extract
description: Extract structured data from Office documents (DOCX, PPTX, XLSX, HWP, HWPX) using the Polaris AI DataInsight Doc Extract API. Use when the user wants to parse, analyze, or extract text, tables, charts, images, or shapes from document files. Invoke this skill whenever the user mentions extracting content from Word, PowerPoint, Excel, HWP, or HWPX files, wants to parse document structure, needs to convert document data for RAG pipelines, or asks about reading tables, charts, or text from Office-format documents — even if they don't explicitly mention "DataInsight" or "Polaris".
license: Apache-2.0 (for skill definition); Service usage subject to Polaris AI DataInsight Terms of Service.
---

# Polaris AI DataInsight — Doc Extract Skill

Use the Polaris AI DataInsight Doc Extract API to extract text, images, tables, charts, shapes, equations, and more from Word, PowerPoint, Excel, HWP, and HWPX files, returning everything as a structured `unifiedSchema` JSON. A single API call gives you the full document structure without any manual parsing.
展开全部(共 307 行)
---

## When to Use This Skill

- The user wants to extract text, tables, charts, or images from DOCX, PPTX, XLSX, HWP, or HWPX files
- The user needs to understand a document's structure (page count, element types, position data, etc.)
- The extracted data will be used in a RAG pipeline, data analysis workflow, or automation task
- Table data needs to be converted to CSV, or chart data needs to be broken down into series and labels
- The user needs to parse special elements like headers, footers, equations, or shapes

---

## What This Skill Does

1. **Authentication** — Authenticates with the Polaris DataInsight API via the `x-po-di-apikey` header.
2. **Upload and extract** — Sends the file as a multipart/form-data POST request and extracts the full document structure.
3. **Parse ZIP response** — The API returns a ZIP file; extract it and load the `unifiedSchema` JSON inside.
4. **Deliver structured data** — Returns a JSON organized by page and element type (text, table, chart, image, shape, equation, etc.).
5. **Support multiple usage patterns** — Handles full text extraction, table-to-CSV conversion, RAG chunk generation, and more.

---

## How to Use

### Prerequisites

**Get an API Key**: Sign up at https://datainsight.polarisoffice.com and generate your API key.

**Authentication**: Include the API key as a header on every request.

```
Header: x-po-di-apikey: $POLARIS_DATAINSIGHT_API_KEY
```

**Set the environment variable**:

```bash
export POLARIS_DATAINSIGHT_API_KEY="your-api-key-here"
```

### Limits

| Item | Limit |
|------|-------|
| Supported formats | HWP, HWPX, DOCX, PPTX, XLSX |
| Max file size | 25 MB |
| Timeout | 10 minutes |
| Rate limit | 10 requests per minute |

### Basic Usage

**Endpoint**:

```
POST https://datainsight-api.polarisoffice.com/api/v1/datainsight/doc-extract
```

**Extract a document with Python:**

```python
import requests
import json
import zipfile
import io

def extract_document(file_path: str, api_key: str) -> dict:
    with open(file_path, "rb") as f:
        response = requests.post(
            "https://datainsight-api.polarisoffice.com/api/v1/datainsight/doc-extract",
            headers={"x-po-di-apikey": api_key},
            files={"file": f}
        )

    if response.status_code != 200:
        raise Exception(f"API error: {response.status_code} - {response.text}")

    # Response is a ZIP file
    zip_buffer = io.BytesIO(response.content)
    with zipfile.ZipFile(zip_buffer) as z:
        json_files = [name for name in z.namelist() if name.endswith('.json')]
        if json_files:
            with z.open(json_files[0]) as jf:
                return json.load(jf)

    raise Exception("No JSON found in ZIP")

# Example usage
import os
api_key = os.environ["POLARIS_DATAINSIGHT_API_KEY"]
schema = extract_document("report.docx", api_key)
print(f"Extracted {schema['totalPages']} pages")
```

**Extract with curl:**

```bash
curl -X POST "https://datainsight-api.polarisoffice.com/api/v1/datainsight/doc-extract" \
  -H "x-po-di-apikey: $POLARIS_DATAINSIGHT_API_KEY" \
  -F "[email protected]" \
  --output result.zip

unzip result.zip -d result/
cat result/*.json | python -m json.tool
```

---

## Advanced Usage

### Response Structure (unifiedSchema)

**Root:**

```json
{
  "docName": "sample.docx",
  "totalPages": 3,
  "pages": [ ... ]
}
```

**Page (`pages[]`):**

```json
{
  "pageNum": 1,
  "pageWidth": 595.3,
  "pageHeight": 842.0,
  "extractionSummary": {
    "text": 5, "image": 2, "table": 1, "chart": 1
  },
  "elements": [ ... ]
}
```

**Element types (`elements[].type`):**

| type | Description |
|------|-------------|
| `text` | Text block |
| `image` | Image |
| `table` | Table |
| `chart` | Chart |
| `shape` | Shape |
| `equation` | Equation |
| `header` / `footer` | Header / Footer |

**Common element structure:**

```json
{
  "type": "text",
  "id": "te1",
  "boundaryBox": { "left": 40, "top": 80, "right": 300, "bottom": 120 },
  "content": { "text": "Body content here" }
}
```

**Table content:**

```json
{
  "content": {
    "html": "<table>...</table>",
    "csv": "Header1,Header2\nValue1,Value2",
    "json": [
      {
        "metrics": { "rowaddr": 0, "coladdr": 0, "rowspan": 1, "colspan": 1 },
        "para": [{ "content": [{ "text": "Cell content" }] }]
      }
    ]
  }
}
```

**Chart content:**

```json
{
  "content": {
    "chart_type": "column",
    "title": "Annual Sales Comparison",
    "x_axis_labels": ["Q1", "Q2", "Q3", "Q4"],
    "series_names": ["2023", "2024"],
    "series_values": [[100, 200, 150, 300], [120, 220, 180, 320]],
    "csv": "Quarter,2023,2024\nQ1,100,120\nQ2,200,220"
  }
}
```

### Usage Patterns

**Extract all text:**

```python
def get_all_text(schema: dict) -> str:
    texts = []
    for page in schema.get("pages", []):
        for el in page.get("elements", []):
            if el["type"] == "text" and el.get("content", {}).get("text"):
                texts.append(el["content"]["text"])
    return "\n".join(texts)
```

**Extract tables as CSV:**

```python
def get_tables_as_csv(schema: dict) -> list:
    tables = []
    for page in schema.get("pages", []):
        for el in page.get("elements", []):
            if el["type"] == "table":
                csv_data = el.get("content", {}).get("csv", "")
                if csv_data:
                    tables.append(csv_data)
    return tables
```

**Generate RAG chunks:**

```python
def make_rag_chunks(schema: dict) -> list:
    chunks = []
    doc_name = schema.get("docName", "")
    for page in schema.get("pages", []):
        for el in page.get("elements", []):
            text = el.get("content", {}).get("text") or el.get("content", {}).get("csv") or ""
            if text.strip():
                chunks.append({
                    "source": doc_name,
                    "page": page["pageNum"],
                    "type": el["type"],
                    "text": text.strip()
                })
    return chunks
```

---

## Example

**User:** "Extract all table data from this DOCX report as CSV."

**Output:**

```python
import os
schema = extract_document("report.docx", os.environ["POLARIS_DATAINSIGHT_API_KEY"])
tables = get_tables_as_csv(schema)
for i, csv_data in enumerate(tables):
    print(f"=== Table {i+1} ===")
    print(csv_data)
```

```
=== Table 1 ===
Quarter,Revenue,Cost
Q1,1200,800
Q2,1500,900

=== Table 2 ===
Item,Amount
Labor,500
Operations,300
```

**Inspired by:** Polaris Office DataInsight API documentation and workflow.

---

## Tips

- The response is always a **ZIP file**. Do not try to parse `response.content` directly as JSON — use `zipfile.ZipFile` to extract it first.
- `content.csv` is available for both `table` and `chart` elements, making it the most convenient format for data extraction.
- The rate limit is 10 requests per minute. When processing multiple files, add a delay (e.g., `time.sleep(6)`) between calls.
- Use `boundaryBox` to determine where each element sits on the page — useful for layout analysis.
- Always store the API key in an environment variable (`POLARIS_DATAINSIGHT_API_KEY`) and never hardcode it.

---

## Common Use Cases

- **Document search systems**: Extract full text and store it in a vector database for semantic search
- **Automated report analysis**: Collect table and chart data from PPTX/DOCX reports for analysis
- **HWP digitization**: Convert HWP/HWPX documents into structured, machine-readable data
- **RAG pipeline setup**: Split documents into chunks for use in LLM-based Q&A systems
- **Data migration**: Move table and chart data from legacy Office documents into a database

---

## License & Terms

- **Skill Definition:** This `SKILL.md` file is provided under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license.
- **Service Access:** Usage of the DataInsight API requires a valid subscription or license key.
- **Restrictions:** Unauthorized redistribution of the API endpoints or bypassing authentication is strictly prohibited.
- **Support:** For licensing inquiries, visit [https://datainsight.polarisoffice.com](https://datainsight.polarisoffice.com).

「数据分析」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。