Group
Extension

Matches 4

ClarID-Tools ( M/MR/MRUEDA/ClarID-Tools-0.02.tar.gz, MRUEDA, 2025; MetaCPAN )
ClarID-Tools/lib/ClarID/Tools/Validator.pm ( view source; MetaCPAN )
package ClarID::Tools::Validator;
use strict;
use warnings;
use utf8;
use JSON::Validator;
use JSON::Validator::Schema;
use Term::ANSIColor qw(:constants);
use Exporter 'import';
our @EXPORT_OK = qw(v
schema, $debug) = @_;

  ClarID::Tools::Validator::_self_validate($schema) if $debug;

  my $jv = JSON::Validator->new;
  $jv->schema($schema);

  my @errors = $jv->validate($data);
  if (@errors) {
 
ub _self_validate {
  my ($schema) = @_;
  my $validator = JSON::Validator::Schema->new($schema);
  die "Invalid JSON Schema\nSee https://json-schema.org/" if $validator->is_invalid;
  print "Codebook
ClarID-Tools ( M/MR/MRUEDA/ClarID-Tools-0.02.tar.gz, MRUEDA, 2025; MetaCPAN )
ClarID-Tools/lib/ClarID/Tools/Command/code.pm ( view source; MetaCPAN )
 warnings;
use feature qw(say);
use ClarID::Tools;
use ClarID::Tools::Util qw(load_yaml_file load_json_file);
use Moo;
use MooX::Options
  auto_help        => 1,
  version          => $ClarID::Tools::
ip qw(gunzip $GunzipError);
use IO::Compress::Gzip     qw(gzip   $GzipError);
use JSON::XS               qw(decode_json);
use File::Spec::Functions  qw(catdir catfile);

# Tell App::Cmd this is a comm
   => Str,
    default => sub { catfile( $ClarID::Tools::share_dir, 'icd10.json' ) },
    doc     => 'path to ICD-10 map JSON',
);
option with_condition_name => (
    is      => 'ro',
    is_flag => 1
ClarID-Tools ( M/MR/MRUEDA/ClarID-Tools-0.02.tar.gz, MRUEDA, 2025; MetaCPAN )
ClarID-Tools/lib/ClarID/Tools/Command/validate.pm ( view source; MetaCPAN )
=> 'pod',
  version   => $ClarID::Tools::VERSION;
use YAML::XS        qw(LoadFile);
use JSON::XS   qw(decode_json);
use Path::Tiny      qw(path);
use ClarID::Tools::Validator;
# Tell App::Cmd this is 

  default  => sub { catfile( $ClarID::Tools::share_dir, 'clarid-codebook-schema.json' ) },
  doc      => 'path to JSON Schema file',
);

option debug => (
  is       => 'ro',
  is_flag  => 1,
  defau
     => 'self-validate the schema before use',
);
sub abstract { "validate a codebook against its JSON schema" }

sub execute {
    my ($self, $opts, @args) = @_;

    my $cb_data    = LoadFile( $self
ClarID-Tools ( M/MR/MRUEDA/ClarID-Tools-0.02.tar.gz, MRUEDA, 2025; MetaCPAN )
ClarID-Tools/lib/ClarID/Tools/Util.pm ( view source; MetaCPAN )
roak);
use YAML::XS           qw(LoadFile);
use JSON::XS           qw(decode_json);
use Exporter 'import';
our @EXPORT_OK = qw( load_yaml_file load_json_file );

# Load a YAML file, ensure it’s a HA

    return $data;
}

# Load a JSON file, ensure it’s a HASHREF
sub load_json_file {
    my ($file) = @_;
    open my $fh, '<', $file
      or croak "Error opening JSON file '$file': $!";
    local 
$/;
    my $text = <$fh>;
    close $fh;
    my $data = eval { decode_json($text) };
    croak "Error parsing JSON in '$file': $@" if $@;
    croak "Expected a HASH in '$file'" unless ref $data eq 'HA

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.