Skip to content

Add MARC Authority to MADS 2.1 XML export #4

Description

@dchud

Add one-way export from MARC Authority records to MADS 2.1 XML, following the pattern established by the existing MODS conversion module.

Reference Specifications

Scope

One-way conversion only: MARC Authority → MADS 2.1 XML. No reverse mapping (MADS → MARC Authority) — there is no official LOC crosswalk for that direction, and the LOC notes the forward mapping "is not intended to be a crosswalk that allows for bi-directional conversions without some loss of data."

Implementation Plan

1. Rust core module: src/mads.rs

Primary function:

pub fn authority_record_to_mads_xml(record: &AuthorityRecord) -> Result<String>

Also support converting a generic Record with leader/06=z:

pub fn record_to_mads_xml(record: &Record) -> Result<String>

Follow the manual XML construction pattern used in src/mods.rs (string building with std::fmt::Write), not the serde intermediate struct pattern.

2. Key field mappings (MARC Authority → MADS 2.1)

Authority headings (1XX → <mads:authority>):

  • 100 → <mads:name type="personal">
  • 110 → <mads:name type="corporate">
  • 111 → <mads:name type="conference">
  • 130 → <mads:titleInfo>
  • 148 → <mads:temporal>
  • 150 → <mads:topic>
  • 151 → <mads:geographic>
  • 155 → <mads:genre>

Variant headings (4XX → <mads:variant>):

  • 400/410/411/430/448/450/451/455 → same descriptor types as above within <variant>

Related headings (5XX → <mads:related>):

  • 500/510/511/530/548/550/551/555 → same descriptor types within <related>
  • Map $w control subfield to type attribute (broader/narrower/earlier/later/equivalent)

Metadata elements:

  • 008 positions → various attributes (e.g., encoding level)
  • 010 → <mads:identifier type="lccn">
  • 024 → <mads:identifier> with type from $2
  • 040 → <mads:recordInfo> (cataloging source)
  • 042 → <mads:recordInfo> (authentication code)
  • 046 → date elements
  • 370 → <mads:affiliation> or geographic metadata
  • 371 → <mads:affiliation> (address)
  • 372 → <mads:fieldOfActivity>
  • 373 → <mads:affiliation> (group)
  • 374 → <mads:occupation> or personInfo
  • 375 → gender info
  • 376 → <mads:familyInfo> or <mads:personInfo>
  • 377 → <mads:language>
  • 378 → <mads:name> (fuller form)
  • 380-385 → various descriptive elements
  • 667/670/675/678 → <mads:note>

Subdivision subfields ($v, $x, $y, $z in 1XX/4XX/5XX):

  • $v → <mads:genre>, $x → <mads:topic>, $y → <mads:temporal>, $z → <mads:geographic>

3. PyO3 bindings

Add authority_record_to_mads() and record_to_mads() in src-python/src/formats.rs.

4. Python wrapper, type stubs, tests

  • Expose in mrrc/__init__.py
  • Add signatures to mrrc/_mrrc.pyi
  • Rust unit tests + Python integration tests in tests/python/
  • Validate output against the MADS 2.1 XSD schema

5. Documentation

  • Update README.md format table (MADS row: Read=-, Write=Yes)
  • Update docs/tutorials/rust/format-conversion.md — add MADS export example
  • Update docs/tutorials/python/format-conversion.md — add MADS export example
  • Update docs/reference/rust-api.md — document new public functions
  • Update docs/reference/python-api.md — document new Python functions
  • CHANGELOG entry

Design Notes

  • MADS is to authority records what MODS is to bibliographic records; this feature complements existing MODS support
  • The LOC XSLT stylesheets serve as an authoritative reference implementation for the mapping logic
  • MADS 2.1 added new elements (personInfo, organizationInfo, familyInfo, fieldOfEndeavor, locale, workInfo) corresponding to MARC 37X fields

Internal tracking: beads mrrc-b7l

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions