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

Overview & Purpose

This stored procedure migrates student discipline data from staging tables to the RDS.FactK12StudentDisciplines fact table. It processes discipline-related data for a specific school year, joining multiple staging tables to gather comprehensive information about student disciplinary actions, including demographic data, school information, and specific discipline details.

Main Functions:

  • Data Migration

    Transfer discipline data from staging tables to the fact table while performing necessary transformations and lookups

Key Calculations:

  • Data Migration: Calculate student age at the time of the child count date

    Formula: Age calculation using RDS.Get_Age(ske.Birthdate, @ChildCountDate)

    Business Significance: Ensures accurate age reporting for disciplinary incidents

    Example: If birthdate is 2005-05-15 and child count date is 2022-10-01, age would be 17

  • Data Migration: Track the length of disciplinary actions

    Formula: DurationOfDisciplinaryAction

    Business Significance: Allows analysis of discipline severity and impact on student education time

    Example: 5.0 days of suspension

Data Transformations:

  • Converting date values to appropriate date IDs for the dimensional model

  • Resolving multiple race records to a single race value using the vwUnduplicatedRaceMap view

  • Mapping staging table codes to dimension table IDs through various view lookups

  • Determining IDEA status based on program participation dates

  • Determining English Learner status based on status dates

Expected Output:

Populated RDS.FactK12StudentDisciplines table with discipline records for the specified school year, with all dimension keys properly resolved

Business Context

System: K-12 Education Data Reporting System

Necessity: Required for federal and state reporting of student discipline incidents and actions

Business Rules:

  • Discipline records must be associated with active student enrollment periods

  • IDEA status is determined based on program participation dates that overlap with the discipline incident

  • English Learner status is determined based on status dates that overlap with the discipline incident

  • Race is determined using a hierarchy: Hispanic/Latino ethnicity takes precedence, followed by multiple race determination

Result Usage:

The populated fact table is used for regulatory reporting, analysis of discipline patterns, and monitoring of equity in disciplinary actions across demographic groups

Execution Frequency:

Annually or as needed when discipline data is updated

Critical Periods:

  • End of school year reporting periods

  • Federal and state education data submission deadlines

Parameters

Parameter
Data Type
Purpose
Required

@SchoolYear

SMALLINT

Specifies the school year for which discipline data should be migrated

True

Source Tables

Staging.Discipline

Business Purpose: Stores discipline incident and action information from source systems

Columns:

Name
Data Type
Business Purpose

Id

int

Primary key for the staging table

StudentIdentifierState

nvarchar

Unique identifier for the student within the state

DisciplinaryActionStartDate

date

Date when disciplinary action began

Staging.K12Enrollment

Business Purpose: Stores student enrollment information

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

nvarchar

Unique identifier for the student within the state

EnrollmentEntryDate

date

Date when student enrolled

EnrollmentExitDate

date

Date when student exited enrollment

Staging.PersonStatus

Business Purpose: Stores various status indicators for students

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

nvarchar

Unique identifier for the student within the state

EnglishLearnerStatus

bit

Indicates if student is an English Learner

EnglishLearner_StatusStartDate

date

Date when English Learner status began

Staging.ProgramParticipationSpecialEducation

Business Purpose: Stores information about student participation in special education programs

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

nvarchar

Unique identifier for the student within the state

IdeaIndicator

bit

Indicates if student is served under IDEA

ProgramParticipationBeginDate

date

Date when special education program participation began

Staging.IdeaDisabilityType

Business Purpose: Stores information about student disability types under IDEA

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

nvarchar

Unique identifier for the student within the state

IdeaDisabilityTypeCode

nvarchar

Code indicating the type of disability

IsPrimaryDisability

bit

Indicates if this is the primary disability

Temporary Tables

#vwGradeLevels

Purpose: Temporary storage of grade level dimension data for the specific school year

Columns:

Name
Data Type
Purpose/Calculation

GradeLevelTypeDescription

nvarchar

Copied from source view

GradeLevelMap

nvarchar

Copied from source view

#vwRaces

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

Columns:

Name
Data Type
Purpose/Calculation

RaceMap

nvarchar

Copied from source view

#tempELStatus

Purpose: Temporary storage of English Learner status data

Columns:

Name
Data Type
Purpose/Calculation

StudentIdentifierState

nvarchar

Copied from source table

EnglishLearnerStatus

bit

Copied from source table

EnglishLearner_StatusStartDate

date

Copied from source table

#tempIdeaStatus

Purpose: Temporary storage of IDEA status data

Columns:

Name
Data Type
Purpose/Calculation

StudentIdentifierState

nvarchar

Copied from source table

IdeaIndicator

bit

Copied from source table

ProgramParticipationBeginDate

date

Copied from source table

#Facts

Purpose: Temporary storage of fact records before final insert

Columns:

Name
Data Type
Purpose/Calculation

StagingId

int

Copied from Staging.Discipline.Id

SchoolYearId

int

Looked up from RDS.DimSchoolYears

K12DemographicId

int

Looked up from RDS.vwDimK12Demographics

DisciplineCount

int

Set to 1 for each record

Potential Improvements

Error Handling

Description: Enhance error handling to provide more specific error messages and handle specific error conditions

Benefits: Better troubleshooting and more robust execution

Priority: Medium

Transaction Management

Description: Add explicit transaction handling with savepoints

Benefits: Better data integrity and ability to recover from partial failures

Priority: High

Performance

Description: Optimize the large join query by breaking it into smaller steps

Benefits: Improved performance and reduced memory usage

Priority: Medium

Code Clarity

Description: Add more comments and documentation within the code

Benefits: Easier maintenance and knowledge transfer

Priority: Low

Execution Steps

Step 1: Initialize and set up environment

Input Data: None

Transformations: None

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

Step 2: Set variables for the school year

Input Data: @SchoolYear parameter

Transformations: Convert school year to date ranges and IDs

SELECT @SchoolYearId = DimSchoolYearId FROM RDS.DimSchoolYears WHERE SchoolYear = @SchoolYear

Step 3: Create and populate temporary tables

Input Data: Data from RDS views filtered by school year

Transformations: Copy data to temp tables

SELECT * INTO #vwGradeLevels FROM RDS.vwDimGradeLevels WHERE SchoolYear = @SchoolYear

Step 4: Delete existing fact records for the school year

Input Data: SchoolYearId

Transformations: None

DELETE RDS.FactK12StudentDisciplines WHERE SchoolYearId = @SchoolYearId

Step 5: Create and populate #Facts temp table

Input Data: Data from staging tables and dimension lookups

Transformations: Join multiple tables, map codes to dimension IDs

INSERT INTO #Facts SELECT sd.Id StagingId, rda.DimAgeId AgeId, ...

Step 6: Insert data into fact table

Input Data: #Facts temp table

Transformations: None

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

Step 7: Rebuild indexes

Input Data: None

Transformations: None

ALTER INDEX ALL ON RDS.FactK12StudentCounts REBUILD

PreviousStaging.Staging-to-FactK12StudentCourseSectionsNextStaging.Staging-to-FactK12StudentEnrollments

Was this helpful?