    50 "BSVÖ, Wien"
    103 "Paderborn"})
 
+(def genre-code-to-genre
+  "Mapping between genre-code and genre. Used for movies"
+  {"I1" :spielfilm
+   "I2" :dokumentarfilm
+   "I3" :mundartfilm})
+
+(def braille-grade-raw-to-braille-grade
+  "Mapping between braille-grade-raw and braille-grade"
+  {"kr" :kurzschrift
+   "vd" :vollschrift})
+
 (def CatalogItem
   {:record-id s/Str
    :title s/Str

  [record path]
  (some-> (apply xml1-> record path) text))

(defn clean-raw-item
  "Return a proper production based on a raw item, i.e.
  translate the language tag into proper ISO 639-1 codes"
  [{:keys [genre-raw language format-raw producer-raw] :as item :or {genre-raw "x01"}}]
  (-> item
      (assoc-some
       :language (iso-639-2-to-iso-639-1 language)
       :genre (genre-raw-to-genre (subs genre-raw 0 1))
       :sub-genre (genre-raw-to-subgenre (subs genre-raw 0 3))
       :format (format-raw-to-format format-raw)
       :producer_brief (producer-raw-to-producer (Integer/parseInt producer-raw)
                                                 (format "FIXME: %s" producer-raw)))
      (dissoc :genre-raw :format-raw producer-raw)))

(defn order-and-group [items]
  (->>

  {:record-id [:controlfield (attr= :tag "001")]
   :title [:datafield (attr= :tag "245") :subfield (attr= :code "a")]
   :subtitle [:datafield (attr= :tag "245") :subfield (attr= :code "b")]
   :name-of-part [:datafield (attr= :tag "245") :subfield (attr= :code "p")] ; Bandangabe
   :creator [:datafield (attr= :tag "100") :subfield] ; autor
   :source [:datafield (attr= :tag "020") :subfield] ; isbn
   :description [:datafield (attr= :tag "520") :subfield] ; abstract
   :volumes [:datafield (attr= :tag "300") :subfield (attr= :code "9")] ; Anzahl Medien
   :source_publisher [:datafield (attr= :tag "534") :subfield (attr= :code "c")] ; Verlag
   :source-date [:datafield (attr= :tag "534") :subfield (attr= :code "d")] ; Erscheinungsjahr
   :language [:datafield (attr= :tag "041") :subfield (attr= :code "a")] ; Sprache
   :general-note [:datafield (attr= :tag "500") :subfield (attr= :code "a")] ; Land, Erscheinungsjahr (des Originalfilms)
   :accompanying_material [:datafield (attr= :tag "300") :subfield (attr= :code "e")] ; Begleitmaterial
   :personel-name [:datafield (attr= :tag "700") :subfield (attr= :code "a")] ; Regie oder Darsteller
   :personel-relator-term [:datafield (attr= :tag "700") :subfield (attr= :code "e")]
   :narrator [:datafield (attr= :tag "709") :subfield (attr= :code "a")] ; Sprecher
   :duration [:datafield (attr= :tag "391") :subfield (attr= :code "a")] ; Spieldauer
   :braille-grade-raw [:datafield (attr= :tag "392") :subfield (attr= :code "a")] ; Schriftart Braille
   :braille-music-grade-raw [:datafield (attr= :tag "393") :subfield (attr= :code "a")] ; Schriftart Braille
   :producer [:datafield (attr= :tag "260") :subfield (attr= :code "b")] ; Produzent
   :producer-raw [:datafield (attr= :tag "260") :subfield (attr= :code "9")] ; a number that determines Produzent Kürzel und Stadt
   :producer_place [:datafield (attr= :tag "260") :subfield (attr= :code "a")] ; Produzent Stadt
   :produced_date [:datafield (attr= :tag "260") :subfield (attr= :code "c")]
   :produced_commercially? [:datafield (attr= :tag "260") :subfield (attr= :code "d")] ; kommerziell?
   :series-title-raw [:datafield (attr= :tag "830") :subfield (attr= :code "a")] ; u.a. Rucksackbuch
   :series-volume-raw [:datafield (attr= :tag "830") :subfield (attr= :code "v")]
   :format-raw [:datafield (attr= :tag "091") :subfield (attr= :code "c")]
   :genre-raw [:datafield (attr= :tag "099") :subfield (attr= :code "b")]
   :genre-code [:datafield (attr= :tag "099") :subfield (attr= :code "a")] ; used for movie genre i.e. Filmkategorie
   :library_signature [:datafield (attr= :tag "091") :subfield (attr= :code "a")] ; Signaturen
   :price [:datafield (attr= :tag "024") :subfield (attr= :code "c")] ; Preis
   :game_category [:datafield (attr= :tag "024") :fixme] ; Spiel-Systematikgruppe
   :game_description [:datafield (attr= :tag "300") :subfield (attr= :code "a")] ; Beschreibung von Spielen
   :game_materials [:datafield (attr= :tag "024") :fixme] ; Spiel-Materialdetails
   })

