mdr2.abacus

Import and export files to and from ABACUS

Unfortunately the interface to our ERP is very crude: you basically read and write files from an directory. The import from ABACUS is done via XML and the export to ABACUS is done via some form of csv. The interface imports the following notifications:

  • Start (open) a production
  • a production is recorded
  • Meta data updates

and the interface sends notifications to ABACUS when:

  • the state of a production changes
  • meta data of a production changes.

clean-raw-production

(clean-raw-production {:keys [mvl_only command idVorstufe], :as raw-production})

Return a proper production based on a raw production, i.e. drop :mvl_only, :command and :idVorstufe and add :production_type and periodical_number

create-row

(create-row k v)

Create a row for export according to ABACUS conventions

export

(export {:keys [product_number total_time state audio_format multimedia_type date id produced_date volumes depth], :as production})

Export the state of a production as a csv-like structure, ready to be consumed by ABACUS

export-file

(export-file {product_number :product_number, :as production})

Export the state of a production into a special file in export-dir. The file is named with the product_number. Existing files are overwritten

import-metadata-update

(import-metadata-update f)

Import a metadata update request from file f

import-new-production

(import-new-production f)

Import a new production from file f

import-recorded-production

(import-recorded-production f)

Import a recorded production from file f

import-status-request

(import-status-request f)

Import a status request from file f

read-file

(read-file file)

Read an export file from ABACUS and return a map with all the data, i.e. a production

source-date

(source-date {source_edition :source_edition})

Extract the source date from a raw production by taking the last segment of the :source_edition

wrap-rows

(wrap-rows rs)

Wrap an export record according to ABACUS conventions