Giter Site home page Giter Site logo

timlegge / perl-health-shc Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 154 KB

Perl module for Smart Health Card Validation and Data Extraction

Home Page: https://metacpan.org/pod/Health::SHC

Perl 100.00%
perl shc smarthealthcard vaccine immunization jwt-token

perl-health-shc's Introduction

NAME
    Health::SHC - Verify Smart Health Card Signature and Extract data.

SYNOPSIS
        use Health::SHC::Validate;
        my $shc_valid = Health::SHC::Validate->new();

        # Use builtin trusted keys
        my $data = $shc_valid->get_valid_data($qr);

        # Use your own keys to validate - you may trust them
        my $data = $shc_valid->get_valid_data($qr, $keys_json);

        use Health::SHC;
        my $sh = Health::SHC->new();
        my @patients = $sh->get_patients($data);

        foreach (@patients) {
            print "Patient: ", $_->{given}, " ", $_->{middle}, " ", $_->{family}, "\n";
        }

        my @immunizations = $sh->get_immunizations($data);

        print "Vacination Provider", "\t", "Date", "\n";
        foreach (@immunizations) {
            print $_->{provider}, "\t", $_->{date}, "\n";
        }

        my @vaccines = $sh->get_vaccines($data);

        print "Manufacturer\tLot Number\tCode\tCode System\n";
        foreach (@vaccines) {
            print $_->{manufacturer}, "\t\t", $_->{lotNumber}, "\t\t";
            my $codes = $_->{codes};
            foreach my $tmp (@$codes) {
                print   $tmp->{code}, "\t",
                        $tmp->{system}, "\t";
            }
            print "\n";
        }

DESCRIPTION
    This perl module can extract a Smart Health Card's data from PDFs or
    image file. The extracted shc:/ Smart Health Card URI is decoded and the
    signature checked. The module provide several methods to retrieve the
    data in a more usable format.

    Health::SHC supports QR codes for the following regions:

        * Québec
        * British Columbia
        * Saskatchewan
        * Alberta
        * Newfoundland and Labrador
        * Nova Scotia
        * Ontario
        * Northwest Territories
        * Yukon
        * New Brunswick/Nouveau-Brunswick
        * Japan

    The keys in share/keys.json (and supported regions) are based on the
    keys included with https://github.com/obrassard/shc-extractor.

    Additional regions can be added with a pull request or by logging an
    issue at https://github.com/timlegge/perl-Health-SHC/issues.

COPYRIGHT
    The following copyright notice applies to all the files provided in this
    distribution, including binary files, unless explicitly noted otherwise.

    Copyright 2021 Timothy Legge <[email protected]>

LICENCE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

  METHODS
   new(...)
    Constructor; see OPTIONS above.

   get_patients($data)
    Arguments: $data: string Smart Health Card data without the "shc:/"
    prefix

    Returns: hash containing the Patient information

   get_immunizations($data)
    Arguments: $data: string Smart Health Card data without the "shc:/"
    prefix

    Returns: hash containing the Immunization data

   get_vaccines($data)
    Arguments: $data: string Smart Health Card data without the "shc:/"
    prefix

    Returns: hash containing the Vaccine data

perl-health-shc's People

Contributors

timlegge avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.