Armakuni Contact us
← All case studies

A signed contract waited six months to go live.
Most of that time went on retyping PDF forms.

A U.S. software provider for government agencies and nonprofits spent six to seven months configuring each new customer by hand, and its own staff couldn't query their data without an engineer. We built a pipeline that turns a customer's forms into working configuration for a person to approve, and a way to ask the data a question in plain English, with every query checked before it runs.

Before

Every new county brought its own paperwork.

Once the data was in, nobody could ask it anything.

After
80–90%of form-onboarding effort automated in validation
70%+cut in professional-services cost, targeted

Every new county brought its own paperwork

The company's platform runs case records, therapy visits, billing and compliance for government agencies and nonprofits across counties and states. Winning another county meant taking on its forms, its checklists and its way of working.

The software was built to handle those differences. The people had to configure them by hand. Hundreds of PDF forms became individual fields, validation rules and conditional branches, one at a time. Checklists were built separately, after that. A new contract typically meant six to seven months of onboarding, which delayed the customer's start, deferred the revenue and tied up the people needed for the next implementation.

And once the data was in, nobody could ask it anything

Supervisors, billing staff and compliance managers needed answers from the platform, but getting one meant SQL and an engineer's time. Questions about overlapping visits, unrealistic travel between appointments or duplicate claims could wait days or weeks in a queue. Some problems only came to light in a payer audit.

The platform held the data, but the people who needed it had no way to reach it.

A form is also a set of instructions

The turn was seeing what the implementation team was really copying. A form carries more than the fields someone fills in. Its annotations and instructions also say how the workflow should behave: which fields are required, what depends on an earlier answer, and when another section should appear. Rebuild only the fields and someone still has to rebuild the logic. Read the logic too, and most of the configuration writes itself.

How we built it

6 decisions, in the order we made them. Each one says what we did and why, with what it did drawn beside it.

  1. Each stage of the form pipeline does one job
  2. A person approves every form, and the system learns where it needs them
  3. Text to SQL, grounded in the real schema
  4. Read-only, enforced outside the model
  5. A question asked once becomes a check that runs every day
  6. Sensitive records never leave the account

Each stage of the form pipeline does one job

Built withTextractBedrock
Extract the contentMap fields to the productCarry the rules throughGenerate the workflow
The engineering

The quick version of this is one prompt that turns a PDF into configuration. We built a pipeline combining Amazon Textract and Amazon Bedrock instead, with a separate job for each stage, so each stage can be checked on its own:

  • Extract the source content. Textract reads the text and form content from PDFs. The pipeline accepts PDF and web forms as the starting point.
  • Map fields to the product. The pipeline identifies text inputs, dates, radio buttons and signatures, and writes them in the JSON schema the existing form builder already expects.
  • Carry the rules through. Bedrock reads the annotations and surrounding text to infer required conditions, field dependencies and conditional branches, and those rules go into the generated JSON alongside the fields.
  • Generate the starter workflow. The same metadata and field logic produce a checklist, so the form and its first workflow configuration come out together. Two manual steps that used to run one after the other become one pass.

Writing into the product's own JSON schema means the output lands in the tool the team already uses.

A person approves every form, and the system learns where it needs them

Built withStreamlitDynamoDBLambda
The form generatedA reviewer edits and approvesWhat they changed is recorded 80–90% of form onboarding automated
The engineering

Generated configuration for a government workflow can't go live on a model's say-so. The implementation team checks the generated schema against the source document and the customer's operating rules, in a Streamlit admin interface:

  • A reviewer can inspect the JSON, edit individual fields and approve the configuration before it goes live.
  • The system records what it generated and what a person then changed, which shows exactly which parts of the output still need a person.
  • Amazon DynamoDB holds JSON states and mapping templates, and AWS Lambda coordinates processing.

In validation, 80–90% of the form-onboarding effort was automated. The remaining 10–20% is the edit-and-approve step, kept on purpose so a person signs off every output. The validation covered form extraction, JSON generation and human editing and approval. A full customer implementation will measure how long a whole rollout takes, and what it costs.

Text to SQL, grounded in the real schema

Built withOpenSearchNova ProClaude 3.5 SonnetBedrockAthenaS3
A question in plain English SQL on the real schema the result, explained
The engineering

For the data, we built conversational analytics over what the platform already held. A member of staff types a question in plain English, gets the result and can inspect the records behind it.

A model can't write accurate SQL for a schema it hasn't seen, and guessing column names is where text-to-SQL goes wrong. So the pipeline starts from the database itself:

  • Establish the schema. A dictionary extractor inspects each tenant database and produces sanitized YAML with table names, column names and business descriptions.
  • Retrieve the relevant definitions. Amazon OpenSearch supplies the schema context for each question, so the model works from actual database definitions.
  • Generate the query. Amazon Nova Pro and Claude 3.5 Sonnet, through Amazon Bedrock, handle natural-language-to-SQL generation and result summarization. Generated queries are parameterized.
  • Validate before execution. A separate step checks the generated SQL against access restrictions and execution limits.
  • Run and explain the result. Amazon Athena queries the data in Amazon S3, and the interface returns the results with charts and a plain-language summary.

LangChain handles LLM orchestration and conversation memory. React and AWS Amplify connect it to the portal.

