Skip to content

Incubator 10 data insertion script#57

Open
akshatasatpute wants to merge 2 commits intomainfrom
incubator_10_data_insertion_script
Open

Incubator 10 data insertion script#57
akshatasatpute wants to merge 2 commits intomainfrom
incubator_10_data_insertion_script

Conversation

@akshatasatpute
Copy link
Collaborator

@akshatasatpute akshatasatpute commented Jan 6, 2026

This one-time script enables to process Incubator 10.0 registration data collected via Google Forms and load it into the She_for_STEM database. It generate student IDs with temporary email addresses in student details table, and correctly map records across student registration, and education table.

Note: The registration data will be uploaded to metabase by ops team which will dump data in the database old schema. Later on the script will,

  1. Inserts registration data into student_details.
  2. Auto-generates student_id for each student
  3. Creates temporary email IDs (student_id@vigyanshaala.com)
  4. Student IDs generated in the student_details table are downloaded and mapped back to the uploaded data using Excel(XLOOKUP + COUNTIF) to correctly handle duplicate student entries i.e students with same PII data.
  5. The updated file is re-uploaded to Metabase and used to insert records linked to respective student_id into the remaining tables i.e student registration details and student education via the same script with simple insert query.
  6. Ensures correct foreign-key linkage across all tables.

Linked Issue:
Closes #56

Comment on lines +109 to +123
(
CASE
WHEN CURRENT_DATE <
make_date(EXTRACT(YEAR FROM CURRENT_DATE)::int, 7, 1)
THEN EXTRACT(YEAR FROM CURRENT_DATE)::int - 1
ELSE EXTRACT(YEAR FROM CURRENT_DATE)::int
END
-
(
LEAST(
COALESCE(
NULLIF(regexp_replace(u.currently_pursuing_year, '\D', '', 'g'), '')::int,
1
),
cmc.course_duration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always have DRY principle in mind. These lines are used multiple times and can be reused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incubator 10 student registration data insertion script

2 participants