Project Deliverables
Implementation details for our College Scorecard database project.
ER Diagram
Temporal Relationships
The database tracks institutional data by academic year, allowing changes over time. For example, an institution's enrollment can be recorded for 2023-24 to compare yearly enrollment trends. i.e. ENROLLMENT: InstitutionID, YearID, EnrollmentCount
View SchemaComposite Keys
Several tables use multiple columns to identify a record.
Enrollment
· institution_id, year_id
Tuition record
· institution_id, year_id, residency_category
Completion record
· institution_id, year_id, cohort_definition
Earnings outcome
· cohort_id, measurement_period
Debt outcome
· institution_id, year_id
Data Validation Constraints
The database enforces data integrity through NOT NULL, UNIQUE, FOREIGN KEY, and CHECK constraints.
CHECK constraints
· Restrict enrollment_count and tuition_amount to non-negative values and completion_rate to a range between 0 and 1.
NOT NULL constraints
· Require essential fields such as institution name, control type, and academic year values.
UNIQUE constraints
· Prevent duplicate state codes and duplicate academic-year ranges.
FOREIGN KEY constraints
· Ensure enrollment and tuition records reference existing institutions and academic years.
Normalized Schema
First Normal Form (1NF)
· Uses columns with no repeating groups, each row is unique, and only one value per row, i.e. ENROLLMENT stores enrollment_count as a single value for each Instution and Academic Year
Second Normal Form (2NF)
· Tables with composite keys eliminate partial dependencies. i.e. TUITION_RECORD uses a composite primary key (institution_id, year_id, residency_category),
Third Normal Form (3NF)
· Non-key attributes are directly referenced though Foreign Keys, i.e. INSTITUTION relies on state_id not plain text values.
Institutional Measures vs. Cohort Outcomes
Missing or Suppressed Values
Standardized missing values
· NA_VALUES maps suppressed or unavailable values, such as PrivacySuppressed, PS, and blank fields, to a consistent format for import.
Incomplete reporting periods
· i.e. 2021–22 dataset contains no relevant data for the COHORT and OUTCOME tables. These missing sections are accounted for during import.
Import Scripts
The import scripts are broken into a few main sections.
import_states.py
· An initial population of the STATES table with all the state names and codes, runs once on initialization.
importer.py
· A general file processing function, a function for each inidividual table population, and some helper functions for the flask app to connect.
Importer Page
· A web UI to select importing files and view the current record populations, the availible data files are presented with their records for each table as some are missing key required data sets.
Data Dictionary
Source columns
· SOURCE_COLS identifies the CSV fields imported from the raw data.
Data mappings
· CONTROL_MAP converts numeric institution classifications into readable categories, i.e. 1: Public and 2: Private nonprofit.
Reporting definitions
· EARNINGS_PERIODS, DEBT_COLUMNS, and COMPLETION_DEFS define how earnings, debt, and graduation measures are interpreted and imported.
Reference data
· STATES provides state names and codes, while TABLES defines the database tables used during imports.
SQL Queries
Institutional Comparison Views
Indexes
Institution indexes
· idx_institution_name speeds up institution name searches, while idx_institution_state improves filtering by state.
Reporting year indexes
· idx_enrollment_year, idx_tuition_year, and idx_completion_year improve queries that filter records by academic year.
Cohort and debt indexes
· idx_student_cohort_year and idx_debt_year improve searches and comparisons across reporting years.