Albin O. Kuhn Library & Gallery - Staff Wiki


User Documentation for Mapping Script

User Document: Collection Mapping Script

 The script is here:

Overview

This script is designed to automate the process of mapping collection names extracted from XML metadata files to corresponding identifiers found in an Excel spreadsheet. It creates collections files for each item based on the mapping defined in the Excel file.

 

Features

  • Automatically extracts collection names from XML metadata files.

  • Maps collection names to identifiers defined in an Excel spreadsheet.

  • Generates collections files for each item with the mapped identifiers.

 

Prerequisites

Before running the script, ensure you have:

  • Python installed on your system.

  • Necessary Python library installed (openpyxl).

 

Installation

These steps are to be done during first time only

Python

Ensure Python is installed in your system.

  1. In Windows search bar, type Command prompt or cmd.

  2. Type python -V

It will show python version. Ensure it is 3.2 or higher.

 

Install pip package

In the command prompt type this-

openpyxl

pip install openpyxl

 

Usage Instructions

  1. Ensure all necessary dependencies are installed

  2. Download the Script: Download the Mapping_file_creation.py

  3. Run the Script:

    • Double-click the mapping_script.py file to execute the script.

    • Alternatively, run the script from the command line using the following command:

python Mapping_file_creation.py

  1. Browse and Select Files:

    • Click on the "Browse" button next to "Folder Path" to select the folder containing metadata files. (SimpleArchiveFormat folder)

    • Click on the "Browse" button next to "Excel File" to select the Collections Excel file.

  2. Execute Script:

    • After selecting the folder and Excel file, click on the "Run Script" button.

    • The script will process the metadata files, map the collections, and generate collections files for each item.

  3. View Logs:

    • Logs for the script execution are stored in a file named mapping.log which is in the same folder where script file is stored.

    • This log file provides information about any errors encountered during the process.

  4. Script Completion:

    • Once the script completes execution, a message box will appear indicating the successful creation of files or any errors encountered.

 

Troubleshooting

  • If the script encounters errors or does not produce the expected output, refer to the log file (mapping.log) for detailed error messages.

  • Ensure that the metadata files are in the correct format and contain the necessary collection information.

 


Albin O. Kuhn Library & Gallery . University of Maryland, Baltimore County . 1000 Hilltop Circle . Baltimore MD 21250
(410) 455-2232. Questions and comments to: Web Services Librarian