# ctgov-ocr-formatter

> Clinical Trials Data Formatter

Latest version **1.0.2** (published 2020-01-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install ctgov-ocr-formatter
pnpm add ctgov-ocr-formatter
yarn add ctgov-ocr-formatter
bun add ctgov-ocr-formatter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-01-21 |
| First published | 2019-11-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | hkoranne |
| Maintainers | ocr-app |

## Links

- npm: https://www.npmjs.com/package/ctgov-ocr-formatter
- Repository: https://github.com/UF-OCR/ctgov-ocr-formatter
- Homepage: https://github.com/UF-OCR/ctgov-ocr-formatter#readme
- Issues: https://github.com/UF-OCR/ctgov-ocr-formatter/issues
- npm.io page: https://npm.io/package/ctgov-ocr-formatter

## Dependencies (2)

- [xml2js](https://npm.io/package/xml2js.md) ^0.4.22
- [@types/xml2js](https://npm.io/package/@types/xml2js.md) ^0.4.5

## Recent versions

- 1.0.2 (latest) — 2020-01-21
- 1.0.1 — 2019-11-01
- 1.0.0 — 2019-11-01

## README

# CTGOV Data Formatter

Ever had issues with displaying the parsed data from CTGOV on web/mobile pages? And wanted to display the data in a user friendly format? Then ctgov-ocr-formatter is what you are looking for!

## Description

Simple string converter that removes unnecessary carriage returns and line breaks from the clinical trials parsed data. It returns a clean displayable string for your web and mobile pages. Uses regular expression and string functions to format the data.

Before formatting

![before](img/before.png)


After formatting

![after](img/after.png)

## Installation

Formatter is available in npm. Just `npm i ctgov-ocr-formatter` will download the packages and its dependencies.

## Usage

After installing the library, you can now easily clean up the data formatting

Typescript:
```
import { Formatter } from "ctgov-ocr-formatter";
let iFormatter = new Formatter();
let detailedEligibility = result['clinical_study']['eligibility'][0].criteria[0].textblock[0];
```

Javascript:

```
var formatter = require('ctgov-ocr-formatter');
var iformat = new formatter();
var detailedEligibility = result['clinical_study']['eligibility'][0].criteria[0].textblock[0].toLocaleString();
var formattedDetailedEligibility = iFormatter.formatData(detailedEligibility);
```
Note :  result['clinical_study']['eligibility'][0].criteria[0].textblock[0] is the xml parsed object from clinical trials. For, more detailed coding please check the test scripts available under `__test__` folder

## Development
You need latest version of Node and npm.

### npm scripts

- `npm run lint`: Run [ESLint] \(including [Prettier]).
- `npm run format`: Run [ESLint] \(including [Prettier]).
- `npm run jest`: Run unit tests. During development, `npm run jest -- --watch`
  is nice.
- `npm test`: Check that everything works.

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