Back to prompt library
Build a Transaction Narrative Drafter with Evidence Gap Detection — implementation
Linked challenge: Build a Transaction Narrative Drafter with Evidence Gap Detection
Prompt source
implementation134 lines11 sectionsNo variables1 code block
## Build
Synthesize chronological transaction narratives from bank transaction logs while explicitly highlighting missing documentary evidence. Compile investigative case briefs flagging gaps in counterparties, contracts, and shipping notes.
## User
Financial crime intelligence investigator preparing defensible case summaries
## Workflow
1. Ingest chronological synthetic account transaction ledgers paired with attached documentary metadata.
2. Cross-examine each transaction row against expected document types including invoices, bills of lading, and contracts.
3. Identify documentary gaps such as missing proof of delivery or unexplained value discrepancies.
4. Generate a structured narrative brief articulating the fund flow while explicitly itemizing each unverified lead.
## Interface
Command-line CLI and Markdown previewer displaying narrative paragraphs alongside a tabular evidence gap audit matrix.
## Data
A local synthetic fixture containing 15 multi-currency transaction records and associated simulated document manifests.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Frictionless data validation](https://raw.githubusercontent.com/frictionlessdata/frictionless-py/main/README.md)
Applies Frictionless Data tabular validation concepts from Source 3 to verify transaction table structure and missing fields.
## Tools
dspy, frictionless, pydantic.
DSPy allows compiling structured prompt signatures that strictly separate established facts from explicit evidence gaps.
Requires local or remote LLM with strong zero-shot reasoning capabilities to isolate verifiable facts from gaps.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Accurately maps every transaction leg to corresponding proof documents in the narrative summary.
- Generates an explicit list of evidentiary gaps with transaction references and missing document categories.
- Outputs narrative artifacts formatted in structured JSON and Markdown without inventing unsupported transactional facts.
## Starter Examples
```json
[
{
"input": {
"case_id": "CASE-8801",
"transactions": [
{
"tx_id": "TX-101",
"date": "2024-03-01",
"amount": 250000,
"currency": "USD",
"origin": "Apex Minerals LLC",
"destination": "Vanguard Shipping Inc",
"document_refs": [
"INV-101",
"BOL-902"
]
},
{
"tx_id": "TX-102",
"date": "2024-03-04",
"amount": 248500,
"currency": "USD",
"origin": "Vanguard Shipping Inc",
"destination": "Zenith Consulting Group",
"document_refs": []
}
],
"documents": [
{
"doc_id": "INV-101",
"doc_type": "commercial_invoice",
"amount": 250000
},
{
"doc_id": "BOL-902",
"doc_type": "bill_of_lading",
"carrier": "Atlantic Sea"
}
]
},
"expected_output": {
"case_id": "CASE-8801",
"narrative_summary": "On 2024-03-01, Apex Minerals LLC transferred 250,000.00 USD to Vanguard Shipping Inc, supported by commercial invoice INV-101 and bill of lading BOL-902. On 2024-03-04, Vanguard Shipping Inc transferred 248,500.00 USD to Zenith Consulting Group without attached documentary support.",
"evidence_gaps": [
{
"tx_id": "TX-102",
"missing_document_types": [
"commercial_invoice",
"service_agreement"
],
"severity": "HIGH",
"justification": "Rapid outbound fund movement of 248,500.00 USD lacks supporting commercial basis."
}
],
"verified_legs": 1,
"unverified_legs": 1
}
},
{
"input": {
"case_id": "CASE-8802",
"transactions": [
{
"tx_id": "TX-201",
"date": "2024-03-10",
"amount": 50000,
"currency": "EUR",
"origin": "Nordic Timber AB",
"destination": "Baltic Logistics SIA",
"document_refs": [
"INV-550"
]
}
],
"documents": [
{
"doc_id": "INV-550",
"doc_type": "commercial_invoice",
"amount": 75000
}
]
},
"expected_output": {
"case_id": "CASE-8802",
"narrative_summary": "On 2024-03-10, Nordic Timber AB sent 50,000.00 EUR to Baltic Logistics SIA referencing invoice INV-550.",
"evidence_gaps": [
{
"tx_id": "TX-201",
"missing_document_types": [
"partial_payment_authorization",
"bill_of_lading"
],
"severity": "MEDIUM",
"justification": "Transaction amount 50,000.00 EUR differs from invoice face value 75,000.00 EUR; delivery verification missing."
}
],
"verified_legs": 0,
"unverified_legs": 1
}
}
]
```
## Safety
Strictly formats synthetic transaction logs. Does not submit SAR/STR filings to regulatory bodies or accuse individuals.
Use mock external writes. Require human review before any real deployment.