EpidBot OpenClaw Skill
Enables AI agents to interact with EpidBot's REST API for analyzing Brazilian public health data. EpidBot uses natural language processing to help users query, download, and analyze health data from DATASUS.
Overview
EpidBot provides access to:
- - Brazilian health data: SINAN disease notifications, SIM mortality, SIH hospital admissions
- International data sources: WHO, PAHO, HealthData.gov, World Bank, ECDC
- Data analysis: Temporal trends, spatial distribution, demographic breakdowns
- Visualizations: Charts, maps, heatmaps, and reports
- SQL queries: Execute DuckDB SQL on parquet files
Authentication
Option 1: API Key (Recommended for agents)
- 1. Login to EpidBot web interface at https://epidbot.kwar-ai.com.br
- Go to Admin Panel -> API Keys -> Create new API key
- Set the API key as an environment variable:
CODEBLOCK0
Option 2: Username/Password (Returns JWT tokens)
CODEBLOCK1
API Base URL
Default: INLINECODE0
Configure via EPIDBOT_BASE_URL environment variable.
Quick Examples
Check API Health
CODEBLOCK2
Send a Chat Message (Async Submit + Poll)
Chat messages are processed asynchronously. Submit a message to get a job_id, then poll for the result.
CODEBLOCK3
List Available Tools
CODEBLOCK4
Tools / Capabilities
chat (async submit)
Submit a chat message for async processing. Returns a job_id immediately. LLM responses typically take 5-120 seconds.
Request:
CODEBLOCK5
Submit Response (200):
CODEBLOCK6
chat_poll
Poll for the status and result of a chat job. Endpoint: INLINECODE2
Recommended polling interval: 2-5 seconds.
Poll Response -- still processing:
CODEBLOCK7
Poll Response -- completed:
CODEBLOCK8
Poll Response -- failed:
CODEBLOCK9
chat_stream (WebSocket)
For streaming responses, connect via WebSocket at:
CODEBLOCK10
Client -> Server Messages:
CODEBLOCK11
Server -> Client Messages:
CODEBLOCK12
list_sessions
List all chat sessions for the authenticated user.
Endpoint: INLINECODE3
Output:
CODEBLOCK13
getsessionmessages
Get message history for a specific session.
Endpoint: INLINECODE4
Output:
CODEBLOCK14
list_reports
List all generated reports.
Endpoint: INLINECODE5
Output:
CODEBLOCK15
get_report
Get full details of a specific report.
Endpoint: INLINECODE6
Output:
CODEBLOCK16
download_report
Download report as a markdown file.
Endpoint: INLINECODE7
Output: File download with Content-Disposition header.
list_tools
List all available agent tools with descriptions.
Endpoint: INLINECODE9
Output:
CODEBLOCK17
Error Handling
All endpoints may return errors:
CODEBLOCK18
Common Status Codes:
- -
400 - Bad Request (invalid input) - INLINECODE11 - Unauthorized (missing/invalid authentication)
- INLINECODE12 - Forbidden (valid auth but insufficient permissions)
- INLINECODE13 - Not Found
- INLINECODE14 - Too Many Requests
- INLINECODE15 - Internal Server Error
Agent Usage Patterns
Pattern 1: Async Chat (Submit + Poll) -- Recommended
CODEBLOCK19
Pattern 2: Streaming Chat (WebSocket)
CODEBLOCK20
Pattern 3: Session-Aware Chat
CODEBLOCK21
Pattern 4: Tool-Based Workflow
CODEBLOCK22
Available Data Sources
Brazilian Data (PySUS)
- - SINAN: Disease notifications (dengue, Zika, chikungunya, measles, etc.)
- SIM: Mortality data
- SIH: Hospital admissions
- CNES: Health facilities
- IBGE: Census and demographic data
International Data
- - WHO/GHO: Global health indicators
- PAHO: Americas health data
- HealthData.gov: US hospital capacity, COVID metrics
- World Bank: Development indicators
- ECDC: European disease surveillance
Specialized
- - Mosqlimate/Infodengue: Brazilian epidemiological parameters
Configuration
| Environment Variable | Default | Description |
|---|
| INLINECODE16 | - | API key for authentication |
| INLINECODE17 |
https://api.epidbot.kwar-ai.com.br | Base URL of EpidBot API |
Rate Limits
| Endpoint | Limit |
|---|
| INLINECODE19 | 10 requests/minute |
| INLINECODE20 |
5 requests/minute |
| Other endpoints | 60 requests/minute |
Deployment
EpidBot is typically deployed via Docker Compose:
CODEBLOCK23
Health check: INLINECODE21
Limitations
- - Job expiry: Chat jobs expire after 1 hour
- File sizes: Large data exports may be limited by memory constraints
- Sandbox execution: Python/SQL code execution happens in an isolated sandbox with resource limits
Support
- - GitHub: https://github.com/fccoelho/EpiDBot
- Documentation: https://github.com/fccoelho/EpiDBot/tree/main/docs
EpidBot OpenClaw 技能
使AI代理能够与EpidBot的REST API交互,用于分析巴西公共卫生数据。EpidBot使用自然语言处理帮助用户查询、下载和分析来自DATASUS的健康数据。
概述
EpidBot提供以下访问权限:
- - 巴西健康数据:SINAN疾病通报、SIM死亡率、SIH住院记录
- 国际数据源:WHO、PAHO、HealthData.gov、世界银行、ECDC
- 数据分析:时间趋势、空间分布、人口统计细分
- 可视化:图表、地图、热力图和报告
- SQL查询:对parquet文件执行DuckDB SQL
身份认证
选项1:API密钥(推荐用于代理)
- 1. 登录EpidBot网页界面 https://epidbot.kwar-ai.com.br
- 进入管理面板 -> API密钥 -> 创建新API密钥
- 将API密钥设置为环境变量:
bash
export EPIDBOTAPIKEY=your-api-key-here
export EPIDBOTBASEURL=https://api.epidbot.kwar-ai.com.br
选项2:用户名/密码(返回JWT令牌)
bash
curl -X POST $EPIDBOTBASEURL/api/v1/auth/login \
-H Content-Type: application/json \
-d {username: user, password: pass}
响应:
{
access_token: eyJ...,
refresh_token: eyJ...,
token_type: bearer,
expires_in: 900
}
API基础URL
默认值:https://api.epidbot.kwar-ai.com.br/api/v1
通过EPIDBOTBASEURL环境变量配置。
快速示例
检查API健康状态
bash
curl -H X-API-Key: $EPIDBOTAPIKEY \
$EPIDBOTBASEURL/api/v1/health
发送聊天消息(异步提交 + 轮询)
聊天消息异步处理。提交消息获取job_id,然后轮询获取结果。
bash
步骤1:提交消息(立即返回job_id)
JOB=$(curl -s -X POST $EPIDBOT
BASEURL/api/v1/chat \
-H X-API-Key: $EPIDBOT
APIKEY \
-H Content-Type: application/json \
-d {message: 显示2023年圣保罗的登革热病例, locale: zh})
JOBID=$(echo $JOB | jq -r .jobid)
步骤2:轮询结果(每3秒)
while true; do
RESULT=$(curl -s $EPIDBOT
BASEURL/api/v1/chat/$JOB_ID \
-H X-API-Key: $EPIDBOT
APIKEY)
STATUS=$(echo $RESULT | jq -r .status)
if [ $STATUS = completed ] || [ $STATUS = failed ]; then
echo $RESULT | jq .
break
fi
sleep 3
done
列出可用工具
bash
curl -H X-API-Key: $EPIDBOTAPIKEY \
$EPIDBOTBASEURL/api/v1/tools
工具/能力
chat(异步提交)
提交聊天消息进行异步处理。立即返回job_id。LLM响应通常需要5-120秒。
请求:
json
{
message: 2023年登革热有哪些可用数据?,
session_id: null,
locale: zh
}
提交响应(200):
json
{
jobid: joba1b2c3d4...,
session_id: 1,
status: processing
}
chat_poll
轮询聊天任务的状态和结果。端点:GET /api/v1/chat/{job_id}
推荐轮询间隔:2-5秒。
轮询响应 -- 仍在处理:
json
{
jobid: joba1b2c3d4...,
status: processing,
created_at: 2024-01-01T00:00:00Z,
updated_at: 2024-01-01T00:00:05Z
}
轮询响应 -- 已完成:
json
{
jobid: joba1b2c3d4...,
status: completed,
session_id: 1,
content: EpidBot可以访问2023年的SINAN登革热数据...,
images: [
],
thinking: 用户正在询问可用数据...,
created_at: 2024-01-01T00:00:00Z,
updated_at: 2024-01-01T00:00:45Z
}
轮询响应 -- 失败:
json
{
jobid: joba1b2c3d4...,
status: failed,
error: 错误消息描述,
created_at: 2024-01-01T00:00:00Z,
updated_at: 2024-01-01T00:00:10Z
}
chat_stream(WebSocket)
用于流式响应,通过WebSocket连接:
wss://api.epidbot.kwar-ai.com.br/api/v1/chat/stream?api_key=
客户端 -> 服务器消息:
json
{type: start, payload: {message: ..., session_id: null, locale: zh}}
{type: cancel}
{type: ping}
服务器 -> 客户端消息:
json
{type: thinking, data: {content: ...}}
{type: chunk, data: {content: ...}}
{type: complete, data: {content: ..., images: [], usage: {...}}}
{type: error, data: {error: ...}}
{type: cancelled}
{type: pong}
list_sessions
列出已认证用户的所有聊天会话。
端点: GET /api/v1/sessions
输出:
json
[
{
id: 1,
name: 登革热分析,
message_count: 12,
created_at: 2024-01-01T00:00:00Z,
updated_at: 2024-01-02T00:00:00Z
}
]
getsessionmessages
获取特定会话的消息历史。
端点: GET /api/v1/sessions/{session_id}/messages
输出:
json
{
session_id: 1,
messages: [
{
id: 1,
role: user,
text_content: 显示登革热数据,
thinking: null,
created_at: 2024-01-01T00:00:00Z
},
{
id: 2,
role: assistant,
text_content: 以下是登革热数据...,
thinking: 用户正在询问...,
created_at: 2024-01-01T00:00:01Z
}
]
}
list_reports
列出所有生成的报告。
端点: GET /api/v1/reports
输出:
json
[
{
id: 1,
title: 2023年登革热分析,
report_type: analysis,
image_count: 3,
contentsizebytes: 15234,
has_pdf: true,
created_at: 2024-01-01T00:00:00Z
}
]
get_report
获取特定报告的完整详情。
端点: GET /api/v1/reports/{report_id}
输出:
json
{
id: 1,
title: 2023年登革热分析,
report_type: analysis,
prompt: 显示登革热病例...,
content: # 登革热分析\n\n...,
image_count: 3,
contentsizebytes: 15234,
has_pdf: true,
created_at: 2024-01-01T00:00:00Z
}
download_report
下载报告为markdown文件。
端点: GET /api/v1/reports/{report_id}/download
输出: 文件下载,包含Content-Disposition头。
list_t