{"id":207,"date":"2026-04-03T13:08:14","date_gmt":"2026-04-03T18:08:14","guid":{"rendered":"https:\/\/www2.dataunfold.com\/?post_type=docs&#038;p=207"},"modified":"2026-04-03T13:10:56","modified_gmt":"2026-04-03T18:10:56","password":"","slug":"widgets","status":"publish","type":"docs","link":"https:\/\/www2.dataunfold.com\/?docs=widgets","title":{"rendered":"Widgets"},"content":{"rendered":"\n<p><strong># Deep Guide: Widgets in DataUnfold<\/strong><\/p>\n\n\n\n<p>This guide is a comprehensive, step-by-step reference for using Widgets in DataUnfold. It covers concepts, creation, configuration, triggers, common widget types, examples, troubleshooting, and a QA checklist.<\/p>\n\n\n\n<p><strong>## Overview \u2705<\/strong><\/p>\n\n\n\n<p>Widgets are project-level summaries and analytics that aggregate evidence extracted from files. Widgets can compute numeric metrics (totals, averages), extract structured values (names, dates), or provide textual summaries driven by AI.<\/p>\n\n\n\n<p>Widgets depend on:<\/p>\n\n\n\n<p>&#8211; Ingested files (evidence)<\/p>\n\n\n\n<p>&#8211; Tags and smart-tags (to identify what to extract)<\/p>\n\n\n\n<p>&#8211; Post-processing and widget rebuild actions (to aggregate and produce final answers)<\/p>\n\n\n\n<p><strong>## Widget concepts &amp; vocabulary \ud83d\udd0d<\/strong><\/p>\n\n\n\n<p>&#8211; <strong>**Tag**<\/strong>: Named field used as evidence (event-scope or project-scope). Widgets commonly consume <em>*event-scope*<\/em> tags as evidence and store results in a project-scope tag.<\/p>\n\n\n\n<p>&#8211; <strong>**Tag proof \/ Evidence**<\/strong>: Extracted items stored per file that are used to compute widget answers.<\/p>\n\n\n\n<p>&#8211; <strong>**Generate\/Regenerate**<\/strong>: Action to build or rebuild the widget&#8217;s answer from available evidence.<\/p>\n\n\n\n<p>&#8211; <strong>**Scope**<\/strong>: Widgets are project-scoped (they summarize across files), while timeevent tags are tied to individual files.<\/p>\n\n\n\n<p>&#8211; <strong>**Placeholder \/ Variable**<\/strong>: A widget&#8217;s `variable` (unique name) used by other actions and templates to reference the widget&#8217;s latest answer.<\/p>\n\n\n\n<p><strong>## How to add a widget (UI steps) \u2733\ufe0f<\/strong><\/p>\n\n\n\n<p>1. Open a project and go to the <strong>**Widgets**<\/strong> or <strong>**Actions**<\/strong> area.<\/p>\n\n\n\n<p>2. Click <strong>**Add Widget**<\/strong> (or <strong>**Create Widget**<\/strong>).<\/p>\n\n\n\n<p>3. Fill required fields:<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; <strong>**Name**<\/strong>: user-visible label (e.g., &#8220;Total Contract Value&#8221;).<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; <strong>**Variable**<\/strong>: short unique identifier (e.g., `total_contracts`) used in templates and actions.<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; <strong>**Description\/Prompt**<\/strong>: What the widget computes (you can use tags and variables here).<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; <strong>**Filter\/Query (optional)**<\/strong>: Restrict evidence to files matching tags, date ranges, or other criteria.<\/p>\n\n\n\n<p>4. Configure triggers and refresh behavior (manual, on upload, scheduled).<\/p>\n\n\n\n<p>5. Save the widget.<\/p>\n\n\n\n<p><strong>## Widget configuration options (detailed) \u2699\ufe0f<\/strong><\/p>\n\n\n\n<p>&#8211; <strong>**Variable\/Name**<\/strong>: Choose stable short variable names for reuse in templates\/actions.<\/p>\n\n\n\n<p>&#8211; <strong>**Description \/ Prompt**<\/strong>: For AI-driven widgets, the description forms part of the prompt used to aggregate evidence. Include expected output format (e.g., number, short text, JSON) to improve consistency.<\/p>\n\n\n\n<p>&#8211; <strong>**Filters**<\/strong>: Limit which files\/timeevents are considered (by tags, file types, date ranges, or collections).<\/p>\n\n\n\n<p>&#8211; <strong>**Refresh Triggers**<\/strong>:<\/p>\n\n\n\n<p>&nbsp; &#8211; Manual: user clicks <em>*Regenerate*<\/em><\/p>\n\n\n\n<p>&nbsp; &#8211; Automatic on file ingestion: re-run when new files are processed<\/p>\n\n\n\n<p>&nbsp; &#8211; Scheduled: run on a schedule (if available)<\/p>\n\n\n\n<p>&#8211; <strong>**Dependencies**<\/strong>: Some widgets can depend on other widget outputs (be careful to avoid circular dependencies).<\/p>\n\n\n\n<p><strong>## Common widget types &amp; examples \ud83e\udde9<\/strong><\/p>\n\n\n\n<p>1. <strong>**Numeric aggregation**<\/strong> \u2014 e.g., &#8220;Total Contract Value&#8221;<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Evidence: `Amount` smart-tag extracted per file<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Output: single number (sum)<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Description example: &#8220;Sum the values of the `{amount}` tag across all files that have tag `contract` in this project.&#8221;<\/p>\n\n\n\n<p>2. <strong>**Count metrics**<\/strong> \u2014 e.g., &#8220;Number of Contracts&#8221;<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Output: count of files or matched evidences<\/p>\n\n\n\n<p>3. <strong>**List extraction**<\/strong> \u2014 e.g., &#8220;All Named Parties&#8221;<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Output: deduplicated list of party names extracted from files<\/p>\n\n\n\n<p>4. <strong>**Text summary**<\/strong> \u2014 e.g., &#8220;Case Summary&#8221;<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Output: short paragraph summarizing the main findings from the evidence<\/p>\n\n\n\n<p>5. <strong>**Structured JSON output**<\/strong> \u2014 when you need stable machine-readable output for further automation<\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8211; Request JSON with specific keys in the description\/prompt to ensure consistent parsing<\/p>\n\n\n\n<p><strong>## Using widgets in workflows &amp; templates \ud83d\udd17<\/strong><\/p>\n\n\n\n<p>&#8211; Reference a widget in templates and actions via its `variable` (e.g., `{total_contracts}`).<\/p>\n\n\n\n<p>&#8211; Use widget outputs in generated DOCX templates, exports, and other actions to automatically populate reports.<\/p>\n\n\n\n<p><strong>## Regeneration &amp; Scheduling \ud83d\udd04<\/strong><\/p>\n\n\n\n<p>&#8211; Manual regenerate: used to re-run aggregation immediately (useful while reviewing evidence).<\/p>\n\n\n\n<p>&#8211; Automatic regenerate on ingestion: recommended when you want widgets to stay up-to-date as new files arrive.<\/p>\n\n\n\n<p>&#8211; Scheduled runs: use for nightly rebuilds when heavy work or many files exist.<\/p>\n\n\n\n<p><strong>## Troubleshooting widgets \u2014 checklist &amp; common fixes \ud83d\udee0\ufe0f<\/strong><\/p>\n\n\n\n<p>If a widget does not produce the expected answer:<\/p>\n\n\n\n<p>&#8211; Check evidence: Are there `tag_proof` entries for the widget&#8217;s required tags? If not, confirm ingestion succeeded.<\/p>\n\n\n\n<p>&#8211; Confirm filters: Ensure the widget filter\/query is not overly restrictive.<\/p>\n\n\n\n<p>&#8211; Verify post-processing: Confirm the post-processing service is running and processing the `generatewidget` actions.<\/p>\n\n\n\n<p>&#8211; Inspect task queue &amp; logs: Look at active tasks and post-processing logs for errors or timeouts.<\/p>\n\n\n\n<p>&#8211; Avoid circular dependencies: If widget A depends on widget B and vice versa, rebuild will fail or behave unpredictably.<\/p>\n\n\n\n<p>Common error situations and responses:<\/p>\n\n\n\n<p>&#8211; &#8220;No evidence found&#8221;: Re-check tagging \/ smart-tag detection rules and upload a few test documents with the target content.<\/p>\n\n\n\n<p>&#8211; &#8220;Output format invalid&#8221;: Make the description specify a strict output format (e.g., &#8220;Return a single integer&#8221; or JSON with keys).<\/p>\n\n\n\n<p>&#8211; &#8220;Widget stuck in pending state&#8221;: Check message queue, post-processing and websocket services.<\/p>\n\n\n\n<p><strong>## Best practices &amp; tips \ud83d\udca1<\/strong><\/p>\n\n\n\n<p>&#8211; Start small: create simple widgets first (count or sum), validate the evidence extraction, then add complexity.<\/p>\n\n\n\n<p>&#8211; Use strict expected output formats when using widgets in automation (e.g., JSON with explicit keys).<\/p>\n\n\n\n<p>&#8211; Name variables clearly and include a description for team members.<\/p>\n\n\n\n<p>&#8211; For numeric values ensure the tag extraction normalizes formatting\/currencies before aggregation.<\/p>\n\n\n\n<p>&#8211; Document widget behavior in the project description or a shared README if used by multiple team members.<\/p>\n\n\n\n<p><strong>## QA Checklist for widgets \u2705<\/strong><\/p>\n\n\n\n<p>&#8211; [ ] Widget saves successfully and appears in the widget list<\/p>\n\n\n\n<p>&#8211; [ ] Widget variable name is unique and stable<\/p>\n\n\n\n<p>&#8211; [ ] Evidence exists for at least one matching file (verify `tag_proof` rows)<\/p>\n\n\n\n<p>&#8211; [ ] Regenerate returns a valid result (right type and format)<\/p>\n\n\n\n<p>&#8211; [ ] Automatic regeneration triggers when new files are ingested<\/p>\n\n\n\n<p>&#8211; [ ] Actions that consume the widget variable populate templates correctly<\/p>\n\n\n\n<p>&#8211; [ ] No errors or timeouts in post-processing logs<\/p>\n\n\n\n<p>&#8211; [ ] Edge cases tested (no evidence, multiple evidence items, malformed data)<\/p>\n\n\n\n<p><strong>## Example: Create a &#8220;Total Contract Value&#8221; widget (step-by-step) \ud83e\uddfe<\/strong><\/p>\n\n\n\n<p>1. Add widget: Name = &#8220;Total Contract Value&#8221;, Variable = `total_contract_value`.<\/p>\n\n\n\n<p>2. Description: &#8220;Sum the numeric values in the `{contract_value}` tag across all files tagged with `contract`. Return a single number (no currency symbol).&#8221;<\/p>\n\n\n\n<p>3. Filters: Tag = `contract`.<\/p>\n\n\n\n<p>4. Trigger: Regenerate automatically on ingestion.<\/p>\n\n\n\n<p>5. Test: Upload two sample contracts with values $1000 and $2,500. Regenerate and confirm output `3500`.<\/p>\n\n\n\n<p><strong>## Admin notes (service-mode implications) \ud83d\udee1\ufe0f<\/strong><\/p>\n\n\n\n<p>&#8211; Widgets are generated by post-processing service; ensure that service is properly configured and healthy in service-mode deployments.<\/p>\n\n\n\n<p>&#8211; For heavy projects, prefer scheduled regeneration to avoid spikes in processing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Deep Guide: Widgets in DataUnfold This guide is a comprehensive, step-by-step reference for using Widgets in DataUnfold. It covers concepts, creation, configuration, triggers, common widget types, examples, troubleshooting, and a QA checklist. ## Overview \u2705 Widgets are project-level summaries and analytics that aggregate evidence extracted from files. Widgets can compute numeric metrics (totals, averages), [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[5,10],"doc_tag":[],"class_list":["post-207","docs","type-docs","status-publish","hentry","doc_category-getting-started","doc_category-projects"],"year_month":"2026-04","word_count":1024,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"dataunfold","author_nicename":"dataunfold","author_url":"https:\/\/www2.dataunfold.com\/?author=1"},"doc_category_info":[{"term_name":"Getting Started","term_url":"https:\/\/www2.dataunfold.com\/?doc_category=getting-started"},{"term_name":"Projects","term_url":"https:\/\/www2.dataunfold.com\/?doc_category=projects"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=\/wp\/v2\/docs\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=207"}],"version-history":[{"count":1,"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=\/wp\/v2\/docs\/207\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=\/wp\/v2\/docs\/207\/revisions\/208"}],"wp:attachment":[{"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_category&post=207"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www2.dataunfold.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}