open_education_network.bulk_import¶
Attributes¶
Functions¶
|
Validate raw API items into OENTextbook records. |
|
Fetch textbooks from the Open Education Network API. |
|
Translate a list of raw OEN textbook dicts to OME EducationResource cards. |
|
Fetch Open Education Network textbooks and return serialised OME records. |
Module Contents¶
- open_education_network.bulk_import.OEN_BASE_URL = 'https://open.umn.edu/opentextbooks'¶
- open_education_network.bulk_import.OEN_TEXTBOOKS_API_URL = 'https://open.umn.edu/opentextbooks/textbooks.json'¶
- open_education_network.bulk_import.logger¶
- open_education_network.bulk_import.plugin¶
- open_education_network.bulk_import._parse_records(items: list) list[server.plugins.open_education_network.open_education_network_models.OENTextbook]¶
Validate raw API items into OENTextbook records.
Uses a Python 3.13+ ExceptionGroup to gather and report all validation errors at once rather than stopping at the first malformed record. Valid records are returned even when some items fail validation.
- open_education_network.bulk_import.fetch_textbooks(*, subject: str = '', formats: list[str] | None = None) list[server.plugins.open_education_network.open_education_network_models.OENTextbook]¶
Fetch textbooks from the Open Education Network API.
- Args:
subject: Subject keyword to search for (e.g.,
"Python"). formats: List of format names to filter by (e.g.,["eBook", "PDF"]).Passed to the API as repeated
format[]query parameters.- Returns:
A list of
OENTextbookrecords.
- open_education_network.bulk_import.bulk_translate(books: list[dict]) collections.abc.Iterator[server.plugins.ome_plugin.EducationResource]¶
Translate a list of raw OEN textbook dicts to OME EducationResource cards.
- open_education_network.bulk_import.bulk_import(subject: str = 'Python', formats: list[str] | None = None, cache_path: pathlib.Path | None = None) list[dict]¶
Fetch Open Education Network textbooks and return serialised OME records.
Results are cached locally so that repeated runs do not re-fetch the API.
- Args:
subject: Subject keyword to filter by (default:
"Python"). formats: Format names to filter by (default:["eBook", "PDF"]). cache_path: Path to the local JSON cache file. IfNone, a defaultpath next to this module is used.
- Returns:
A list of serialised
EducationResourcedicts.
- open_education_network.bulk_import.here¶