# @iwanglang/observation-visual-acuity

> Observation Visual Acuity

Latest version **0.0.17** (published 2024-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @iwanglang/observation-visual-acuity
pnpm add @iwanglang/observation-visual-acuity
yarn add @iwanglang/observation-visual-acuity
bun add @iwanglang/observation-visual-acuity
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.17 |
| Published | 2024-04-09 |
| First published | 2024-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 506.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | sirirajitservice |

## Links

- npm: https://www.npmjs.com/package/@iwanglang/observation-visual-acuity
- npm.io page: https://npm.io/package/@iwanglang/observation-visual-acuity

## Dependencies (3)

- [fhir](https://npm.io/package/fhir.md) ^4.12.0
- [ofetch](https://npm.io/package/ofetch.md) ^1.3.4
- [@types/fhir](https://npm.io/package/@types/fhir.md) ^0.0.41

## Recent versions

- 0.0.17 (latest) — 2024-04-09
- 0.0.16 — 2024-04-09
- 0.0.15 — 2024-04-09
- 0.0.14 — 2024-04-09
- 0.0.13 — 2024-04-09
- 0.0.12 — 2024-04-09
- 0.0.11 — 2024-04-08
- 0.0.10 — 2024-04-08
- 0.0.9 — 2024-04-08
- 0.0.8 — 2024-04-01
- 0.0.7 — 2024-04-01
- 0.0.6 — 2024-04-01
- 0.0.5 — 2024-04-01
- 0.0.4 — 2024-04-01
- 0.0.3 — 2024-03-31

## README

# IWangLang: Observation Visual Acuity

## 🚀 Quick Start

Install:

```bash
# npm
npm i @iwanglang/observation-visual-acuity

# yarn
yarn add @iwanglang/observation-visual-acuity

```

Import:

```js
// ESM / Typescript
import { ObservationVisualAcuity } from "@iwanglang/observation-visual-acuity";

// CommonJS
const {
  ObservationVisualAcuity,
} = require("@iwanglang/observation-visual-acuity");
```

## 🥸 Get Snellen Scale for create Chart

```typescript
import { ObservationVisualAcuity } from "@iwanglang/observation-visual-acuity";

const visualAcuity = new ObservationVisualAcuity();
const snellenChartScaleFoot = visualAcuity.getSnellenChartScales("foot");
const snellenChartScaleMetre = visualAcuity.getSnellenChartScales("metre");

console.log(snellenChartScaleFoot[0]);
// { "display": "20/200", "numerator": 20, "denominator": 200, "LogMAR": 1.00 }

console.log(snellenChartScaleMetre[0]);
// { "display": "6/60", "numerator": 6, "denominator": 60, "LogMAR": 1.00 }
```

use `getSnellenChartScales` function to get list of snellen scales for prepare data of Visual Acuity that will save into server

### Example for Snellen Chart

|  Foot   | Metre | LogMAR |
| :-----: | :---: | :----: |
| 20/200  | 6/60  |  1.00  |
| 20/160  | 6/48  |  0.90  |
| 20/125  | 6/38  |  0.80  |
| 20/100  | 6/30  |  0.70  |
|  20/80  | 6/24  |  0.60  |
|  20/63  | 6/18  |  0.50  |
|  20/50  | 6/15  |  0.40  |
|  20/40  | 6/12  |  0.30  |
|  20/32  | 6/9.5 |  0.20  |
|  20/25  | 6/7.5 |  0.10  |
|  20/20  |  6/6  |  0.00  |
|  20/16  | 6/4.8 | −0.10  |
| 20/12.5 | 6/3.8 | −0.20  |
|  20/10  |  6/3  | −0.30  |

## 🥸 Convert Snellen to LogMAR

```typescript
import { ObservationVisualAcuity } from "@iwanglang/observation-visual-acuity";

const visualAcuity = new ObservationVisualAcuity();
const snellenChartScaleMetre = visualAcuity.getSnellenChartScales("metre");

console.log(snellenChartScaleMetre[0]);
// { "display": "6/60", "numerator": 6, "denominator": 60, "LogMAR": 1.00 }

// LogMAR VA = 0.1 + LogMAR value of the best line read – 0.02 X (number of optotypes read)
// default optotypesRead is -2
console.log(`LogMAR is ${visualAcuity.convertSnellenToLogMAR(snellenChartScaleMetre[0].numerator, snellenChartScaleMetre[0].denominator)}`);
// LogMAR is 1
```

## 🥸 Create Visual Acuity to Fhir Server

```typescript
import { ObservationVisualAcuity, SnomedCodeBodySite } from "@iwanglang/observation-visual-acuity";

const visualAcuity = new ObservationVisualAcuity('https://hapi.fhir.org/baseR4');

// Set Authorization for Fhir Server that require authentication
visualAcuity.setToken('Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c');

// Create VisualAcuity value 0.60 LogMAR with bodySite left eye structure to Fhir Server
visualAcuity.createLogMARVisualAcuity('Patient/1', SnomedCodeBodySite.LeftEyeStructure, 0.60);
```

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