Skip to content

Commit

Permalink
Rename learning_format to delivery; add availability, pace, format
Browse files Browse the repository at this point in the history
  • Loading branch information
mbertrand committed Sep 24, 2024
1 parent 979058d commit 41770bb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
18 changes: 15 additions & 3 deletions learning_resources/etl/mitpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
from django.conf import settings

from learning_resources.constants import (
Availability,
CertificationType,
Format,
LearningResourceType,
OfferedBy,
Pace,
PlatformType,
)
from learning_resources.etl.constants import ETLSource
from learning_resources.etl.utils import transform_format, transform_topics
from learning_resources.etl.utils import transform_delivery, transform_topics
from main.utils import clean_data

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -233,6 +236,9 @@ def _transform_runs(resource_data: dict) -> list[dict]:
else [],
"url": parse_resource_url(resource_data),
"instructors": parse_instructors(resource_data),
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
for run_data in runs_data
]
Expand Down Expand Up @@ -266,10 +272,13 @@ def transform_course(resource_data: dict) -> dict or None:
"course": {
"course_numbers": [],
},
"learning_format": transform_format(resource_data["learning_format"]),
"delivery": transform_delivery(resource_data["learning_format"]),
"published": True,
"topics": parse_topics(resource_data),
"runs": runs,
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
return None

Expand Down Expand Up @@ -303,10 +312,13 @@ def transform_program(resource_data: dict) -> dict or None:
for course_title in resource_data["courses"].split("|")
if course_title
],
"learning_format": transform_format(resource_data["learning_format"]),
"delivery": transform_delivery(resource_data["learning_format"]),
"published": True,
"topics": parse_topics(resource_data),
"runs": runs,
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
return None

Expand Down
25 changes: 22 additions & 3 deletions learning_resources/etl/mitpe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import pytest

from learning_resources.constants import Availability, Format, Pace
from learning_resources.etl import mitpe
from learning_resources.factories import (
LearningResourceOfferorFactory,
Expand All @@ -31,7 +32,7 @@
},
"description": "Profissionais de áreas técnicas estão acostumados a falar ou apresentar dados para perfis que compartem os mesmos interesses e campo de atuação, mas podem encontrar dificuldades em transmitir suas ideias para pessoas de outros setores.\n",
"course": {"course_numbers": []},
"learning_format": ["online"],
"delivery": ["online"],
"published": True,
"topics": [{"name": "Data Science"}],
"runs": [
Expand All @@ -48,8 +49,14 @@
"prices": ["1870"],
"url": "https://professional.mit.edu/course-catalog/comunicacao-persuasiva-pensamento-critico-para-aprimorar-mensagem-portuguese",
"instructors": [{"full_name": "Edward Schiappa"}, {"full_name": ""}],
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
],
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
},
{
"readable_id": "e3be75f6-f7c9-432b-9c24-70c7132e1583",
Expand All @@ -67,7 +74,7 @@
},
"description": "Become a stronger leader of innovation and design-thinking in your workplace. Join us for a highly interactive and engaging course that will teach you powerful new approaches for creating innovative solutions, crafting vision that gets buy-in, and developing solutions that people love. You'll learn our proven 10-Step Design Process and gain the strategies and hands-on experience to make your mark as a leader of innovation. Don't miss this opportunity to take your leadership capabilities to the next level.\n\nThis course may be taken individually or as part of the Professional Certificate Program in Innovation and Technology.\n",
"course": {"course_numbers": []},
"learning_format": ["in_person"],
"delivery": ["in_person"],
"published": True,
"topics": [{"name": "Data Science"}, {"name": "Product Innovation"}],
"runs": [
Expand All @@ -88,8 +95,14 @@
{"full_name": "Reza Rahaman"},
{"full_name": ""},
],
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
],
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
},
]
EXPECTED_PROGRAMS = [
Expand All @@ -108,7 +121,7 @@
"url": "https://professional.mit.edu/sites/default/files/2020-08/Smart%20Manufacturing.jpg",
},
"description": "A fábrica do futuro já está aqui. Participe do programa online Manufatura Inteligente: Produção na Indústria 4.0 e aproveite a experiência de mais de cem anos de colaboração do MIT com vários setores. Aprenda as chaves para criar uma indústria inteligente em qualquer escala e saiba como software, sensores e sistemas são integrados para essa finalidade. Com este programa interativo, você passará da criação de modelos a sistemas de fabricação e análise avançada de dados para desenvolver estratégias que gerem uma vantagem competitiva.\n",
"learning_format": ["online"],
"delivery": ["online"],
"published": True,
"topics": [{"name": "Product Innovation"}],
"runs": [
Expand All @@ -125,9 +138,15 @@
"prices": ["1870"],
"url": "https://professional.mit.edu/course-catalog/manufatura-inteligente-producao-na-industria-40-portuguese",
"instructors": [{"full_name": ""}, {"full_name": "Brian Anthony"}],
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
],
"courses": [EXPECTED_COURSES[0], EXPECTED_COURSES[1]],
"format": [Format.asynchronous.name],
"pace": [Pace.instructor_paced.name],
"availability": Availability.dated.name,
}
]

Expand Down

0 comments on commit 41770bb

Please sign in to comment.