vwmrc – MARC21-Datensätze aus MongoDB anzeigen
vwmrc ist ein Kommandozeilenwerkzeug, das einen MARC21-Datensatz per PPN
aus einer MongoDB-Collection lädt und als lesbaren MARC-Text ausgibt.
Es erkennt automatisch, ob die Daten als binäres MARC, MARC-XML oder
Base64-kodiertes Binär-MARC vorliegen. Der Export als .mrc oder .xml
wird ebenfalls unterstützt.
Entwickelt an der Sächsischen Landesbibliothek – Staats- und Universitätsbibliothek Dresden (SLUB).
Transparenzhinweis: Dieses Tool wurde co-authored mit einem Large Language Model (LLM). Sämtlicher Code ist von einem menschlichen Entwickler geprüft, getestet und freigegeben.
Voraussetzungen
- Python ≥ 3.10
- MongoDB-Instanz, erreichbar unter der in
MONGODB_URLangegebenen Adresse - Collections, deren Dokumente eine
_id(die PPN) und ein Feldfull_recordoderfullrecordmit den MARC-Daten enthalten
Installation
# Empfohlen: via uv
uv tool install vwmrc
# Alternativ: via pipx
pipx install vwmrc
# Oder klassisch via pip
pip install vwmrc
Nach der Installation steht der Befehl vwmrc global zur Verfügung.
Verwendung
Grundaufruf
vwmrc DATENBANK.COLLECTION:PPN
Das Ziel wird in drei Teile zerlegt:
- DATENBANK – alles vor dem ersten Punkt
- COLLECTION – alles zwischen dem ersten Punkt und dem letzten Doppelpunkt
- PPN – alles nach dem letzten Doppelpunkt
Diese Logik erlaubt PPNs, die selbst Doppelpunkte enthalten (z. B.
1787:123456).
Beispiele
# MongoDB-Verbindung setzen
export MONGODB_URL="mongodb://benutzer:passwort@example.com:27017"
# Datensatz anzeigen
vwmrc ahn.kxpzentral_marc:010000313
# Datensatz als binäres MARC speichern (z. B. für MarcEdit & Co.)
vwmrc ahn.kxpzentral_marc:010000313 --ofile record.mrc
# Datensatz als MARC-XML speichern
vwmrc ahn.kxpzentral_marc:010000313 --ofile record.xml
# Auch ohne gesetzte Umgebungsvariable (Default: localhost:27017)
vwmrc ahn.kxpzentral_marc:010000313
Ausgabe
Der Datensatz wird im klassischen MARC-Textformat ausgegeben – mit Tag,
Indikatoren (Leerzeichen als #), Unterfeldcodes und Inhalt:
LDR 03383cam a2200781 c 4500
001 010000313
003 DE-627
005 20251030061346.0
...
245 00 $aJoseph Beuys in Wien und am Friedrichshof ...
700 1# $aBeuys, Joseph $d1921-1986 $4oth
Optionen
| Option | Beschreibung |
|---|---|
--ofile DATEI |
Speichert den Datensatz in eine Datei. Endung .xml → MARC-XML; alles andere → binäres MARC (ISO 2709). |
Funktionsweise
- Verbinden – Aufbau einer MongoDB-Verbindung über
MONGODB_URL - Suchen –
find_one({"_id": ppn}) - Extrahieren – Sucht nach den Feldern
full_recordoderfullrecord(in dieser Reihenfolge). Ist der Wert eine Liste, wird das erste Element verwendet. - Erkennen – Das Datenformat wird automatisch bestimmt:
bytes→ binäres MARC- String, der mit
<?xmloder<beginnt → MARC-XML - String, der mit 5 Ziffern beginnt → binäres MARC (Latin-1 → Bytes)
- Base64-ähnlicher String → dekodieren, dann binäres MARC
- Ausgeben – Formatierung als lesbarer MARC-Text, oder Schreiben in eine Datei.
Fehlercodes
| Code | Bedeutung |
|---|---|
| 1 | Ungültiges Zielformat (muss db.coll:ppn sein) |
| 2 | MongoDB-Abfrage fehlgeschlagen |
| 3 | Kein Datensatz mit dieser _id gefunden |
| 4 | Kein full_record- oder fullrecord-Feld im Dokument |
| 5 | MARC-Daten konnten nicht geparst werden |
Abhängigkeiten
- pymarc ≥ 5.0 – MARC21-Parsing (Library of Congress)
- pymongo ≥ 4.0 – MongoDB-Client
- click ≥ 8.0 – CLI-Framework
Lizenz
MIT – siehe pyproject.toml.
English Summary
vwmrc is a command-line tool that fetches a MARC21 record from a MongoDB
collection and displays it as human-readable MARC text. It auto-detects
the data format (binary MARC, MARC-XML, or Base64-encoded binary) and can
export records as .mrc or .xml files.
Usage: vwmrc DATABASE.COLLECTION:PPN
Authentication is handled entirely via the MONGODB_URL environment
variable. The tool looks for a document whose _id matches the given PPN
and extracts the MARC data from either full_record or fullrecord.
Developed at Saxon State and University Library Dresden (SLUB).
Transparency note: This tool was co-authored with a Large Language Model. All code has been reviewed, tested, and approved by a human developer.
Metadata
Release files for vwmrc 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vwmrc-1.0.1.tar.gz | 16.1 kB | Without provenance | Details for vwmrc-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vwmrc-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for vwmrc-1.0.1-py3-none-any.whl |
Total release size: 23.3 kB
Release files / vwmrc-1.0.1.tar.gz
| Download URL | vwmrc-1.0.1.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0701cc36ed2e0faa437021d259dc3fbbd87bde060b7d22ac346e677f6ff8288f
|
|
BLAKE2b-256 checksum How to use checksums |
e0a7597e99493fc52060509ef7f5610ffa54364c0b9a444ddec435156d385b4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"KDE neon","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / vwmrc-1.0.1-py3-none-any.whl
| Download URL | vwmrc-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ba34a2d620c89ec72d832e6bf86b70720bdcb7301ec984ad94b6879eff443e2
|
|
BLAKE2b-256 checksum How to use checksums |
063fba074bc159fe9b7dbf5e14be650983883b5060de12a81d8d6c4848126169
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"KDE neon","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for vwmrc 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.