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-FactK12StudentCounts_SpecEdExit

Overview & Purpose

This stored procedure migrates special education exit data from staging tables to the RDS.FactK12StudentCounts fact table. It specifically processes data related to students who have exited special education services within a given school year. The procedure handles data transformation, joins across multiple dimension tables, and ensures proper attribution of demographic and program participation information.

Main Functions:

  • Data Migration

    Transfers special education exit data from staging tables to the fact table with proper dimension keys

Key Calculations:

  • Data Migration: Determines the age of students at the time of the child count

    Formula: Age calculation using RDS.Get_Age(ske.Birthdate, IIF(rdd.DateValue < @ChildCountDate, @PreviousChildCountDate, @ChildCountDate))

    Business Significance: Ensures accurate age reporting for federal/state compliance

    Example: If a student was born on 01/15/2010 and the child count date is 10/01/2021, the age would be 11

Data Transformations:

  • Maps staging table IDs to dimension table surrogate keys

  • Determines student race/ethnicity based on Hispanic/Latino ethnicity flag and race data

  • Links special education exit data with enrollment records to ensure valid reporting periods

  • Updates IDEA status and primary disability information

  • Updates English Learner status information

Expected Output:

Populated RDS.FactK12StudentCounts table with special education exit data, including all relevant dimension keys and a student count of 1 for each record

Business Context

System: K-12 Education Data Reporting System

Necessity: Required for federal and state reporting of special education exit data

Business Rules:

  • Students must have a valid special education program participation end date

  • Students must have enrollment records that overlap with their special education exit date

  • Age is calculated based on the child count date for the reporting period

  • Race/ethnicity is determined based on federal reporting guidelines (Hispanic/Latino takes precedence)

Result Usage:

The data is used for federal reporting requirements, state accountability, and analysis of special education program outcomes

Execution Frequency:

Annually during the federal/state reporting cycle

Critical Periods:

  • End of school year reporting period

  • Federal submission deadlines

Parameters

Parameter
Data Type
Purpose
Required

@SchoolYear

SMALLINT

Specifies the school year for which to process special education exit data

True

Source Tables

Staging.ProgramParticipationSpecialEducation

Business Purpose: Contains information about students' participation in special education programs, including exit dates and reasons

Columns:

Name
Data Type
Business Purpose

Id

int

Unique identifier for the record

StudentIdentifierState

varchar

State-assigned student identifier

ProgramParticipationEndDate

date

Date when student exited special education services

SpecialEducationExitReason

varchar

Reason code for why the student exited special education

Staging.K12Enrollment

Business Purpose: Contains student enrollment information

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

varchar

State-assigned student identifier

EnrollmentEntryDate

date

Date when student enrolled

EnrollmentExitDate

date

Date when student exited enrollment

Birthdate

date

Student's date of birth

Sex

varchar

Student's sex

HispanicLatinoEthnicity

bit

Indicates if student is Hispanic/Latino

Temporary Tables

#vwRaces

Purpose: Temporary storage of race dimension data for the specified school year

Columns:

Name
Data Type
Purpose/Calculation

RaceMap

varchar

Direct copy from RDS.vwDimRaces

RaceCode

varchar

Direct copy from RDS.vwDimRaces

DimRaceId

int

Direct copy from RDS.vwDimRaces

#Facts

Purpose: Temporary storage of fact records before final insert into fact table

Columns:

Name
Data Type
Purpose/Calculation

StagingId

int

Direct copy from Staging.ProgramParticipationSpecialEducation.Id

SchoolYearId

int

Lookup from RDS.DimSchoolYears based on @SchoolYear parameter

FactTypeId

int

Lookup from RDS.DimFactTypes where FactTypeCode = 'specedexit'

StudentCount

int

Hard-coded as 1

#uniqueLEAs

Purpose: Temporary storage of unique LEA information for Title I and Migrant updates

Columns:

Name
Data Type
Purpose/Calculation

LeaIdentifierSea

VARCHAR(50)

Direct copy from Staging.K12Organization

LEA_RecordStartDateTime

DATETIME

Direct copy from Staging.K12Organization

LEA_RecordEndDateTime

DATETIME

Direct copy from Staging.K12Organization

Potential Improvements

Error Handling

Description: Enhance error handling to include more specific error messages and handling for different types of errors

Benefits: Better troubleshooting and more robust execution

Priority: Medium

Performance

Description: Add appropriate indexes to temp tables to improve join performance

Benefits: Faster execution, especially for large datasets

Priority: Medium

Code Structure

Description: Modularize the procedure by breaking it into smaller, reusable components

Benefits: Improved maintainability and potential code reuse

Priority: Low

Execution Steps

Step 1: Initialize variables and clean up any existing temp tables

Input Data: None

Transformations: None

IF OBJECT_ID(N'tempdb..#Facts') IS NOT NULL DROP TABLE #Facts

Step 2: Set up variables for date calculations and lookups

Input Data: App.ToggleQuestions, App.ToggleResponses, RDS.DimSchoolYears

Transformations: Calculate child count date and reference period dates

SELECT @ChildCountDate = CAST(CAST(@SchoolYear - 1 AS CHAR(4)) + '-' + CAST(MONTH(@ChildCountDate) AS VARCHAR(2)) + '-' + CAST(DAY(@ChildCountDate) AS VARCHAR(2)) AS DATE)

Step 3: Create and populate temporary tables

Input Data: RDS.vwDimRaces

Transformations: Copy race dimension data for the specified school year

SELECT * INTO #vwRaces FROM RDS.vwDimRaces WHERE SchoolYear = @SchoolYear

Step 4: Delete existing fact records for the specified school year and fact type

Input Data: RDS.FactK12StudentCounts

Transformations: None

DELETE RDS.FactK12StudentCounts WHERE SchoolYearId = @SchoolYearId AND FactTypeId = @FactTypeId

Step 5: Create and populate #Facts temp table with base data

Input Data: Multiple staging and dimension tables

Transformations: Join staging data with dimension tables to get surrogate keys

INSERT INTO #Facts SELECT...

Step 6: Create and populate #uniqueLEAs temp table

Input Data: Staging.K12Organization

Transformations: Filter for LEAs that are reported federally

INSERT INTO #uniqueLEAs SELECT DISTINCT...

Step 7: Update #Facts with IDEA data

Input Data: Staging.ProgramParticipationSpecialEducation, Staging.IdeaDisabilityType

Transformations: Join to get IDEA status and disability information

UPDATE #Facts SET IdeaStatusId = ISNULL(rdis.DimIdeaStatusId, -1)...

Step 8: Update #Facts with English Learner data

Input Data: Staging.PersonStatus

Transformations: Join to get English Learner status information

UPDATE #Facts SET EnglishLearnerStatusId = ISNULL(rdels.DimEnglishLearnerStatusId, -1)...

Step 9: Insert data from #Facts into RDS.FactK12StudentCounts

Input Data: #Facts

Transformations: None

INSERT INTO RDS.FactK12StudentCounts (...) SELECT ... FROM #Facts

Step 10: Rebuild indexes on fact table

Input Data: RDS.FactK12StudentCounts

Transformations: None

ALTER INDEX ALL ON RDS.FactK12StudentCounts REBUILD

PreviousStaging.Staging-to-FactK12StudentCounts_NeglectedOrDelinquentNextStaging.Staging-to-FactK12StudentCourseSections

Was this helpful?