Open Metadata Exchange plugin for QUBES¶
An OME plugin defines how to import and publish metadata from an Open Education Resources system.
plugin.py
provides the class that enables OME to understand QUBES metadata.
This plugin defines one or more:
mimetypes
so that QUBES json data can be stored as enclosures in InterNetNews (INN) articles.newsgroups
so QUBES metadata can be published to and subscribed from those INN newsgroups.
The plugin is composed of at least three code files.
plugin.py
: Definesmimetypes
,newsgroups
, and amake_metadata_card()
function that translates the Open Education Resources system’s data into an OME EducationalResource.qubes_models.py
: generated by Pydantic tools to make it fast and reliable to import QUBES metadata.load_qubes_records_to_nntp.py
: Convertqubes_records.json
into OME EducationalResources and load them into the default NNTP server.convert_qubes_xml_to_json.py
: Data utility that can probably be dropped by adding the dependencypydantic-xml
.
server/plugins/qubes/
├── convert_qubes_xml_to_json.py
├── load_qubes_records_to_nntp.py
├── plugin.py
├── qubes_models.py
├── qubes_records.json
└── qubes_records.xml
Steps to import QUBES metadata and post it as InterNetNews articles.¶
Use cURL or wget to create a
qubes_records.xml
file as discussed inconvert_qubes_xml_to_json.py
.Run
server/plugins/qubes/convert_qubes_xml_to_json.py
to generatequbes_records.json
.[Optional]: Run
server/plugins/qubes/qubes_models.py
to ensure thatqubes_records.json
can be parsed.[Optional]: Run
PYTHONPATH="." server/plugins/qubes/plugin.py
to ensure thatqubes_records.json
can be parsed.docker compose build
open http://localhost:5001/newsgroups && docker compose up
– The webpage will be blank until the FastAPI server starts.PYTHONPATH="." scripts/create_newsgroups.py
Refresh webpage to show that the newsgroups were created.
[Optional]:
open http://localhost:5001/api/channel/qubes.public
– Ensure total=0, first=1, last=0server/plugins/qubes/load_qubes_records_to_nntp.py
[Optional]: Refresh the webpage and ensure total=51, first=1, last=51
Change URL from 5001 (Austin) to 5002 (Boston) to ensure total=0, first=1, last=0
PYTHONPATH="." scripts/nntp_sync.py
to transfer Austin articles to Boston…Refresh web page to ensure total=51, first=1, last=51
open http://localhost:5001/api/channel/qubes.public/cards
to show individual records