@skorm11x/ussf-hpa-scorer 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +94 -82
  2. package/package.json +9 -3
package/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # USSF HPA Scorer
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@skorm11x/ussf-hpa-scorer)](https://www.npmjs.com/package/@skorm11x/ussf-hpa-scorer)
4
+ [![license](https://img.shields.io/npm/l/@skorm11x/ussf-hpa-scorer)](./LICENSE)
5
+
3
6
  TypeScript utilities for computing **United States Space Force Human Performance
4
7
  Assessment (HPA)** scores per **SFMAN 36-2905 (Human Performance and Readiness)**.
5
- Laid out so `typescript-functions/` drops straight into a Palantir code
6
- repository.
8
+
9
+ Available two ways:
10
+
11
+ - **npm package** — a zero-dependency scorer library (ESM + CJS + types)
12
+ - **Palantir Foundry functions** — drop-in `typescript-functions/` source tree
7
13
 
8
14
  ## Scoring model
9
15
 
@@ -23,109 +29,115 @@ The **2.0 km walk** (pass/fail only, no points) is scored separately for
23
29
  members on a medical profile. Waist-to-height ratio is assessed but is **not**
24
30
  part of the scored composite.
25
31
 
26
- ## Install (npm)
32
+ ## Install
27
33
 
28
34
  ```bash
29
35
  npm install @skorm11x/ussf-hpa-scorer
30
36
  ```
31
37
 
32
38
  ```ts
33
- import { UssfHpaScorer } from "@skorm11x/ussf-hpa-scorer"; // ESM
39
+ import { UssfHpaScorer } from "@skorm11x/ussf-hpa-scorer"; // ESM
34
40
  // const { UssfHpaScorer } = require("@skorm11x/ussf-hpa-scorer"); // CJS
35
41
  ```
36
42
 
37
- The package ships `dist/` with dual ESM (`index.mjs` + `index.d.ts`) and CJS
38
- (`index.cjs` + `index.d.cts`) builds — verified with `publint` and
39
- `@arethetypeswrong/cli`. The `typescript-functions/` source tree is included in
40
- the tarball so npm consumers can also lift the Foundry functions from
41
- `node_modules/@skorm11x/ussf-hpa-scorer/typescript-functions/`.
43
+ Ships dual ESM/CJS builds with type declarations. No runtime dependencies.
42
44
 
43
- ## Repository layout
45
+ ## Usage
44
46
 
45
- ```
46
- typescript-functions/
47
- src/
48
- functions/ # published Foundry functions (default export each)
49
- scoreHpaAssessment.ts # full assessment -> composite/passed/category
50
- scoreHpaComponent.ts # single component -> points/minimumMet
51
- scoreHpaWalk.ts # 2.0 km walk -> pass/fail boolean
52
- hpaComponentMinimum.ts # component minimum bound lookup
53
- hpaPerformanceForPoints.ts # inverse: easiest perf for N points
54
- # -> {achievable, bound, unit} (no nullables)
55
- UssfHpaScorer.ts # shared scoring class, zero dependencies
56
- ussfHpaTypes.ts # shared types
57
- scoring-tables.generated.ts # embedded charts (2,923 rows)
58
- index.ts # package entry / barrel export
59
- dist/ # tsup build output (gitignored, npm-packed)
60
- tsup.config.ts # dual ESM+CJS+dts build
61
- test/ # vitest suite (25 tests)
62
- stubs/osdk-functions.d.ts # LOCAL-ONLY @osdk/functions stub — do not copy to Foundry
63
- parse_ussf.py # regenerates tables from the scoring PDF
64
- ussf-hpa-scoring.pdf # source chart document
65
- ```
66
- test/ # vitest suite (25 tests)
67
- stubs/osdk-functions.d.ts # LOCAL-ONLY @osdk/functions stub — do not copy to Foundry
68
- parse_ussf.py # regenerates tables from the scoring PDF
69
- ussf-hpa-scoring.pdf # source chart document
70
- ```
47
+ ### Score a full assessment
71
48
 
72
- ## Using in Foundry
73
-
74
- Copy `typescript-functions/src/` into the code repository. Each file under
75
- `src/functions/` is a self-contained published function (default export, file
76
- name = function name) using only supported signature types (`Integer`, `Double`,
77
- `string`, `boolean`, struct returns).
49
+ ```ts
50
+ const result = UssfHpaScorer.scoreAssessment({
51
+ sex: "male",
52
+ age: 24, // or dateOfBirth + testDate
53
+ cardio: { component: "run", value: "14:03" }, // "mm:ss" or seconds
54
+ strength: { component: "pushUps", value: 55 },
55
+ core: { component: "plank", value: "2:05" },
56
+ });
57
+ // -> { composite: 78.7, passed: true, category: "healthMaintenance",
58
+ // components: {...}, failedComponents: [] }
59
+ ```
78
60
 
79
- Component names are passed as strings: `"run"`/`"hamr"` (cardio),
80
- `"pushUps"`/`"handReleasePushUps"` (strength),
81
- `"sitUps"`/`"crossLegReverseCrunch"`/`"plank"` (core). Timed values are in
82
- **seconds**; HAMR is shuttle count; the rest are rep counts.
61
+ ### Score a single component
83
62
 
84
- - If the repo uses **`@osdk/functions`** (TypeScript v2) — works as written.
85
- - If the repo uses **`@foundry/functions-api`** — swap the import path in each
86
- function file.
87
- - Delete `stubs/` — it exists only to typecheck this standalone repo.
63
+ ```ts
64
+ UssfHpaScorer.scoreRun("male", 24, "13:44"); // -> { points: 59, ... }
65
+ UssfHpaScorer.scoreHamr("male", 24, 87); // -> { points: 60, ... }
66
+ UssfHpaScorer.scorePushUps("female", 20, 46); // -> { points: 19.8, ... }
67
+ UssfHpaScorer.scorePlank("male", 42, "3:15"); // -> { points: 20, ... }
68
+ UssfHpaScorer.scoreComponent("male", "<25", "sitUps", 58);
69
+ ```
88
70
 
89
- ## Using as a library
71
+ ### All permutations at once
90
72
 
91
73
  ```ts
92
- import { UssfHpaScorer } from "./typescript-functions/src/index.js";
74
+ UssfHpaScorer.componentPermutations(); // the 12 valid combos
93
75
 
94
- UssfHpaScorer.scoreRun("male", 24, "13:44"); // -> { points: 59, ... }
95
- UssfHpaScorer.scoreAssessment({
96
- sex: "male", age: 24,
97
- cardio: { component: "run", value: "14:03" }, // "mm:ss" or seconds
98
- strength: { component: "pushUps", value: 55 },
99
- core: { component: "plank", value: "2:05" },
100
- });
101
- UssfHpaScorer.scorePermutations({ sex: "male", age: 24 }, { run: "14:03", ... });
76
+ UssfHpaScorer.scorePermutations(
77
+ { sex: "male", age: 24 },
78
+ { run: "14:03", hamr: 80, pushUps: 55, handReleasePushUps: 33,
79
+ sitUps: 51, crossLegReverseCrunch: 42, plank: "2:05" },
80
+ ); // -> 12 scored assessments
102
81
  ```
103
82
 
104
- ## Scoring data provenance & regeneration
83
+ ### Walk, minimums, inverse lookups
105
84
 
106
- Embedded tables were extracted from the published **USSF HPA Scoring** chart
107
- document (`ussf-hpa-scoring.pdf`, labeled "as of 4 February 2026") covering all
108
- 9 age groups × 2 sexes. To regenerate after a standards change:
109
-
110
- 1. Replace `ussf-hpa-scoring.pdf` with the updated chart.
111
- 2. Run `npm run regen` (requires `pdftotext` from poppler + python3).
112
- This rebuilds `scoring-data.json` and
113
- `typescript-functions/src/scoring-tables.generated.ts`.
114
- 3. `npm run typecheck && npm test`.
85
+ ```ts
86
+ UssfHpaScorer.scoreWalk("female", 44, "17:45"); // -> true (pass/fail only)
87
+ UssfHpaScorer.walkMaxSeconds("female", 44); // -> 1069
115
88
 
116
- > ⚠️ Verify the embedded tables against the governing SFMAN 36-2905 release on
117
- > official USSF channels before operational use — the chart source is a public
118
- > mirror, and the manual's internal scoring tables are authoritative.
119
- > Asterisked chart values are treated as **inclusive** minimum component values.
89
+ UssfHpaScorer.componentMinimum("male", "<25", "run");
90
+ // -> { bound: 1185, inclusive: true, unit: "seconds" }
120
91
 
121
- ## Development
92
+ UssfHpaScorer.performanceForPoints("male", "<25", "run", 59);
93
+ // -> 824 (run ≤ 13:44 earns 59 pts; null if target exceeds max)
122
94
 
123
- ```bash
124
- npm install
125
- npm run typecheck # tsc --noEmit (NodeNext)
126
- npm test # vitest
127
- npm run build # tsup -> dist/ (esm + cjs + dts)
128
- npm pack # produces the publishable tarball
95
+ UssfHpaScorer.ageGroup(29); // -> "25-29"
96
+ UssfHpaScorer.ageOn("2000-06-15", "2026-06-01"); // -> 25
129
97
  ```
130
98
 
131
- Publishing: `npm publish` (runs `prepublishOnly`: typecheck + tests + build).
99
+ ### Reference values
100
+
101
+ | Param | Accepted values | Unit |
102
+ |---|---|---|
103
+ | `sex` | `"male"`, `"female"` | — |
104
+ | `component` (cardio) | `"run"`, `"hamr"` | seconds / shuttles |
105
+ | `component` (strength) | `"pushUps"`, `"handReleasePushUps"` | reps |
106
+ | `component` (core) | `"sitUps"`, `"crossLegReverseCrunch"`, `"plank"` | reps / seconds |
107
+ | `value` (timed) | seconds or `"mm:ss"` | — |
108
+ | `ageGroup` | `"<25"`, `"25-29"`, …, `"55-59"`, `"60+"` | — |
109
+
110
+ ## Using in Palantir Foundry
111
+
112
+ Copy `typescript-functions/src/` from this repo (or from
113
+ `node_modules/@skorm11x/ussf-hpa-scorer/typescript-functions/` after
114
+ `npm install`) into your code repository. Each file under `src/functions/` is a
115
+ self-contained published function — default export, file name = function name,
116
+ supported signature types only:
117
+
118
+ | Function | Returns |
119
+ |---|---|
120
+ | `scoreHpaAssessment` | composite, passed, category, per-component detail |
121
+ | `scoreHpaComponent` | points, maxPoints, minimumMet, minimumBound, unit |
122
+ | `scoreHpaWalk` | boolean (pass/fail) |
123
+ | `hpaComponentMinimum` | bound, inclusive, unit |
124
+ | `hpaPerformanceForPoints` | achievable, bound, unit |
125
+
126
+ - Uses **`@osdk/functions`** types (TypeScript v2 layout). For an older
127
+ `@foundry/functions-api` repo, swap the import path in each function file.
128
+ - Timed values are passed as `Double` seconds; component names as strings.
129
+
130
+ ## Scoring data
131
+
132
+ Embedded scoring tables were extracted from the published **USSF HPA Scoring**
133
+ chart document labeled *"as of 4 February 2026"* — all 9 age groups × male/female,
134
+ covering every component option (2,923 scoring rows).
135
+
136
+ > ⚠️ The embedded charts are sourced from a public mirror. Verify against the
137
+ > governing **SFMAN 36-2905** release on official USSF channels before
138
+ > operational use — the manual's scoring tables are authoritative. Asterisked
139
+ > chart values are treated as **inclusive** minimum component values.
140
+
141
+ ## License
142
+
143
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skorm11x/ussf-hpa-scorer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "United States Space Force Human Performance Assessment (HPA) scoring utilities per SFMAN 36-2905 — also ships as drop-in Palantir Foundry functions",
5
5
  "keywords": [
6
6
  "ussf",
@@ -22,8 +22,14 @@
22
22
  "types": "./dist/index.d.ts",
23
23
  "exports": {
24
24
  ".": {
25
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
26
- "require": { "types": "./dist/index.d.cts", "default": "./dist/index.cjs" }
25
+ "import": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/index.d.cts",
31
+ "default": "./dist/index.cjs"
32
+ }
27
33
  },
28
34
  "./package.json": "./package.json"
29
35
  },