Giter Site home page Giter Site logo

avram-js's People

Contributors

nichtich avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

avram-js's Issues

Document error format

Validator returns a list of validation errors but format of an error needs to be specified.

Remove marc-json

This library should be agnostic to MARC or PICA. Preprocessing MARC data to be fed into avram validator is out of the scope of this project

Support MARC Example format

Looks like this:

LDR 01000cam a2200265   4500
001     1844949419
245 10 _aKirschblütenküsse auf Mallorca
       _cKeri Anne Arden
935    _iSLoT
951    _aBO
       _bj

Update web demo

The web application in docs/ is broken because it required Analyzer (see #4) but this is not the main purpose of avram-js anyway. Better add validation demo instead. See https://csvlint.io/ for a similar application.

CLI: add method to infer/specify record types

Primary use case MARC data. Could be hard-coded in lib/record. In any case, record types are

  • either specified for all input records with --type
  • or determinde from a plugin function ("recordTypeProvider"), e.g. marc21bibliographicRecordType

Default could be to enable marc21bibliographicRecordType unless --type "" is given.

The provider could be set with -x, --extension [name] where name is a node package or local file. The extension can provide methods detectRecordTypes(fields) as well as rules ( #15), e.g. loadRule returning an object with methods checkRecord, checkField, checkSubfield .

Adjust to 0.9.7

Definition of rule ids has been changed to be IRI references.

Support validation with external rules

Requires a method to load/supply code via plugins and/or a ruleLoader.

  • A plugin maps external rules (e.g. xsd:nonNegativeInteger) to executable code
  • Plugins can also have parameters (when external rule is given as object). See Shacl-based rules in QA Catalogue for use case
  • Add option plugins with name(s) of node modules or relative JavaScript files to be loaded

A plugin (aka rule engine) gets the external rule (string or object) and returns a rule checker. A rule checker is a function that gets a record/field/subfield and returns a (possibly empty) array of errors. An error is a JSON object with keys message. Additional keys error (rule id), tag, occurrence, are set automatically by caller.

Rules at upper level Avram elements are initialized first, so in this case:

{
  "fields": {
    "abc": {
      "rules": [ "x-rule" ]
    }
  },
  "rules": [ 
    { "id": "x-rule", .. }
  ]
}

The rule engine knows about { "id": "x-rule", .. } first so it can use "x-rule" as reference to the former rule.

Finish validation

Missing:

  • format families
  • indicators
  • countSubfield
  • countCode
  • missingField
  • externalRule

Then check against the validation rules in the specification

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.