hou2zi0 / csv-to-epidoc__python

Command line tool that converts CSV files to EpiDoc-XML.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

csv-to-epidoc__python

Command line tool that converts CSV files to EpiDoc-XML.

Configfile

The CLI-tool expects a configuration file with the following content:

{
    "csv": [
            "https://hou2zi0.github.io/csv-to-epidoc/data/files/epidat.csv"
        ],
    "sep": "|",
    "map": {
    "title": "Inventory_Number",
    "handDesc": "Hands"
    }
}
  • csv contains a list of URL pointing to CSV files containing the epigraphic data. It is important to know that all CSV files contained in a single CLI call must use the same separator.
  • sep contains the cell separator character.
  • map contains a mapping that specifies the mapping of the CSVs columns headers (values) to their respective counterpart within the EpiDoc-XML (key).
    • The mapping direction is key <-- value == XML <-- CSV.

Possible keys—representing fields in the XML— are (may change in the future to be more consistent in regard to the element names in EpiDoc):

  • title
  • editor
  • authority
  • filename
  • license
  • settlement
  • repository
  • idno
  • objectType
  • material
  • dimensions
  • handDesc
  • scriptDesc
  • decoDesc
  • originDate
  • originPlace
  • listPerson
  • langUsage
  • facsimile
  • transcription
  • translation
  • description
  • commentary
  • apparatus
  • bibliography

Calling the CLI script

Usage: csv-to-epidoc.py [OPTIONS] CONFIGURATIONFILE OUTPUTPATH

Options:
  --help  Show this message and exit.
  • CONFIGURATIONFILE specifies the path to the configfile (required)
  • OUTPUTPATH specifies the path to the output folder for the single XML files (required)

The script requires Python3 and the following libraries:

  • requests
  • pandas
  • json
  • io
  • click
  • tdqm

About

Command line tool that converts CSV files to EpiDoc-XML.

License:MIT License


Languages

Language:Python 100.0%