Read-only, enforced outside the model

Built withIAM Identity CenterCognitoAPI GatewayElastiCacheRedisCloudWatch
A generated queryRead-only: no DDL or DMLRoles map to data sourcesRow limitsA 10-second timeout
The engineering

Telling the model to write only safe queries isn't enough, because a model can ignore an instruction, so the execution layer enforces the rules on its own, whatever the model produces:

  • Read-only queries are allowed, and DDL and DML operations are blocked.
  • User roles map to permitted data sources, with IAM Identity Center and Amazon Cognito handling sign-on and role mapping.
  • Row limits bound how much data comes back.
  • A 10-second timeout bounds execution.
  • Amazon API Gateway is the query sandbox's entry point.

Repeated identical queries can come back from an Amazon ElastiCache Redis cache for 30 minutes, which cuts repeat processing and model cost, with cached answers subject to that freshness window. CloudWatch logs every query and result, and sensitive columns can be redacted or hashed according to role.

Why: an instruction in a prompt can be ignored, so the limits that protect the data live where the query runs.

A question asked once becomes a check that runs every day

Built withEventBridgeSNS
New recordsThe daily checkA match Team an alert, with the rows
The engineering

Compliance risks don't go away after one answer. They come back as new records arrive. So we added a rule builder that turns any query into a scheduled monitor:

  • Amazon EventBridge triggers the checks.
  • Amazon SNS and configured Slack or email channels deliver an alert when a condition matches.
  • The alert includes the rows that triggered it, so the team has records to investigate rather than a number.
  • Ten pre-built templates cover high-risk billing scenarios, including overlapping visits, unrealistic travel distances and duplicate billing codes (CPT codes) on the same day.

Sensitive records never leave the account

Built withS3ECSFargateOpenSearchCodePipelineTerraform
A recordInside their AWS account72-hour retention on sourcesRole-based access, audited
The engineering

The platform handles protected health information for government clients, so the deployment was designed around that:

  • Processing stays inside the customer's AWS account under a HIPAA business associate agreement (BAA), with encryption at rest and in transit.
  • Source documents in S3 have a 72-hour retention window, after which they're purged.
  • Role-based access and query audit records go with the analytics workflow.

The deployment design puts Amazon ECS and Fargate application containers in private subnets across two Availability Zones, behind a load balancer, with Amazon OpenSearch in a private subnet too and Auto Scaling on the application tier. GitHub connects to AWS CodePipeline, with AWS CodeBuild, Amazon Elastic Container Registry and AWS CodeDeploy handling build, image and deployment. Terraform defines the infrastructure.

One question, end to end

  1. A billing manager types a question: which visits overlapped last month?
  2. OpenSearch finds the schema it needs from the tenant's sanitized YAML dictionary.
  3. Bedrock writes parameterized SQL, with Nova Pro or Claude 3.5 Sonnet.
  4. The guardrail checks it before it runs: read-only, within the user's role, row-limited, ten seconds at most.
  5. Athena runs it on S3, and the answer comes back as rows, a chart and a plain-language summary. Every query and result is logged.
  6. One click makes it a monitor. EventBridge runs it on a schedule, and an alert with the offending rows goes out the next time it matches.

What we'd tell another CTO

1Read the logic in a document, not only its fields. The annotations on a government form are the configuration nobody wrote down, and they are what turned PDFs into working checklists.
2Record what people change after the model has done its part. The difference between what was generated and what was approved is the most honest measure of where the model can be trusted.
3Once a compliance question has been asked well, schedule it. A risk found once in a billing query should be watched from then on, which is what the rule builder does.

What else changed

  • Forms and starter checklists generated together, in the product's own JSON schema, with a record of every human change.
  • Plain-English questions answered in seconds during validation, with the SQL checked before it runs.
  • Ten compliance monitors ready for the highest-risk billing scenarios, and any question can become another.
  • Two pieces of work run in parallel: 5–6 weeks for form automation and 6–7 weeks for analytics and monitoring.
  • $23,930 of the $26,250 cost was AWS-funded, so the customer paid $2,320.

What comes next

Full production implementation of both. The business is targeting a 70% or greater reduction in professional-services cost and onboarding in weeks rather than six months. Those are targets for the production rollout, not measured savings yet.

There's a product decision too. Conversational analytics, built for internal teams, could become a feature the company offers its own government and nonprofit customers.

How we'd do it today

This project came before our current offers. Here's how we'd approach the same work now.

With AK AI Factory, the schema dictionary would become a domain model the company's experts sign off, kept by Axiom on Amazon DataZone so every AI agent reads "visit" or "claim" the same way and sees only the rows Lake Formation allows. Each AI agent would have its own identity in AgentCore Identity, with its rules, spend limits included, written as Cedar policies in AgentCore Policy and checked on every tool call and no credential ever in the model's context. And because the platform holds protected health information, every control would leave its evidence as it runs, mapped to HIPAA with the company's compliance team during the build rather than before an audit. Where onboarding speed is limited by the product's own code, AK Evolve's AI agents would read the code into specs, characterization tests would pin today's behavior, and each part would be rebuilt behind those tests, one at a time, while the business keeps running.

Have a problem like this one?

A free workshop: a few hours with the architects who'd do the work, on your own systems. No cost.

Book a free workshop