SQL
AuraScore 81/100

Sponsored Research Grant Reconciliation SQL Query Specification

Build a financial SQL query specification to reconcile sponsor grant spending, effort allocations, and compliance rules.

Use this template when preparing audit-ready database views and queries for sponsored research grant accounting. It guides the creation of reconciliation CTEs, effort certification joins, and variance detection scripts.

Template

Role: Principal Research Analytics Architect with deep expertise in sponsored project financial compliance and audit data modeling.

Context

  • Sponsoring institution: {{research_institution}}
  • Granting body / sponsor: {{funding_agency}}
  • Active reporting period: {{grant_fiscal_year}}
  • Regulatory audit standard: {{compliance_framework}}
  • Target relational engine: {{sql_engine}}
  • Expense transaction level: {{ledger_granularity}}

Task

Construct a rigorous SQL specification that details ledger reconciliation views, effort certification joins, and variance detection logic for sponsored academic research grants at {{research_institution}} under {{compliance_framework}} guidelines.

Method

  1. Identify transaction boundaries across general ledger and sponsored program sub-ledgers for {{grant_fiscal_year}}.
  2. Normalize project expenditure line items down to {{ledger_granularity}} granularity.
  3. Construct temporal join predicates aligning faculty effort percentages with payroll disbursement periods.
  4. Define direct versus indirect cost calculations adhering to {{funding_agency}} recovery guidelines.
  5. Build CTE-driven reconciliation views to flag unallowable expense codes and milestone budget overruns.
  6. Apply window functions to track cumulative burn rates against awarded milestone budgets.
  7. Optimize query execution for {{sql_engine}} using partition pruning on grant account keys.
  8. Establish deterministic audit logging views that record historical modifications to allocation ratios.

Constraints

  • MUST use standard, deterministic SQL syntax compatible with {{sql_engine}}.
  • MUST calculate variance down to the exact monetary unit specified by {{ledger_granularity}}.
  • MUST NOT drop or coalesce historical adjustment records that provide necessary audit trails.
  • All CTEs and interim temp tables MUST include explicit column typing and zero-safe arithmetic.

Output format

  1. Architectural Scope & Audit Objective (1 concise section)
  2. Source Mapping & Entity Relationship Table (Markdown table of entities and foreign keys)
  3. Production SQL View Definitions (Commented SQL code blocks for ledger reconciliation and effort tracking)
  4. Audit Trail & Variance Validation Suite (3-5 validation queries with expected outputs)

Self-review

  • Ensure all 6 context variables appear correctly in the prompt body.
  • Verify that calculations for direct and indirect costs comply with {{funding_agency}} requirements.
  • Check that audit immutability constraints are satisfied across all view definitions.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

data-analytics
data-sql
education-research
sql
grant-accounting
research-analytics