0.0.3 • Published 7 years ago

@firstaccess/analysis-outputs-mapper v0.0.3

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
7 years ago

analysis-outputs-mapper

Library that maps scoring outputs through the analysis schema collating data in some structure as defined by the analysis schema by:

  • resolving values from the scoring outputs and the form data.
  • resolving formatting options from the analysis schema and the form configuration schema.

Installation

This module is distributed via npm and should be installed as one of your project's dependencies:

yarn add @firstaccess/analysis-outputs-mapper

Usage

import jsyaml from 'js-yaml';
import { mapOutputs } from '@firstaccess/analysis-outputs-mapper';

// or when using CJS modules:
// const { mapOutputs } = require('@firstaccess/analysis-outputs-mapper')

// Assuming the presence of an appraisal...
const analysisSchema = jsyaml.load(appraisal.workflow.analysisSchema.content);
const configurationSchema = appraisal.workflow.configuration.schema.schema;
const scoringResponse = JSON.parse(appraisal.scoring_response);
const outputs = scoringResponse.evaluation.outputs;
const data = appraisal.data;

const mappedOutputs = mapOutputs({
  analysisSchema,
  data,
  configurationSchema,
  outputs,
});

The mappedOutputs produced follow the sections structure dictated by the analysisSchema. See the analysis schema docs for more information on how this structure is created.

More usage examples can be found in the tests.

Contributing

  • Ensure your changes pass the precommit and prepush hooks. These should lint and format your code with EsLint and Prettier and run the tests with Jest.
  • Ensure your commits follow the conventional commits guidelines. Ultimately, this will enable the generation of automated changelogs as well as computed version numbers.
0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago