Generate Documentation
CIIDCIID-ReportsG3GitHub
  • Introduction to Generate
  • User Guide
    • Getting Started
      • Requesting Generate
      • User Roles and Logging In
      • Navigating Generate
    • Resources
    • Data Population Summary
      • Producing Reports
      • Reports
      • Running Reports
    • Standard Reports
      • EDFacts Reports
        • Creating Submission Files
      • SPP/APR Reports
      • Reports Library
    • Settings
      • Toggle
      • Update
      • Metadata
      • Data Migration
    • Quality Assurance
    • Support
  • Developer Guides
    • Getting Started
    • Installation
      • OAuth Configuration
      • Configuring Metadata Updates
      • Subfolder configuration
      • Optional Installations
      • Azure Installation Guide
      • Upgrade
        • Generate Update
        • Optional Installations
    • Migration
      • Fact Type Table
        • Assessment Fact Type
        • Child Count Fact Type
        • Directory Fact Type
        • Discipline Fact Type
        • Exiting Fact Type
        • Membership
        • Staff
    • Generate Utilities
      • File Comparison
        • Loading Files
        • Run the File Comparison
        • Reviewing Results
        • Researching Mismatches
      • Staging Validation
        • Staging Table Validation Process
      • Rebuild Indexes
      • Cleanup Grades Offered
      • Cleanup Debug Tables
      • Source System Reference Data Mapping Utility
        • Source System Reference Data
      • Staging Table Snapshot
      • Fact Type Table Validation Process
      • Debug Views for Staging and the Fact tables
    • Generate Architecture
    • GitHub Guide
    • Discord Guide
    • Working With Generate Code
      • Migration Stored Procedures
        • Staging.RUN_DMC
        • RDS.Get_MembershipReportData
        • Staging.Staging-to-DimPeople
        • Staging.Staging-To-DimPeople_K12Students
        • Staging.Staging-to-FactK12ProgramParticipations
        • Staging.Staging-To-FactK12SeclusionsOrRestraints
        • Staging.Staging-to-FactK12StudentCounts_ChildCount
        • Staging.Staging-to-FactK12StudentCounts_Chronic
        • Staging.Staging-to-FactK12StudentCounts_Dropout
        • Staging.Staging-to-FactK12StudentCounts_GraduationRate
        • Staging.Staging-to-FactK12StudentCounts_Homeless
        • Staging.Staging-to-FactK12StudentCounts_HSGradPSEnroll
        • Staging.Staging-to-FactK12StudentCounts_Membership
        • Staging.Staging-to-FactK12StudentCounts_MigrantEducationProgram
        • Staging.Staging-to-FactK12StudentCounts_NeglectedOrDelinquent
        • Staging.Staging-to-FactK12StudentCounts_SpecEdExit
        • Staging.Staging-to-FactK12StudentCourseSections
        • Staging.Staging-to-FactK12StudentDisciplines
        • Staging.Staging-to-FactK12StudentEnrollments
        • Staging.Staging-To-FactSpecialEducation
      • Unit Test By File Spec
        • App.DimK12Staff_TestCase
        • App.DimK12Students_TestCase
        • App.FS002_TestCase
        • App.FS005_TestCase
        • App.FS006_TestCase
        • App.FS007_TestCase
        • App.FS009_TestCase
        • App.FS032_TestCase
        • App.FS033_TestCase
        • App.FS040_TestCase
  • Release Notes
    • Introduction
    • Release Notes 12.4
    • Release Notes 12.3
    • Release Notes 12.2
    • Release Notes 12.1
    • Archive
      • Release Notes 12.0
      • Release Notes 11.4
      • Release Notes 11.3
      • Release Notes 11.2
      • Release Notes 11.1
      • Release Notes 11.0
      • Release Notes 5.3
        • Generate 5.3 Office Hour
      • Release Notes 5.2
        • Generate 5.2 Office Hour
      • Release Notes 5.1
        • Generate 5.1 Office Hour
      • Release Notes 5.0
        • Generate 5.0 Office Hour
      • Release Notes 4.1
      • Release Notes 4.0
      • Release Notes 3.8
      • Release Notes 3.7
      • Release Notes 3.6
      • Release Notes 3.5
      • Release Notes 3.4
      • Release Notes 3.3
      • Release Notes 3.2
      • Release Notes 3.1
      • Release Notes 3.0
      • Release Notes 2.4
    • Release Notes 12.3
  • Hot Fixes
    • Hot Fix - 4/13/2023
Powered by GitBook
On this page
  • Overview & Purpose
  • Business Context
  • Parameters
  • Source Tables
  • Temporary Tables
  • Potential Improvements
  • Execution Steps

Was this helpful?

Edit on GitHub
  1. Developer Guides
  2. Working With Generate Code
  3. Migration Stored Procedures

Staging.Staging-to-FactK12ProgramParticipations

Overview & Purpose

