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:
mimetypesso that QUBES json data can be stored as enclosures in InterNetNews (INN) articles.newsgroupsso 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.jsoninto 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.xmlfile as discussed inconvert_qubes_xml_to_json.py.Run
server/plugins/qubes/convert_qubes_xml_to_json.pyto generatequbes_records.json.[Optional]: Run
server/plugins/qubes/qubes_models.pyto ensure thatqubes_records.jsoncan be parsed.[Optional]: Run
PYTHONPATH="." server/plugins/qubes/plugin.pyto ensure thatqubes_records.jsoncan be parsed.docker compose buildopen http://localhost:5001/newsgroups && docker compose up– The webpage will be blank until the FastAPI server starts.PYTHONPATH="." scripts/create_newsgroups.pyRefresh webpage to show that the newsgroups were created.
[Optional]:
open http://localhost:5001/api/channel/ome.qubes– 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.pyto transfer Austin articles to Boston…Refresh web page to ensure total=51, first=1, last=51
open http://localhost:5001/api/channel/ome.qubes/cardsto show individual records
QUBES API¶
Gets list of publications https://qubeshub.ddev.site/oaipmh/?verb=ListRecords&metadataPrefix=qdc&set=publications
Gets metadata for a specific publication based on url https://qubeshub.ddev.site/oaipmh/?verb=GetRecord&metadataPrefix=qdc&identifier=https://qubeshub.ddev.site/publications/1/1
Setting up newsgroups¶
Currently not working:
PYTHONPATH="." scripts/create_newsgroups.py
Manual method (might need to only run newgroup commands one, even after docker restart).
docker compose up
docker exec -it ome-internetnews-server-austin-1 sh -c "ctlinnd newgroup ome.eric"
docker exec -it ome-internetnews-server-austin-1 sh -c "ctlinnd newgroup ome.oer"
docker exec -it ome-internetnews-server-austin-1 sh -c "ctlinnd newgroup ome.openlibrary"
docker exec -it ome-internetnews-server-austin-1 sh -c "ctlinnd newgroup ome.qubes"
docker exec -it ome-internetnews-server-austin-1 sh -c "ctlinnd newgroup ome.whg"
Visit http://localhost:5001/.