Skip to content

Zio.Report

Form (HTML) + Data (dict) → Final Product. Fill a standard form with values to create an email body or document. The form is referenced by a short access code (uuid). The replacer is a stupid pure function, so what gets filled in is decided by the caller.

Creating and editing forms is also done here — converse with AI, use create to make new ones, read the current HTML with info, and fix it with update. (It’s code that does what you would normally do manually on the web “Report” screen.)

from zio_ontology import Zio
# 양식에 데이터를 채워 완성본(HTML 문자열)을 받는다
html = Zio.report("gGrgQtkY").render({
"subject": "", "sender_name": "",
"verdict": "일반 상품 홍보", "status_label": "스팸으로 판정됨", "status_color": "#c0392b",
"key_findings": ["평판이 낮음", "인증 서명 부재"], # 반복 섹션 {{#key_findings}}{{.}}{{/…}}
})
# 완성본을 도구로 보낸다 (메일 등)
Zio.tools.execute("send_email_via_smtp",
{"to_email": "", "subject": "", "body": html, "is_html": True})
# 새 양식 만들기 → uuid 를 받는다
got = Zio.report.create(
title="스팸 분석 리포트",
body='<div><h3>{{subject}}</h3>'
'<ul>{{#key_findings}}<li>{{.}}</li>{{/key_findings}}</ul></div>',
format="html")
uuid = got["uuid"]
# 샘플 데이터셋 만들기 — format="json" 은 출력 양식이 아니라 "데이터"다.
# body 에 JSON 문자열을 넣는다. html 양식과는 별개의 템플릿으로 등록된다.
Zio.report.create(
title="스팸 분석 리포트 샘플데이터",
body='{"subject": "예시 제목", "key_findings": ["항목 1", "항목 2"]}',
format="json")
# → 웹 저작 미리보기에서 이 json 을 "데이터 소스"로 골라 html 양식을 채워 볼 수 있다.
# 목록
for r in Zio.report.list(): # [{uuid, title, format}]
print(r["uuid"], r["title"])
# 대화하며 고치기: 지금 HTML 을 읽고 → 고쳐서 저장
cur = Zio.report(uuid).info() # {uuid, title, format, body_content, description}
new_html = cur["body_content"].replace("{{subject}}", "제목: {{subject}}")
Zio.report(uuid).update(body=new_html)
Method Description
Zio.report(uuid).render(data) Fills a form with data (dict) and returns the final string. The HTML is inlined and cleaned on the server. It uses the same engine as the preview screen, so it looks exactly the same when you create.
Zio.report.create(title, body, format="html") Creates a new form and returns its uuid. format can be html, text, or json. (For Google Docs, use the web URL.) json is not an output format but a “sample dataset.” If you register a JSON string in body, you can select it as a data source in the web preview to see how the HTML form would look with that data.
Zio.report.list() List of forms: [{uuid, title, format}]. See the body with info().
Zio.report(uuid).info() Current content of that form (including body_content). Read it first before editing.
Zio.report(uuid).update(body=…, title=…) Edits a form. Only the supplied fields change. The server cleans the HTML (preserving rich inline styles).

How to use sample datasets (format="json")

Section titled “How to use sample datasets (format="json")”

When you create an HTML form, you need example data to see how it looks when values are inserted. Register that example separately with a format="json" template.

  • The HTML form and the JSON sample are independent templates; they’re not stored together as a mapping.
  • In the web preview screen, choose one of the registered JSON templates as the data source to fill the current HTML form (you can also paste it manually).
  • When you actually supply values via the SDK, pass a dict directly to render(data) — the JSON template is only for creation and preview convenience.

{{path}} replacement (leave the tag unchanged if missing), {{a.b}} dot path, repeat section {{#list}} … {{/list}} (if an object array, use {{key}}; if a scalar array, use {{.}}).
Do not place a repeat section inside <table>. HTML parsing will push the {{#…}} text out of the table and break the section. Place repeats inside <ul> / <ol> / <div>.

Forms are stored; data is supplied each time

Section titled “Forms are stored; data is supplied each time”

The form (HTML) is created once and reused via its uuid. The data to fill it changes every time you call it — deciding what to fill in (merged collection records + analysis results, etc.) is the caller’s responsibility. render only performs the filling.