A Python package for matching K-12 course names and descriptions to standardized NCES School Courses for the Exchange of Data (SCED) codes.
An API key from Google AI Studio (Gemini) is required.
Install the package using pip:
pip install sced-matcherfrom sced_matcher import SCEDMatcher
# Initialize the matcher with your Google Gemini API key
matcher = SCEDMatcher(api_key="your-gemini-api-key")
# Or set GEMINI_API_KEY environment variable and use:
# matcher = SCEDMatcher()
# Get SCED code for a single course
sced_code = matcher.get_sced_match("Advanced Algebra")
print(sced_code) # Returns SCED code
# Get detailed information
code, name, description = matcher.get_sced_match("Advanced Algebra", return_details=True)
print(f"Code: {code}, Name: {name}, Description: {description}")import pandas as pd
# Create or load your DataFrame
df = pd.DataFrame({
'Course_Name': ['Advanced Algebra', 'Biology I', 'World History'],
'Course_Description': ['Advanced algebra concepts', 'Introduction to biology', 'World history survey']
})
# Process the DataFrame
result_df = matcher.process_dataframe(df)
print(result_df) # DataFrame with added SCED_Code column# Process a CSV file directly
result_df = matcher.process_csv_file('input.csv', 'output_with_sced.csv')- Python 3.8+
- Google Gemini (AI Studio) API key
- Required packages:
google-genai,pandas,python-dotenv
Create a .env file in your project root:
GEMINI_API_KEY=your-gemini-api-key-here