Skip to content

Add explicit pre-2024 cohort mapping, remove Cohort.save() regex fallback, import ml-zoomcamp-2021 certificates #224

Description

@alexeygrigorev

Parent decision: #15
Normative decision: Open decision 4

Scope

The historical import added on main (2032ceb, "Add historical zoomcamp-scoring import for pre-2024 cohorts") creates each pre-2024 Cohort via Cohort.objects.update_or_create(slug=edition.cohort_slug, ...) without setting course= explicitly, so it still resolves its family through the regex year-stripping fallback in Cohort.save() (courses/models/cohort.py). #15 requires an explicit reviewed mapping instead, per owner decision.

  • Add explicit reviewed entries (in courses/course_family_catalog.py or an equivalent explicit table read by scripts/historical_import) for the 7 pre-2024 legacy cohort slugs: de-zoomcamp-2022, de-zoomcamp-2023, mlops-zoomcamp-2022, mlops-zoomcamp-2023, ml-zoomcamp-2021, ml-zoomcamp-2022, ml-zoomcamp-2023. This is the confirmed complete pre-2024 inventory — no other one-off/unusual legacy editions exist.
  • Update scripts/historical_import/scoring_import.py's ensure_cohort() to pass course= explicitly from that mapping instead of leaving course_id unset.
  • Remove the regex year-stripping fallback in Cohort.save() now that every production cohort-creation path supplies course explicitly. Regex-based slug inference is only acceptable as a one-time authoring aid inside import/fixture scripts — never live in production model code.
  • Locate and import certificates for the ml-zoomcamp-2021 edition. The current import treats it as having no certificate source and skips it; owner confirms certificates for this edition exist and should be found and imported like every other edition.
  • Persist the recovered sha1(email) hash (already used transiently by scripts/historical_import/email_recovery.py to match learners to accounts) as a queryable legacy identifier/alias, so historical records stay traceable back to the zoomcamp-scoring source.

Non-goals

Does not reopen the mapping approach itself (approved in #15) or add pre-2024 families beyond DE/MLOps/ML Zoomcamp 2021-2023.

Acceptance criteria

  • All 7 pre-2024 cohort slugs resolve their family via the explicit mapping table, not regex inference.
  • Cohort.save() no longer contains the regex-based family-inference fallback; creating a Cohort with no course and an unmapped slug fails loudly instead of guessing.
  • ml-zoomcamp-2021 certificates are imported like every other historical edition.
  • Each imported historical learner record carries its source sha1(email) as a reviewable legacy alias.

Dependencies

Depends on #15 (decision, resolved). Builds on the historical import added in 2032ceb on main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions