Skip to main content
Loading navigation
Back to prompt library

Build a Chronological Ledger Narrative and Documentary Missing-Link Annotator — implementation

Linked challenge: Build a Chronological Ledger Narrative and Documentary Missing-Link Annotator

Prompt source

implementation91 lines11 sectionsNo variables1 code block
## Build
Draft chronological narrative summaries from normalized account ledgers. Highlight critical documentary omissions by cross-referencing tabular completeness against provided supporting invoices and contracts.

## User
Financial Crime Case Preparer

## Workflow
1. Ingest simplified normalized ledger entries containing sender, receiver, timestamp, and purpose fields.
2. Validate ledger tabular completeness against required schema fields using Frictionless Data, focusing on attachment references.
3. Draft an objective chronological narrative describing the fund flow sequence across all verified accounts.
4. Compile an explicit list of missing-link annotations where tabular records lack corresponding external documentary references.

## Interface
A two-pane narrative review window with editable summary paragraphs alongside flagged tabular missing-link annotations.

## Data
Generate synthetic business transaction batches with deliberately omitted supporting invoice references and transport documents to test missing-link detection.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Frictionless data validation](https://raw.githubusercontent.com/frictionlessdata/frictionless-py/main/README.md)
Frictionless Data validation concepts to check transaction ledger completeness against schema expectations.

## Tools
dspy, frictionless, pydantic.
Optimizes narrative compilation prompts to systematically highlight evidence gaps without hallucinations.
Local or cloud LLM with strong zero-shot summarization and tabular factual reasoning.

## 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
- Drafts chronological summaries describing all transactions in the ingested fixture.
- Accurately isolates specific transaction IDs lacking mandatory documentary references based on tabular completeness rules.
- Generates clean Markdown and JSON output formats ready for senior investigator review.

## Starter Examples
```json
[
  {
    "input": {
      "case_id": "CASE-1049",
      "transactions": [
        {
          "tx_id": "TX-01",
          "amount": 45000,
          "currency": "EUR",
          "sender": "Alpha Ltd",
          "receiver": "Beta SA",
          "doc_attached": "INV-2023-99"
        },
        {
          "tx_id": "TX-02",
          "amount": 42000,
          "currency": "EUR",
          "sender": "Beta SA",
          "receiver": "Gamma Inc",
          "doc_attached": null
        }
      ]
    },
    "expected_output": {
      "case_id": "CASE-1049",
      "narrative": "Alpha Ltd transferred 45,000 EUR to Beta SA supported by INV-2023-99. Beta SA subsequently transferred 42,000 EUR to Gamma Inc.",
      "missing_link_annotations": [
        {
          "tx_id": "TX-02",
          "missing_field": "doc_attached",
          "reason": "Missing supporting external documentary reference."
        }
      ],
      "ready_for_review": false
    }
  },
  {
    "input": {
      "case_id": "CASE-1050",
      "transactions": [
        {
          "tx_id": "TX-03",
          "amount": 10000,
          "currency": "USD",
          "sender": "Acme Corp",
          "receiver": "Delta LLC",
          "doc_attached": "PO-8812"
        }
      ]
    },
    "expected_output": {
      "case_id": "CASE-1050",
      "narrative": "Acme Corp remitted 10,000 USD to Delta LLC verified by purchase order PO-8812.",
      "missing_link_annotations": [],
      "ready_for_review": true
    }
  }
]
```

## Safety
Narratives are purely descriptive without accusatory legal claims or regulatory filing triggers. Examples are simplified synthetic app records.
Use mock external writes. Require human review before any real deployment.