-
Notifications
You must be signed in to change notification settings - Fork 130
Autorefresh for Credit Recovery #1710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Megha18jain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new, fully automated data import pipeline for credit recovery statistics sourced from the Civil Rights Data Collection (CRDC). The pipeline handles the entire process from data acquisition and preprocessing to mapping the cleaned data to Data Commons statistical variables. This ensures that relevant educational data is regularly updated and made available for analysis, enhancing the comprehensiveness of the dataset. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces the autorefresh functionality for Credit Recovery data, including scripts for downloading and processing data, along with necessary configuration files. The changes involve adding new Python scripts (download.py, creditprocess.py), a manifest.json for orchestration, and several CSV files for data mapping and metadata. Overall, the structure is clear, but there are several inconsistencies in file paths and naming between the README.md, manifest.json, and the Python scripts, which need to be addressed for correct operation. Additionally, a critical typo in pvmap.csv will prevent proper data processing, and some Python logic needs minor adjustments for correctness and maintainability. All new files are missing a trailing newline, which is a minor formatting issue.
| @@ -0,0 +1,8 @@ | |||
| key,,,,,,,,,,,, | |||
| LEA_STATE,observationAbout,{Data},,,,,,,,,, | |||
| SCH_CRED-ITRECOVERY_IND:1,statType,measuredValue,measuredProperty,count,populationType,School,schoolSubject,CreditRecoveryProgram,#Aggregate,sum,value,1,subjectOfferStatus,SubjectOffered | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the key SCH_CRED-ITRECOVERY_IND:1. It should likely be SCH_CREDITRECOVERY_IND:1 to match the column name used in creditprocess.py. This typo will prevent the correct mapping of this property value.
SCH_CREDITRECOVERY_IND:1,statType,measuredValue,measuredProperty,count,populationType,School,schoolSubject,CreditRecoveryProgram,#Aggregate,sum,value,1,subjectOfferStatus,SubjectOffered
| "scripts": [ | ||
| "download.py", | ||
| "creditprocess.py", | ||
| "../../tools/statvar_importer/stat_var_processor.py --input_data=input_credit/*.csv --pv_map=pvmap.csv --config_file=metadata.csv --places_resolved_csv=places_resolved.csv --output_path=output/credit_output" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output_path output/credit_output implies that the output files will be named credit_output.csv, credit_output.tmcf, etc. This is inconsistent with the README.md which refers to output/output_credit.csv and output_pro/ directory. Please ensure consistency across all documentation and configuration.
| "import_inputs": [ | ||
| { | ||
| "template_mcf": "output/credit_output.tmcf", | ||
| "cleaned_csv": "output_files/credit_output.csv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cleaned_csv path output_files/credit_output.csv is inconsistent with the output_path specified in the scripts section (output/credit_output). This will likely lead to the importer not finding the generated CSV file. It should probably be output/credit_output.csv.
| "cleaned_csv": "output_files/credit_output.csv" | |
| "cleaned_csv": "output/credit_output.csv" |
| year_match = re.search(r'(\d{4})-(\d{2})', filename) | ||
| if not year_match: | ||
| print(f"Skipping '{filename}': Year not found in filename.") | ||
| continue | ||
| year = f"20{year_match.group(2)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The year extraction logic might be inconsistent with how download.py names the files. download.py uses year_str (e.g., "2012-13") as the year prefix in the filename. The regex re.search(r'(\d{4})-(\d{2})', filename) will match "2012-13", where group(1) is "2012" and group(2) is "13". The current year = f"20{year_match.group(2)}" would result in "2013". If the intention is to use the start year of the academic period (e.g., 2012 for 2012-13 data), then year_match.group(1) should be used instead.
| year_match = re.search(r'(\d{4})-(\d{2})', filename) | |
| if not year_match: | |
| print(f"Skipping '{filename}': Year not found in filename.") | |
| continue | |
| year = f"20{year_match.group(2)}" | |
| year_match = re.search(r'(\d{4})-(\d{2})', filename) | |
| if not year_match: | |
| print(f"Skipping '{filename}': Year not found in filename.") | |
| continue | |
| year = year_match.group(1) |
|
|
||
| if __name__ == "__main__": | ||
| os.chdir(SCRIPT_DIRECTORY) | ||
| main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `output.csv`: The main data file with aggregated statistics. | ||
| - `output.tmcf`: Template MCF file for the import. | ||
| - `output_stat_vars.mcf`: Statistical variable definitions. | ||
| - `output_stat_vars_schema.mcf`: Schema for the statistical variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output filenames listed here (output.csv, output.tmcf, output_stat_vars.mcf, output_stat_vars_schema.mcf) are inconsistent with the output_path specified in manifest.json (output/credit_output). The manifest will generate files like output/credit_output.csv, output/credit_output.tmcf, etc. Please update these entries in the README for accuracy.
| @@ -0,0 +1,3 @@ | |||
| parameter,value | |||
| output_columns,"observationAbout, observationDate, value, variableMeasured" | |||
| header_rows,1 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| MP,geoId/69 | ||
| PR,geoId/72 | ||
| UM,geoId/74 | ||
| VI,geoId/78 No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `creditprocess.py`: Script to process the raw data and prepare it for the final import. | ||
| - `files/credit/`: Directory containing the raw, downloaded credit recovery data files. | ||
| - `input_credit/`: Directory containing the processed, cleaned CSV files. | ||
| - `output_pro/`: Directory containing the final, aggregated output files for import. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SCH_CREDITRECOVERYENR,value,{Number},statType,measuredValue,measuredProperty,count,populationType,Student,schoolSubject,CreditRecoveryProgram,enrollmentStatus,Enrolled,, | ||
| JJ:0,juvenileJusticeFacilityStatus,NotJuvenileJusticeFacility,,,,,,,,,, | ||
| JJ:1,juvenileJusticeFacilityStatus,JuvenileJusticeFacility,,,,,,,,,, | ||
| year,observationDate,{Data},,,,,,,,,, No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statvar_imports/crdc_credit_recovery_program_enrollment/creditprocess.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls check if the 15k lines are produced as output for the 48 lines in input.
| "../../tools/statvar_importer/stat_var_processor.py --input_data=input_credit/*.csv --pv_map=pvmap.csv --config_file=metadata.csv --output_path=output/credit_output --existing_statvar_mcf=gs://unresolved_mcf/scripts/statvar/stat_vars.mcf " | ||
| ], | ||
| "source_files": [ | ||
| "input_credit/*.csv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls copy the .zip downloaded form source to GCS as well.
No description provided.