This stored procedure transfers K12 program participation data from staging tables to the fact table RDS.FactK12ProgramParticipations and populates the bridge table RDS.BridgeK12ProgramParticipationRaces. It performs data transformation, lookups to dimension tables, and handles various data relationships for K12 student program participation tracking.

Main Functions:

  • Data Transfer from Staging to Fact Table

    Moves K12 program participation data from staging tables to the fact table with proper dimension key lookups

Key Calculations:

  • Data Transfer from Staging to Fact Table: Sets the count measure for each program participation record

    Formula: StudentCount = 1

    Business Significance: Enables counting of student participation in various programs

    Example: Each row in the fact table represents one student's participation with StudentCount = 1

Data Transformations:

  • Joining multiple staging tables to collect complete program participation data

  • Looking up dimension keys from various dimension tables

  • Handling NULL values with ISNULL function to default to -1 for dimension keys

  • Updating student IDs that may have been missed in the initial lookup

  • Creating race bridge table entries based on student race and ethnicity data

Expected Output:

Populated RDS.FactK12ProgramParticipations table with dimension keys and measures, and populated RDS.BridgeK12ProgramParticipationRaces bridge table with race relationships

Business Context

System: K12 Education Data Warehouse

Necessity: Tracking student participation in various educational programs for reporting and analysis

Business Rules:

  • Student identification uses multiple matching criteria including state ID and demographic information

  • Program participation is tracked with entry and exit dates

  • Race and ethnicity are handled through a bridge table to support multiple race values per student

  • Special education status and educational environments are tracked for IDEA reporting

Result Usage:

Reporting on student program participation for compliance, funding, and educational outcome analysis

Execution Frequency:

Likely executed during regular ETL processes, possibly daily or weekly

Critical Periods:

  • End of school year reporting periods

  • State and federal education reporting deadlines

Parameters

Parameter
Data Type
Purpose
Required

@DataCollectionName

VARCHAR(60)

Filters processing to a specific data collection if provided

False

Source Tables

Staging.K12ProgramParticipation

Business Purpose: Stores staging data about student participation in educational programs

Columns:

Name
Data Type
Business Purpose

DataCollectionName

VARCHAR

Identifies the source data collection

Staging.K12Enrollment

Business Purpose: Stores staging data about student enrollment in schools

Columns:

Name
Data Type
Business Purpose

Id

INT

Primary key for the enrollment record

Staging.PersonStatus

Business Purpose: Stores staging data about person status information

Staging.ProgramParticipationSpecialEducation

Business Purpose: Stores staging data about special education program participation

Staging.K12PersonRace

Business Purpose: Stores staging data about student race information

Temporary Tables

#Facts

Purpose: Temporary storage of transformed fact data before insertion into fact table

Columns:

Name
Data Type
Purpose/Calculation

StagingId

INT

Direct assignment from Staging.K12Enrollment.Id

#temp

Purpose: Temporary storage for race bridge table data preparation

Columns:

Name
Data Type
Purpose/Calculation

FactK12ProgramParticipationId

INT

Direct assignment from fact table primary key

Potential Improvements

Error Handling

Description: Add explicit error handling with TRY/CATCH blocks

Benefits: Better error reporting and recovery

Priority: High

Transaction Management

Description: Add explicit transaction control

Benefits: Ensures data consistency across related tables

Priority: Medium

Performance

Description: Add indexes to temporary tables

Benefits: Improved query performance for complex joins

Priority: Medium

Code Maintainability

Description: Refactor complex joins into modular components

Benefits: Improved readability and maintainability

Priority: Low

Execution Steps

Step 1: Create temporary table for fact data

Input Data: None

Transformations: Table structure creation

CREATE TABLE #Facts (...)

Step 2: Populate temporary fact table with transformed data

Input Data: Multiple staging tables joined together

Transformations: Dimension key lookups, NULL handling

INSERT INTO #Facts SELECT DISTINCT ...

Step 3: Update student IDs that may have been missed

Input Data: #Facts table and dimension tables

Transformations: Additional lookups for missing student IDs

UPDATE #Facts SET K12StudentId = p.DimPersonId ...

Step 4: Insert data into fact table

Input Data: #Facts temporary table

Transformations: Final NULL handling

INSERT INTO RDS.FactK12ProgramParticipations SELECT DISTINCT ...

Step 5: Rebuild indexes on fact table

Input Data: None

Transformations: None

ALTER INDEX ALL ON RDS.FactK12ProgramParticipations REBUILD

Step 6: Create temporary table for race bridge data

Input Data: Fact table and staging tables

Transformations: Join fact data with race information

SELECT DISTINCT ... INTO #temp FROM ...

Step 7: Populate race bridge table

Input Data: #temp temporary table

Transformations: Race mapping logic

Insert Into RDS.BridgeK12ProgramParticipationRaces ...

Step 8: Clean up temporary tables

Input Data: None

Transformations: None

DROP TABLE IF EXISTS #temp

PreviousStaging.Staging-To-DimPeople_K12StudentsNextStaging.Staging-To-FactK12SeclusionsOrRestraints

Was this helpful?