Academic Journal Cost-Per-Use SQL Metric Specification
Develop a SQL query specification to parse COUNTER usage statistics and calculate journal cost-per-use metrics.
Use this template when library systems analysts need to evaluate electronic journal subscriptions and consortium bundles. It produces a structured SQL specification for parsing usage logs, joining invoice data, and computing departmental cost metrics.
Role: Academic Library Systems Analyst specializing in scholarly communications, collection assessment, and bibliometrics.
Context
- Academic library system: {{university_library_system}}
- Subscription analysis window: {{subscription_year}}
- Usage data metric format: {{counter_standard_version}}
- Target relational database: {{target_rdbms}}
- Cost distribution strategy: {{cost_allocation_method}}
- Consortium contract classification: {{journal_consortium_tier}}
Task
Develop an end-to-end SQL transformation specification to ingest COUNTER harvest logs, merge institutional subscription invoice data, and generate departmental cost-per-use intelligence queries for {{university_library_system}}.
Method
- Define raw staging schemas to ingest {{counter_standard_version}} monthly usage reports.
- Standardize ISSN, eISSN, and DOI matching keys to resolve multi-publisher title discrepancies.
- Ingest institutional procurement contract records filtered for {{subscription_year}} and {{journal_consortium_tier}}.
- Implement {{cost_allocation_method}} logic to distribute bundled package costs across academic departments.
- Aggregate total unique item investigations and requests per publication title by fiscal quarter.
- Calculate cost-per-use ratios using safe division logic to prevent runtime division-by-zero errors.
- Formulate SQL analytics views in {{target_rdbms}} that flag subscriptions exceeding cost-efficiency thresholds.
- Author validation queries comparing year-over-year expenditure efficiency across faculties.
Constraints
- MUST implement NULLIF and CASE constructs to guard against division-by-zero during metric calculations.
- MUST utilize dialect-specific optimizations native to {{target_rdbms}} for large usage log scans.
- MUST NOT drop unmapped journal records without routing them to an unresolved staging quarantine table.
- Aggregations MUST retain departmental and consortium split granularity as specified.
Output format
- Metric Specification & Data Pipeline Overview (Summary text and input/output inventory)
- Source Ingestion & Entity Resolution Schema (DDL with constraint keys)
- Cost-Per-Use Calculation SQL Query Views (Documented SQL code blocks with inline logic notes)
- Data Integrity & Verification Query Suite (3-4 diagnostic SQL validation scripts)
Self-review
- Confirm presence and proper formatting of all 6 context variables.
- Verify zero-division safety handling in all cost-per-use ratio expressions.
- Check that {{counter_standard_version}} parsing nuances are handled accurately in the staging DDL.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.