# @openclinical/pfanalyse

> A CLI tool for analysing PROformajs protocols

Latest version **0.6.2** (published 2025-01-29) · GPL-3.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @openclinical/pfanalyse
pnpm add @openclinical/pfanalyse
yarn add @openclinical/pfanalyse
bun add @openclinical/pfanalyse
```

Provides the command `pfanalyse`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2025-01-29 |
| First published | 2018-02-07 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 82.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matt South |
| Maintainers | openclinical-owner, mattsouth, srk23 |

## Links

- npm: https://www.npmjs.com/package/@openclinical/pfanalyse
- Repository: https://gitlab.com/openclinical/pfanalyse
- Homepage: https://gitlab.com/openclinical/pfanalyse#readme
- Issues: https://gitlab.com/openclinical/pfanalyse/issues
- npm.io page: https://npm.io/package/@openclinical/pfanalyse

## Dependencies (6)

- [commander](https://npm.io/package/commander.md) 4.*
- [csv-parse](https://npm.io/package/csv-parse.md) *
- [valid-url](https://npm.io/package/valid-url.md) *
- [superagent](https://npm.io/package/superagent.md) *
- [readline-sync](https://npm.io/package/readline-sync.md) ^1.4.10
- [@openclinical/proformajs](https://npm.io/package/@openclinical/proformajs.md) *

## Recent versions

- 0.6.2 (latest) — 2025-01-29
- 0.5.1 — 2024-01-02
- 0.5.0 — 2023-11-26
- 0.4.0 — 2020-05-02
- 0.3.1 — 2018-03-02
- 0.3.0 — 2018-03-01
- 0.2.0 — 2018-02-28
- 0.1.0 — 2018-02-07

## README

# PFAnalyse

PFAnalyse is a command-line tool for analysing PROformajs protocols.

## Getting started

With [Nodejs](https://nodejs.org) (tested with v16+) and [Git](https://git-scm.com/) installed you can first clone the repository, install the dependencies and then link the package.

```
you@yourmachine:~$ git clone https://gitlab.com/openclinical/pfanalyse.git
you@yourmachine:~$ cd pfanalyse
you@yourmachine:~$ npm install
you@yourmachine:~$ npm link
you@yourmachine:~$ pfanalyse

Usage: pfanalyse [options] <guideline_url> [decision_path] [data_url]

A command line tool to analyse proformajs decisions

Options:
  -d, --debug            Show debug information
  -u, --user <username>  username (for authenticating to labs.openclinical.net)
  -s, --show             Show decision PROforma (when viewing a decision)
  -V, --version          output the version number
  -h, --help             output usage information
```

PFAnalyse performs the following steps:

1. loads the guideline
2. grabs the decision, analyses it to find it's dependent data definitions
3. loads the csv file
4. checks the csv file to make sure that the first columns match the set of data definitions and the subsequent columns match the set of decision candidates
5. loads the data from each row of the csv into the extracted single decision model to see if the recommendation matches the suggested recommendation
6. returns a csv that has the following shape:

```csv
loaded	matched	flu	cold	other
true	false	NN	YN	NY
true	true	YY	NN	NN
```

Where the first "Y" or "N" indicates the value passed in the data file and the
second "Y" or "N" indicates whether the candidate is recommended by the decision model.
In the example one line matches the recommendation and the other does not.
The first case suggests a flu diagnosis where the data recorded a cold.

Note that if the csv file is ommitted, the tool performs steps 1 and 2 above and then outputs the headers for the csv it expects to injest and indicates the accepted values
for those columns.  Note that an asterix indicates a multi-valued data item which will accept array values.

## Examples

Try the following examples:

```
pfanalyse file://./etc/cold_or_flu.json
pfanalyse file://./etc/cold_or_flu.json cold_or_flu:diagnosis
pfanalyse file://./etc/cold_or_flu.json cold_or_flu:diagnosis file://./etc/cold_or_flu.tsv
pfanalyse file://./etc/cold_or_flu.json cold_or_flu:diagnosis file://./etc/cold_or_flu-noparse.tsv
pfanalyse file://./etc/dyndef.json exporttest:decision file://./etc/dyndef.tsv
pfanalyse https://labs.openclinical.net/api/v1/demo/cold_or_flu
pfanalyse file://./etc/issue1.json
pfanalyse file://./etc/issue1.json cold_or_flu:diagnosis2
pfanalyse file://./etc/issue1.json cold_or_flu:diagnosis2 file://./etc/issue1.json
```

---
_Source: https://npm.io/package/@openclinical/pfanalyse · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
