GithubHelp home page GithubHelp logo

deutsche-nationalbibliothek / pica-rs Goto Github PK

View Code? Open in Web Editor NEW
28.0 5.0 5.0 46.45 MB

Tools to work with bibliographic records encoded in PICA+.

Home Page: https://deutsche-nationalbibliothek.github.io/pica-rs/

License: European Union Public License 1.2

Rust 99.65% Shell 0.05% Makefile 0.30%
code4lib pica

pica-rs's Introduction

CI Documentation dependency status


Das Toolkit pica-rs ermöglicht eine effiziente Verarbeitung von bibliografischen Metadaten, die in PICA+, dem internen Format des OCLC-Katalogsystems, kodiert sind. Mithilfe verschiedener Kommandos können aus den Metadaten elementare statistische Größen ermittelt und aufbereitet werden. Zudem kann das Toolkit als Brückentechnologie fungieren, um Metadaten für populäre Frameworks wie Pandas oder Polars (Python), in Programmiersprachen wie R oder für Excel nutzbar zu machen.

Das Projekt ist eine Entwicklung des Referats Automatische Erschließungsverfahren; Netzpublikationen (AEN) der Deutschen Nationalbibliothek (DNB). Es wird für die Erstellung von Datenanalysen sowie für die Automatisierung von Metadaten-Workflows (Datenmanagement) im Rahmen der automatischen Inhaltserschließung genutzt. Weiterhin wird es zur Unterstützung der Forschungsarbeiten im Projekt Automatisches Erschließungssystem und für diverse andere Datenanalysen in der DNB eingesetzt.

Die Mitwirkung an pica-rs ist sehr erwünscht. Wir würden Sie bitten, mögliche Fehler, Fragen und neue Ideen als GitHub-Issues anzulegen. Diese werden wir dann intern beraten und möglichst zeitnah ein Feedback geben.

Die Installation des Toolkits und alle Kommandos sind in der Dokumentation beschrieben.

Kommandos

  • cat — Zusammenfügen (Konkatenieren) von Datensätzen
  • completions — Erzeugung von Shell-Skripten zur Autovervollständigung
  • convert — Konvertierung zwischen verschiedenen PICA-Formaten
  • count — Zählen von Datensätzen, Feldern und Unterfeldern
  • explode — Teilt Datensätze in Lokal- oder Exemplardatensätze auf
  • filter — Filtert Datensätze anhand eines Kriteriums
  • frequency — Ermitteln einer Häufigkeitsverteilung über ein oder mehrere Unterfelder
  • hash — Erzeugt SHA-256-Hashwerte von Datensätzen
  • invalid — Findet ungültige Zeilen in der Eingabe
  • partition — Partitioniert Datensätze anhand eines Unterfelds
  • print — Gibt Datensätze in einer menschenlesbaren Form aus
  • sample — Wählt eine Zufallsstichprobe eines bestimmten Umfangs aus
  • select — Selektiert ein oder mehrere Unterfelder und gibt die Daten im CSV- bzw. TSV-Format aus
  • slice — Ausschneiden eines zusammenhängenden Teilbereichs aus der Eingabe
  • split — Teilt eine Menge an Datensätzen in Dateien fester Größe

Verwandte Projekte

Lizenz

Der Quellcode sowie die Releases sind lizenziert unter der EUPL-1.2.

pica-rs's People

Contributors

a-wendler avatar mfakaehler avatar nichtich avatar nwagner84 avatar san-uh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pica-rs's Issues

Add regex operator

In order to check that a path value matches against a given regular expressin, an regex operator should be added to the query expressions.

Example

In the following query only these records are passed if there is at least one path value that match against the given regex.

$ pica cat DUMP.dat | pica filter "[email protected] =~ Tp[123]"

Change JSON format

{"fields":[
    {"name":"012A/00", "subfields":[
        {"name":"A","value":"B"},
        ...
    ] },
    ...
]}

TODOs

  • Rename subfield code to name (see #129)
  • Add fields key
  • Rename field tag to name

Pica Release 0.1.0

  • Move PICA+ parser into separate crate (use bstr::BStr instead of &str)
  • Move path parser into separate crate
  • Move PICA+ filter into separate crate (rename to matcher)
  • Add slice command (#98)
  • Add index command (#56)
  • Change JSON format (#121)
  • Setup release workflow (#114)
  • Publish project to crates.io (#118)

Add `replace` command

  • Responsible: @niko2342
  • Status: in preparation
  • Feature PR: n/a

Summary

It happens that the rules for valid subfield value changes and a cleanup process must be scheduled and performed. In the meantime (which can take months or years or will never be happen) the values are inconsistent and two or more subfield values exists which are identical. For example, if the provenance value changes from ema-gnd to emagnd. This is frustrating because each subsequent data analysis must do the same cleanup steps until the cleanup process is done.

Details

A new replace command will be added before the data analysis in order to fix this simple string replacement cases. All subsequent processes (R or Python scripts) can benefit from the cleaned subfield values. If the cleanup process is done and the source file contains no invalid subfield values, the replace command can be removed and the result must be the same.

The command could look like this:

$ pica replace "044H{b == 'GND' && 9? && H == 'ema-gnd', H = 'emagnd'}" DUMP.dat
$ pica replace "044H{b == 'GND', H := 'emagnd'}" --and "012A/*.a = 'foo'" DUMP.dat
$ pica replace "012A/*.a = 'foo'" DUMP.dat

This command (re-)uses the syntax of (pica-rs) path expressions, which can have an optional filter on subfield(s) and a list of subfields which sould be replaced. Also a new assignment operator = is introduced.

Implementation

Note This command might entail a conversion from referenced record to it's mutable variant, which results in a slower running time in comparison to commands like cat or count.

Add existence operator

In order to check whether a field exists or not, an existence operator should be added to the query expressions.

Example

In the following query only these records are passed if the given path (field, occurrence, subfield code) exists.

$ pica cat DUMP.dat | pica filter "[email protected]?"

Add starts-with operator

In order to check that a path value starts with a given prefix, an starts-with operator should be added to the query expressions.

Example

In the following query only these records are passed if there is at least one path value starting with the given prefix.

$ pica cat DUMP.dat | pica filter "[email protected] =^ 'Tp'"

Add ends-with operator

In order to check that a path value ends with a given suffix, an ends-with operator should be added to the query expressions.

Example

In the following query only these records are passed if there is at least one path value starting with the given prefix.

$ pica cat DUMP.dat | pica filter "[email protected] =$ 'p3'"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.