0.1.4 • Published 9 months ago

ahbicht-ts-models v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

ahbicht-ts-models

This repository contains the NPM package ahbicht-ts-models. The package contains the AHBicht data model as TypeScript interfaces.

This repository contains no logic, just types for ease of use in any frontend project.

The files in src are completly autogenerated from JSON Schemas, so they're inherently consistent with the AHBicht Python code. Any push to the Python repos json_schemas directory will create a commit in this repository.

Installation

npm install ahbicht-ts-models

Example

import axios from "axios";
import {
  CategorizedKeyExtract,
  ContentEvaluationResult,
  AhbExpressionEvaluationResult,
} from "ahbicht-ts-models";
axios
  .get("https://ahbicht.azurewebsites.net/api/CategorizedKeyExtract", {
    params: {
      expression: "Muss ([2]O[3])[902][501]",
    },
  })
  .then(function (ckeResponse) {
    let categorizedKeyExtract: CategorizedKeyExtract = ckeResponse.data;
    console.log(
      "Retrieved categorized keys from AHBicht: ",
      categorizedKeyExtract
    );
    // You can now extract the key of the packages, RCs, FCs and hints from the categorized key extract.
    // Then you could build a content evaluation result from it; here we hard code it for simplicity:
    let contentEvaluationResult: ContentEvaluationResult = {
      requirement_constraints: { "2": "FULFILLED", "3": "UNFULFILLED" },
      format_constraints: { "902": { format_constraint_fulfilled: true } },
      hints: { "501": "muss 42 nachkommastellen haben" },
    };
    axios
      .post(
        "https://ahbicht.azurewebsites.net/api/ParseExpression",
        contentEvaluationResult,
        {
          params: {
            expression: "Muss ([2]O[3])[902][501]",
          },
        }
      )
      .then(function (cerResponse) {
        let ahbExpressionEvaluationResult: AhbExpressionEvaluationResult = cerResponse.data;
        console.log(ahbExpressionEvaluationResult);
      });
  });

Release Workflow (CI/CD)

  • Update the source code (automatically for /src, manually for at least the version bump in index.d.ts)
  • click on "Draft a new Release" in the right sidebar on Github
  • Choose a tag that will be pushed to the selected branch (should be main in most cases)
  • Autogenerate Release Notes

Detailed Information on the AHBicht Types

Please refer to the official AHBicht docs.

Mappings

Parsing Results & Helper

Evaluation Results

0.1.4

9 months ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.1

2 years ago