Reporting
AuraScore 79/100

People Analytics Monthly Headcount and Attrition ETL Script Generator

Generate an automated Python data extraction and aggregation script for monthly HR headcount and turnover reporting.

Use this template when configuring automated pipelines to calculate HR metrics from raw HRIS event logs. It generates production-grade ETL scripts tailored to leadership headcount review cadences.

Template

Role: Staff People Analytics Engineer specializing in automated workforce reporting pipelines.

Context

  • HRIS data structure: {{hris_source_format}}
  • Target cadence: {{target_reporting_cadence}}
  • Organization grouping: {{business_unit_hierarchy}}
  • Turnover calculation logic: {{attrition_calculation_rule}}
  • Storage destination: {{output_storage_destination}}
  • Threshold alert trigger: {{alert_threshold_turnover}}

Task

Write a self-contained, modular Python reporting script that ingests HRIS transaction records, computes monthly active headcount and annualized voluntary/involuntary turnover across organizational tiers, flags departments exceeding baseline churn thresholds, and publishes the summarized metric table to the designated storage destination.

Method

  1. Ingest raw log data based on {{hris_source_format}} with strict column type validation and date parsing.
  2. Apply snapshot interval logic matching {{target_reporting_cadence}} to isolate active employee states on baseline measurement dates.
  3. Segment employee census counts across {{business_unit_hierarchy}} dimensions including tenure bands and job families.
  4. Calculate voluntary and involuntary separation rates strictly following {{attrition_calculation_rule}}.
  5. Flag any business unit or department that breaches {{alert_threshold_turnover}} during the reporting cycle.
  6. Format output dataset into normalized reporting schemas with standardized metric naming conventions.
  7. Implement destination push handlers to transfer aggregated data cleanly to {{output_storage_destination}} with error handling.

Constraints

  • Code MUST be written in clean Python 3.10+ using pandas or polars with complete type hints.
  • MUST NOT hardcode credentials or connection strings; load all secrets via environment variables.
  • MUST handle missing termination reason codes gracefully by classifying them into an unmapped category.
  • Include inline logging for every major transformation stage to facilitate pipeline observability.

Output format

Provide the response in the following sequence:

  1. Architecture Overview (1 brief paragraph describing data flow).
  2. Complete Python Script (single executable code block containing imports, config class, transformation functions, and main execution block).
  3. Operational Instructions (concise deployment checklist with required environment variables).

Self-review

  • Confirm all 6 context variables are actively utilized in the code logic or configuration block.
  • Verify the turnover rate formulas strictly adhere to {{attrition_calculation_rule}}.
  • Ensure exception handling covers empty source batches and failed storage uploads.
AuraScore breakdown
79/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 engineering10/12 · Adequate

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-reporting
research-productivity-operations
people-analytics
python
hr-reporting