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
  • 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-FactK12StudentCourseSections

Overview & Purpose

This stored procedure populates the RDS.FactK12StudentCourseSections fact table and the RDS.BridgeK12StudentCourseSectionRaces bridge table with data from staging tables. It transfers K-12 student course section data from staging tables to the data warehouse, creating relationships between students, courses, schools, and various educational entities.

Main Functions:

  • Populate FactK12StudentCourseSections

    Transfers student course section data from staging tables to the fact table with appropriate dimension keys

  • Populate BridgeK12StudentCourseSectionRaces

    Creates relationships between student course sections and race information

Key Calculations:

  • Populate FactK12StudentCourseSections: Sets a count of 1 for each student course section record

    Formula: StudentCourseSectionCount = 1

    Business Significance: Enables counting of student course sections for reporting and analysis

    Example: Each row in the fact table will have a StudentCourseSectionCount of 1

Data Transformations:

  • Mapping staging table identifiers to dimension table surrogate keys

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

  • Joining multiple staging tables to create comprehensive fact records

  • Converting VARCHAR data types for proper joining conditions

Expected Output:

Populated RDS.FactK12StudentCourseSections fact table and RDS.BridgeK12StudentCourseSectionRaces bridge table with transformed data from staging tables

Business Context

System: K-12 Education Data Warehouse

Necessity: Enables analysis and reporting of student course section data across educational institutions

Business Rules:

  • Student records are linked to multiple LEA (Local Education Agency) types including accountability, attendance, funding, graduation, and IEP

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

  • Hispanic/Latino ethnicity is treated as a race category

  • Default dimension key value of -1 is used for missing dimension references

Result Usage:

Reporting and analysis of student course enrollment patterns, demographic distribution in courses, and educational program participation

Execution Frequency:

Likely executed during regular ETL processes, possibly daily or weekly

Critical Periods:

  • End of academic terms

  • State and federal reporting deadlines

Parameters

Source Tables

Staging.K12Enrollment

Business Purpose: Stores student enrollment data from source systems

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

VARCHAR

Unique identifier for students at the state level

SchoolIdentifierSea

VARCHAR

Identifies the school within the state education agency system

Staging.K12StudentCourseSection

Business Purpose: Stores information about student course section enrollment

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

VARCHAR

Unique identifier for students at the state level

ScedCourseCode

VARCHAR

School Codes for the Exchange of Data course code

Staging.K12PersonRace

Business Purpose: Stores race information for K12 students

Columns:

Name
Data Type
Business Purpose

StudentIdentifierState

VARCHAR

Unique identifier for students at the state level

RaceType

VARCHAR

Identifies the race of the student

Potential Improvements

Performance

Description: Move the index rebuild operation outside the transaction

Benefits: Reduces transaction duration and lock contention

Priority: Medium

Error Handling

Description: Add explicit error handling with TRY/CATCH blocks

Benefits: Better error reporting and handling of specific error conditions

Priority: Medium

Performance

Description: Consider batch processing for large datasets

Benefits: Reduced memory usage and transaction size

Priority: Low

Execution Steps

Step 1: Disable all indexes on the fact table to improve insert performance

Input Data: None

Transformations: None

ALTER INDEX ALL ON RDS.FactK12StudentCourseSections DISABLE

Step 2: Begin transaction for data consistency

Input Data: None

Transformations: None

Begin Transaction

Step 3: Insert data into the fact table

Input Data: Data from staging tables joined with dimension tables

Transformations: Mapping staging identifiers to dimension keys, handling nulls with ISNULL

INSERT INTO rds.FactK12StudentCourseSections (...) SELECT ... FROM Staging.K12Enrollment ske JOIN Staging.K12StudentCourseSection sppse ...

Step 4: Insert data into the bridge table

Input Data: Data from fact table joined with staging and dimension tables

Transformations: Mapping race information to dimension keys

INSERT INTO RDS.BridgeK12StudentCourseSectionRaces (...) SELECT ... FROM RDS.FactK12StudentCourseSections rfksc ...

Step 5: Rebuild all indexes on the fact table

Input Data: None

Transformations: None

ALTER INDEX ALL ON RDS.FactK12StudentCourseSections REBUILD

Step 6: Commit the transaction

Input Data: None

Transformations: None

Commit Transaction

PreviousStaging.Staging-to-FactK12StudentCounts_SpecEdExitNextStaging.Staging-to-FactK12StudentDisciplines

Was this helpful?