npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@brechtvdv/lib-decision-validation

v1.0.34-pre-release

Published

This module is used to validate publications in the context of the Flemish government.

Downloads

9

Readme

Overview

The App Validation Tool is an npm module designed to safeguard the integrity of data published to a triple store, crucial in scenarios involving multiple publishers. It meticulously compares publications against a predefined data blueprint, pinpointing discrepancies and enforcing data structure compliance according to specified standards.

Crafted with Test-Driven Development (TDD) principles at its core, this npm module emphasizes reliability and robustness from the ground up. Developed in TypeScript for enhanced type safety and transpiled to JavaScript for wide-ranging compatibility, it incorporates an extensive suite of Jest tests. This rigorous testing approach ensures the module performs reliably under various scenarios, making it a trustworthy addition to any Node.js project.

Features

Document Type Validation

Publications must meet structural requirements to ensure consistency and readability. The module supports validation for the following document types:

- Besluitenlijst
- Notule
- Agenda

In addition to specific document types, each publication is required to have a title, validated as a string to ensure it is present and correctly formatted. For "Notule" documents, there is an additional requirement to validate the maturity level, ensuring that these documents not only meet structural standards but also adhere to designated maturity criteria, adding a layer of depth to the validation process.

Validation Glue

In order to properly validate an agenda item exists in a publication, we need to know the following:

- Agenda item
  - title
  - resolution
  - vote
  - decision
- Session
  - time
  - governing body

Repository Structure

└── app-validation-tool/
    ├── README.md
    ├── files
    │   └── basic-agenda.ttl
    │   └── decision-list.ttl
    │   └── notulen.ttl
    ├── jest.config.js
    ├── package-lock.json
    ├── package.json
    ├── src
    │   ├── index.ts
    │   ├── queries.ts
    │   ├── tests
    │   ├── examples.ts
    │   └── validation.ts
    ├── tsconfig.json
    ├── tslint.json
    ├── tsup.config.ts
    └── yarn.lock

Installation

  1. Clone the app-validation-tool repository:
$ git clone https://github.com/lblod/app-validation-tool
  1. Change to the project directory:
$ cd app-validation-tool
  1. Install the dependencies:
$ > npm install
  1. Install the module from npm:
$ > npm install app-validation-tool

Usage

To use the module, import it into your project:

import { validatePublication, getBlueprintOfDocumentType, fetchDocument, getExampleOfDocumentType } from 'app-validation-tool/dist';

Then, call the validatePublication function with the publication data to validate:

const blueprint: Bindings[] = await getBlueprintOfDocumentType('Notulen');
const example: Document = getExampleOfDocumentType('Notulen');
const publication: Bindings[] = await fetchDocument(NOTULEN_LINK, PROXY);

const validationResult = await validatePublication(publication, blueprint, example);

The validatePublication function returns an array of subjects. Each subject is structured as follows:

[key: number]: {
  name: string,
  totalCount: number,
  type: string,
  typeName: string,
  url: string,
  usedShape: string,
  validCount: number,
  validatedProperties: {
    [key: number]: {
      name: string,
}

Testing

Run the test suite using the command below:

npm run test

Documentation

Link to the full documentation here.

Return