# "Why Did We Miss Target?" -- Ask Snowflake CoWork, Get the Root-Cause PDF

DevFeed: ["Why Did We Miss Target?" -- Ask Snowflake CoWork, Get the Root-Cause PDF](<https://devfeed.tech/articles/why-did-we-miss-target-ask-snowflake-cowork-get-the-root-cause-pdf-88062.md>)

Original publisher: [Read original article](<https://medium.com/snowflake/why-did-we-miss-target-ask-snowflake-cowork-get-the-root-cause-pdf-1b937dbbc2f7?source=rss----34b6daafc07---4>)

Author: Christopher Vimal Selvadurai

Published: 2026-10-14T19:01:02Z

Content type: tutorial

Language: en

Sources: [Snowflake Builders](<https://devfeed.tech/sources/snowflake-builders.md>)

Topics: [Snowflake streaming data architecture](<https://devfeed.tech/topics/snowflake-streaming-data-architecture.md>), [atlassian automated rca](<https://devfeed.tech/topics/atlassian-automated-rca.md>)

Tags: [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [cowork](<https://devfeed.tech/tags/cowork.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [ddl](<https://devfeed.tech/tags/ddl.md>), [docker](<https://devfeed.tech/tags/docker.md>), [powerpoint](<https://devfeed.tech/tags/powerpoint.md>), [python](<https://devfeed.tech/tags/python.md>), [rca](<https://devfeed.tech/tags/rca.md>), [snowflake](<https://devfeed.tech/tags/snowflake.md>), [snowflake-cortex-agent](<https://devfeed.tech/tags/snowflake-cortex-agent.md>)

## AI overview

This tutorial describes a Snowflake stored procedure that analyzes missed manufacturing production targets, renders a self-contained HTML root-cause report, and converts it to PDF using WeasyPrint from Snowflake's PyPI Artifact Repository. It explains the report calculations, the limitations encountered with other PDF libraries, and how a Snowflake Cortex Agent can return a download link for the report.

## Source excerpt

Analysts used to pull data from several systems, build a PowerPoint and email versions of it. Now one question returns a production-grade RCA PDF, all inside Snowflake, with no SPCS and no Docker. Every shift change in a manufacturing plant starts with the same questions: why did we miss target, what actually caused it, and can we recover it next shift? A 24/7 line short of its daily production target needs more than an "equipment issues" shrug -- it needs a quantified variance bridge: top causes, impact in units, what's recoverable, what to action first. Today, that takes an analyst and one or two reviewers 3-6 hours, pulling from four source systems and assembling a PowerPoint that usually goes through a revision or two before it ships around noon. By then, the next shift has already started blind. We built something different: one stored procedure call that queries the data, computes the root-cause analysis, renders a styled HTML report, converts it to a polished PDF, and hands back a download link -- entirely inside Snowflake. Now, the shift supervisor or plant manager simply asks in CoWork (Snowflake's personal agent for knowledge workers, formerly Snowflake Intelligence) and get a finished PDF back in 5 minutes, in time to brief the incoming shift before it starts, not after. That frees the analyst from manual report-building to focus on higher-value work: strengthening the underlying data and driving adoption of the system across the plant. Here's how we built it, the dead ends we hit along the way, and the surprisingly simple fix that made it work. GitHub repo: The complete code -- engine, sample data generator, and DDL -- is available at repo. Clone it, point it at your own views, and adapt the reason-bucketing to your domain. Why We Started With a Spec, Not Code Before writing a line of code, we defined what the system must do using structured requirements. This isn't ceremony for its own sake -- it's about making technology choices testable instead of hoping t