https://github.com/cheminfo/mrz

https://github.com/cheminfo/mrz

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.5%) to scientific vocabulary

Keywords

hacktoberfest

Keywords from Contributors

nmr nmr-spectroscopy chemistry
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: cheminfo
  • License: mit
  • Language: TypeScript
  • Default Branch: main
  • Homepage:
  • Size: 716 KB
Statistics
  • Stars: 76
  • Watchers: 9
  • Forks: 27
  • Open Issues: 6
  • Releases: 34
Topics
hacktoberfest
Created over 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.md

mrz

Parse MRZ (Machine Readable Zone) from identity documents.

Zakodium logo

Maintained by Zakodium

[![NPM version][npm-image]][npm-url] [![build status][ci-image]][ci-url] [![npm download][download-image]][download-url]

Installation

$ npm install mrz

Example

```js const parse = require('mrz').parse;

const mrz = [ 'I<UTOD23145890<1233<<<<<<<<<<<', '7408122F1204159UTO<<<<<<<<<<<6', 'ERIKSSON<<ANNA<MARIA<<<<<<<<<<', ];

var result = parse(mrz); console.log(result); ```

API

parse(mrz, [options])

Parses the provided MRZ. The argument can be an array of lines or a single string including line breaks. This function throws an error if the input is in an unsupported format. It will never throw an error when there are invalid fields in the MRZ. Instead, the result.valid value will be false and details about the invalid fields can be found in result.details.

Options

options.autocorrect

If set to true, some ambiguous characters will be automatically corrected by the parser if the field is supposed to only contain numeric or alphabetic characters. For example, in a date field, the letter "O" will be converted to the number "0".

Information about autocorrected characters will be added to the result details.

Default: false.

Shape of the parse result

result.format

String identifying the format of the parsed MRZ. Supported formats are:

  • TD1 (identity card with three MRZ lines)
  • TD2 (identity card with two MRZ lines)
  • TD3 (passport)
  • SWISSDRIVINGLICENSE
  • FRENCHNATIONALID
result.valid

true if all fields are valid. false otherwise.

result.fields

Object mapping field names to their respective value. The value is set to null if it is invalid. The value may be different from the raw value. For example, result.fields.sex will be "male" when the raw value was "M".

result.documentNumber

The document number, as can be found in the visual elements of the document, outside the MRZ. For some documents, it may be composed of multiple parsed fields. It may also not include the MRZ field named documentNumber. If any of the used fields is invalid, this field will be set to null.

result.details

Array of objects describing all parsed fields. Its structure is:

  • label {string} - Full english term for the field.
  • field {string|null} - Name of the field in result.fields. Null for some fields such as separators that don't contain a value.
  • value {string} - Value of the field (if it's valid) or null.
  • valid {boolean} - Whether the field is valid.
  • ranges {Array} - Array of ranges that are necessary to compute this field. Ranges are objects with line, start, end and raw.
  • line {number} - Index of the line where the field's value is located.
  • start {number} - Index of the start of the field's value in line.
  • end {number} - Index of the end of the field's value in line.
  • error {undefined|string} - Contains a message describing the error if the field is invalid.
  • autocorrect {array} - Contains indices of characters that were autocorrected and their original value.

formats

Static mapping of supported formats.

states

Static mapping of state code to state name.

Specifications

TD1, TD2 and TD3

https://www.icao.int/publications/pages/publication.aspx?docnum=9303

Swiss driving license

https://www.astra.admin.ch/dam/astra/fr/dokumente/dokumente-strassenverkehr/kreisschreiben/ch-fak.pdf.download.pdf/Le%20permis%20de%20conduire%20suisse%20format%20carte%20de%20cr%C3%A9dit%20(PCC).pdf

French national id

https://fr.wikipedia.org/wiki/Cartenationaled%27identit%C3%A9enFrance#Codagebande%C3%A0lectureoptique

License

MIT

Owner

  • Name: Cheminfo
  • Login: cheminfo
  • Kind: organization

GitHub Events

Total
  • Release event: 1
  • Watch event: 3
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 4
  • Pull request event: 3
  • Pull request review event: 1
  • Fork event: 1
  • Create event: 2
Last Year
  • Release event: 1
  • Watch event: 3
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 4
  • Pull request event: 3
  • Pull request review event: 1
  • Fork event: 1
  • Create event: 2

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 134
  • Total Committers: 11
  • Avg Commits per committer: 12.182
  • Development Distribution Score (DDS): 0.701
Past Year
  • Commits: 6
  • Committers: 3
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
cheminfo bot a****n@c****g 40
Michaël Zasso t****s@p****m 39
Luc Patiny l****c@p****m 27
Daniel Kostro k****d@g****m 10
lpatiny g****3 9
Wadjih Bencheikh j****h@e****z 4
tpoisseau 2****u 1
Vladimir Fomin v****r@f****z 1
Sebastien Ahkrin 3****n 1
Océane Patiny o****e@p****m 1
Daniel Locatelli l****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 26
  • Total pull requests: 36
  • Average time to close issues: 3 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 18
  • Total pull request authors: 15
  • Average comments per issue: 2.19
  • Average comments per pull request: 1.5
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: about 18 hours
  • Issue authors: 0
  • Pull request authors: 4
  • Average comments per issue: 0
  • Average comments per pull request: 0.4
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lpatiny (5)
  • stropitek (3)
  • kaydwithers (3)
  • locatellidaniel (1)
  • LaFrimousse (1)
  • opmiguel (1)
  • targos (1)
  • LaurianneL-web (1)
  • vaclajon (1)
  • mvayngrib (1)
  • aeisenberg (1)
  • noamyg (1)
  • tuqire (1)
  • mat2718 (1)
  • josoriom (1)
Pull Request Authors
  • cheminfo-bot (18)
  • targos (8)
  • wadjih-bencheikh18 (4)
  • stropitek (3)
  • tpoisseau (2)
  • sam-01et (2)
  • RomaricMourgues (2)
  • josoriom (1)
  • lukesolo (1)
  • mat2718 (1)
  • opatiny (1)
  • Sebastien-Ahkrin (1)
  • 76grady (1)
  • locatellidaniel (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
autorelease: tagged (13) autorelease: pending (4)

Packages

  • Total packages: 1
  • Total downloads:
    • npm 46,141 last-month
  • Total dependent packages: 12
  • Total dependent repositories: 25
  • Total versions: 27
  • Total maintainers: 4
npmjs.org: mrz

Parse MRZ (Machine Readable Zone) from identity documents

  • Versions: 27
  • Dependent Packages: 12
  • Dependent Repositories: 25
  • Downloads: 46,141 Last month
Rankings
Downloads: 1.1%
Dependent packages count: 1.8%
Dependent repos count: 2.5%
Average: 3.2%
Forks count: 4.9%
Stargazers count: 5.7%
Last synced: 11 months ago

Dependencies

package.json npm
  • cheminfo-build ^1.1.11 development
  • eslint ^8.13.0 development
  • eslint-config-cheminfo ^7.3.0 development
  • jest ^27.5.1 development
  • prettier ^2.6.2 development
.github/workflows/lactame.yml actions
  • actions/checkout v2 composite
  • actions/setup-node v2 composite
  • zakodium/lactame-action v1 composite
.github/workflows/typedoc.yml actions
  • JamesIves/github-pages-deploy-action releases/v4 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • zakodium/typedoc-action v2 composite