FOLIO-FSE / FOLIO-FSE/folio_migration_tools

Python script to fix MARC21 indicators in batch records

Open
#995 1 comment 0 reactions 0 assignees View on GitHub
python
Dominant language
Python
Stars
14
Forks
10
Avg merge
55m
Merged PRs (30d)
7

Description

## Summary
Create a Python script to fix MARC21 indicators in batch-processed records.

## Details
- The script processes a file containing MARC21 records in standard format.
- For each tag with indicators, ensures there are exactly two indicators after the 3-digit tag (pads with spaces if missing or incomplete).
- Fields that do not use indicators (such as =LDR, =001, =005, =008) remain unchanged.
- Output is a corrected version of the MARC file, suitable for use with migration tools.
- Example input and output provided in the discussion.

## Example usage
1. Save MARC records to `marc_records.txt`.
2. Run the script: `python fix_marc_indicators.py`
3. Output is saved as `marc_records_fixed.txt` with corrected indicators.

## Implementation
The script uses regex to identify and fix indicators. See user prompt for example input data and further details.

---
Let me know if you need the script as a PR or want additional enhancements!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.