@ministryofjustice/hmpps-arns-frontend-components-lib 0.0.3 → 0.0.5
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.
- package/dist/arns/components/badge/macro.njk +0 -23
- package/dist/arns/components/badge/template.njk +44 -72
- package/dist/index.cjs.js +59 -164
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +26 -101
- package/dist/index.esm.js +59 -164
- package/dist/index.esm.js.map +1 -1
- package/dist/transformers/AllPredictorVersionedDtoToAssessmentsTransformer.d.ts +3 -0
- package/dist/types/AssessmentV1.d.ts +11 -0
- package/dist/types/AssessmentV2.d.ts +11 -0
- package/dist/types/Assessments.d.ts +3 -0
- package/dist/types/Predictor.d.ts +7 -0
- package/dist/types/RiskData.d.ts +2 -4
- package/dist/types/dtos/{allPredictorDto.d.ts → AllPredictorDto.d.ts} +8 -8
- package/dist/types/dtos/{allPredictorVersionedDto.d.ts → AllPredictorVersionedDto.d.ts} +2 -2
- package/dist/types/dtos/{basePredictorDto.d.ts → BasePredictorDto.d.ts} +1 -1
- package/dist/types/dtos/{ogpScoreDto.d.ts → OgpScoreDto.d.ts} +1 -1
- package/dist/types/dtos/{ogrScoreDto.d.ts → OgrScoreDto.d.ts} +1 -1
- package/dist/types/dtos/{ospScoreDto.d.ts → OspScoreDto.d.ts} +1 -1
- package/dist/types/dtos/{ovpScoreDto.d.ts → OvpScoreDto.d.ts} +1 -1
- package/dist/types/dtos/{rsrScoreDto.d.ts → RsrScoreDto.d.ts} +3 -3
- package/dist/types/dtos/{staticOrDynamicPredictorDto.d.ts → StaticOrDynamicPredictorDto.d.ts} +2 -2
- package/dist/types/dtos/{versionedStaticOrDynamicPredictorDto.d.ts → VersionedStaticOrDynamicPredictorDto.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/components/badge/transformation.d.ts +0 -3
- package/dist/types/badgeData.d.ts +0 -12
- /package/dist/types/dtos/{assessmentStatusDto.d.ts → AssessmentStatusDto.d.ts} +0 -0
- /package/dist/types/{bandLevel.d.ts → dtos/BandLevel.d.ts} +0 -0
- /package/dist/types/dtos/{rsrScoreSourceDto.d.ts → RsrScoreSourceDto.d.ts} +0 -0
- /package/dist/types/{staticOrDynamic.d.ts → dtos/StaticOrDynamic.d.ts} +0 -0
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
{#
|
|
2
|
-
ARNS Predictor Badge Component
|
|
3
|
-
|
|
4
|
-
Displays risk predictor score badges.
|
|
5
|
-
|
|
6
|
-
Usage:
|
|
7
|
-
In route handler:
|
|
8
|
-
const riskData = await arnsComponents.getRiskData(token, 'crn', 'X123456')
|
|
9
|
-
res.render('page', { riskData })
|
|
10
|
-
|
|
11
|
-
In template:
|
|
12
|
-
{% from "components/badge/macro.njk" import predictorBadge %}
|
|
13
|
-
{{ predictorBadge({ data: riskData }) }}
|
|
14
|
-
|
|
15
|
-
With options:
|
|
16
|
-
{{ predictorBadge({ data: riskData, showScore: true }) }}
|
|
17
|
-
|
|
18
|
-
@param {object} params
|
|
19
|
-
@param {RiskData} params.data - Risk data from ArnsComponents.getRiskData()
|
|
20
|
-
@param {string} params.predictor - The predictor data of interest
|
|
21
|
-
@param {boolean} [params.showScore=false] - Whether to display the percentage score
|
|
22
|
-
@param {string} [params.classes] - Additional CSS classes
|
|
23
|
-
#}
|
|
24
1
|
{% macro predictorBadge(params) %}
|
|
25
2
|
{%- include "./template.njk" -%}
|
|
26
3
|
{% endmacro %}
|
|
@@ -1,90 +1,62 @@
|
|
|
1
1
|
{#
|
|
2
|
-
ARNS Predictor Badge Component
|
|
2
|
+
ARNS Predictor Badge Component
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
@name predictorBadge
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
@description Displays specified risk predictor score badges.
|
|
7
|
+
It uses the latest assessment from the provided data set.
|
|
8
|
+
|
|
9
|
+
@example
|
|
7
10
|
In route handler:
|
|
8
11
|
const riskData = await arnsComponents.getRiskData(token, 'crn', 'X123456')
|
|
9
12
|
res.render('page', { riskData })
|
|
10
13
|
|
|
11
14
|
In template:
|
|
12
15
|
{% from "components/badge/macro.njk" import predictorBadge %}
|
|
13
|
-
{{ predictorBadge({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@param {
|
|
21
|
-
@param {
|
|
22
|
-
@param {string}
|
|
16
|
+
{{ predictorBadge({
|
|
17
|
+
data: riskData,
|
|
18
|
+
predictor: "allReoffendingPredictor",
|
|
19
|
+
showScore: true,
|
|
20
|
+
classes: "class-name-here"
|
|
21
|
+
}) }}
|
|
22
|
+
|
|
23
|
+
@param {object} params
|
|
24
|
+
@param {RiskData} params.data - Risk data object from ArnsComponents.getRiskData() containing an 'assessments' array
|
|
25
|
+
@param {string} params.predictor - The name of the specific predictor to display
|
|
26
|
+
@param {boolean} [params.showScore=false] - If true, displays the percentage score
|
|
27
|
+
@param {string} [params.classes] - Optional CSS utility classes to apply to the container
|
|
23
28
|
#}
|
|
24
|
-
{% set
|
|
29
|
+
{% set latestAssessment = params.data.assessments | first if params.data.assessments else null %}
|
|
25
30
|
{% set showScore = params.showScore if params.showScore else false %}
|
|
26
31
|
|
|
27
|
-
{% if
|
|
32
|
+
{% if latestAssessment is defined %}
|
|
28
33
|
<div class="predictor-badges{% if params.classes %} {{ params.classes }}{% endif %}">
|
|
29
|
-
{% for
|
|
30
|
-
{%
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
{% case 'ovpPredictorScore' %}
|
|
50
|
-
{% set badgeLabel = 'OVP' %}
|
|
51
|
-
{% case 'ogpPredictorScore' %}
|
|
52
|
-
{% set badgeLabel = 'OGP' %}
|
|
53
|
-
{% case 'rsrPredictorScore' %}
|
|
54
|
-
{% set badgeLabel = 'RSR' %}
|
|
55
|
-
{% case 'ospdcPredictorScore' %}
|
|
56
|
-
{% set badgeLabel = 'OSP-DC' %}
|
|
57
|
-
{% case 'ospiicPredictorScore' %}
|
|
58
|
-
{% set badgeLabel = 'OSP-IIC' %}
|
|
59
|
-
{% default %}
|
|
60
|
-
{% set badgeLabel = 'LABEL NOT FOUND' %}
|
|
61
|
-
{% endswitch %}
|
|
62
|
-
|
|
63
|
-
{% set badgeClass = '' %}
|
|
64
|
-
{% switch predictor.level %}
|
|
65
|
-
{% case 'VERY_HIGH' %}
|
|
66
|
-
{% set badgeClass = 'predictor-badge--very-high' %}
|
|
67
|
-
{% case 'HIGH' %}
|
|
68
|
-
{% set badgeClass = 'predictor-badge--high' %}
|
|
69
|
-
{% case 'MEDIUM' %}
|
|
70
|
-
{% set badgeClass = 'predictor-badge--medium' %}
|
|
71
|
-
{% case 'LOW' %}
|
|
72
|
-
{% set badgeClass = 'predictor-badge--low' %}
|
|
73
|
-
{% endswitch %}
|
|
74
|
-
<div class="{{ badgeClass }}">
|
|
75
|
-
<span class="predictor-badge__type_and_level">{{ badgeLabel | upper }} <strong>{{ predictor.level | replace('_', ' ') }}</strong></span>
|
|
76
|
-
|
|
77
|
-
{% if showScore and predictor.score %}
|
|
78
|
-
<span class="predictor-badge__score">{{ predictor.score }}%</span>
|
|
79
|
-
{% endif %}
|
|
34
|
+
{% for key, predictor in latestAssessment %}
|
|
35
|
+
{% if key == params.predictor %}
|
|
36
|
+
|
|
37
|
+
{% set badgeClass = '' %}
|
|
38
|
+
{% switch predictor.band %}
|
|
39
|
+
{% case 'VERY HIGH' %}
|
|
40
|
+
{% set badgeClass = 'predictor-badge--very-high' %}
|
|
41
|
+
{% case 'HIGH' %}
|
|
42
|
+
{% set badgeClass = 'predictor-badge--high' %}
|
|
43
|
+
{% case 'MEDIUM' %}
|
|
44
|
+
{% set badgeClass = 'predictor-badge--medium' %}
|
|
45
|
+
{% case 'LOW' %}
|
|
46
|
+
{% set badgeClass = 'predictor-badge--low' %}
|
|
47
|
+
{% endswitch %}
|
|
48
|
+
<div class="{{ badgeClass }}">
|
|
49
|
+
<span class="predictor-badge__type_and_level">{{ predictor.name | upper }} <strong>{{ predictor.band }}</strong></span>
|
|
50
|
+
|
|
51
|
+
{% if showScore and predictor.score is defined %}
|
|
52
|
+
<span class="predictor-badge__score">{{ predictor.score }}%</span>
|
|
53
|
+
{% endif %}
|
|
80
54
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{% endif %}
|
|
84
|
-
</div>
|
|
55
|
+
{% if predictor.staticOrDynamic %}
|
|
56
|
+
<span class="predictor-badge__static_or_dynamic">{{ predictor.staticOrDynamic }}</span>
|
|
85
57
|
{% endif %}
|
|
86
|
-
|
|
87
|
-
{%
|
|
58
|
+
</div>
|
|
59
|
+
{% endif %}
|
|
88
60
|
{% endfor %}
|
|
89
61
|
</div>
|
|
90
62
|
{% endif %}
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,173 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
var hmppsRestClient = require('@ministryofjustice/hmpps-rest-client');
|
|
4
4
|
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ovpPredictorScore: {
|
|
30
|
-
level: ovp.ovpRisk,
|
|
31
|
-
score: ovp.twoYears,
|
|
32
|
-
type: 'OVP',
|
|
33
|
-
staticOrDynamic: null,
|
|
34
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
badgeEntries.push(entry);
|
|
38
|
-
}
|
|
39
|
-
if (ogp) {
|
|
40
|
-
const entry = {
|
|
41
|
-
ogpPredictorScore: {
|
|
42
|
-
level: ogp.ogpRisk,
|
|
43
|
-
score: ogp.ogp2Year,
|
|
44
|
-
type: 'OGP',
|
|
45
|
-
staticOrDynamic: null,
|
|
46
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
badgeEntries.push(entry);
|
|
50
|
-
}
|
|
51
|
-
if (rsr) {
|
|
52
|
-
const entry = {
|
|
53
|
-
rsrPredictorScore: {
|
|
54
|
-
level: rsr.scoreLevel,
|
|
55
|
-
score: rsr.percentageScore,
|
|
56
|
-
type: 'RSR',
|
|
57
|
-
staticOrDynamic: rsr.staticOrDynamic,
|
|
58
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
badgeEntries.push(entry);
|
|
62
|
-
}
|
|
63
|
-
if (osp) {
|
|
64
|
-
const entry = {
|
|
65
|
-
ospdcPredictorScore: {
|
|
66
|
-
level: osp.ospContactScoreLevel,
|
|
67
|
-
score: osp.ospContactPercentageScore,
|
|
68
|
-
type: 'OSP/DC',
|
|
69
|
-
staticOrDynamic: null,
|
|
70
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
badgeEntries.push(entry);
|
|
74
|
-
}
|
|
75
|
-
if (osp) {
|
|
76
|
-
const entry = {
|
|
77
|
-
ospiicPredictorScore: {
|
|
78
|
-
level: osp.ospIndecentScoreLevel,
|
|
79
|
-
score: osp.ospIndecentPercentageScore,
|
|
80
|
-
type: 'OSP/IIC',
|
|
81
|
-
staticOrDynamic: null,
|
|
82
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
badgeEntries.push(entry);
|
|
5
|
+
function transformAllPredictorVersionedDtoToAssessments(dtos) {
|
|
6
|
+
// Sort DTOs by datetime (newest first)
|
|
7
|
+
const sortedDtos = [...dtos].sort((a, b) => {
|
|
8
|
+
return new Date(b.completedDate).getTime() - new Date(a.completedDate).getTime();
|
|
9
|
+
});
|
|
10
|
+
return sortedDtos.map(dto => {
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
12
|
+
let dateFormatDayMonthYearTime;
|
|
13
|
+
let dateFormatDayMonthYear;
|
|
14
|
+
if (dto.completedDate) {
|
|
15
|
+
const date = new Date(dto.completedDate);
|
|
16
|
+
if (!Number.isNaN(date.getTime())) {
|
|
17
|
+
dateFormatDayMonthYear = new Intl.DateTimeFormat('en-GB', {
|
|
18
|
+
day: '2-digit',
|
|
19
|
+
month: 'long',
|
|
20
|
+
year: 'numeric',
|
|
21
|
+
}).format(date);
|
|
22
|
+
const time = date.toLocaleTimeString('en-GB', {
|
|
23
|
+
hour: '2-digit',
|
|
24
|
+
minute: '2-digit',
|
|
25
|
+
hour12: false,
|
|
26
|
+
});
|
|
27
|
+
dateFormatDayMonthYearTime = `${dateFormatDayMonthYear} at ${time}`;
|
|
28
|
+
}
|
|
86
29
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
allReoffendingPredictor: {
|
|
99
|
-
level: arp.band,
|
|
100
|
-
score: arp.score,
|
|
101
|
-
type: 'ARP',
|
|
102
|
-
staticOrDynamic: arp.staticOrDynamic,
|
|
103
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
badgeEntries.push(entry);
|
|
107
|
-
}
|
|
108
|
-
if (vrp) {
|
|
109
|
-
const entry = {
|
|
110
|
-
violentReoffendingPredictor: {
|
|
111
|
-
level: vrp.band,
|
|
112
|
-
score: vrp.score,
|
|
113
|
-
type: 'VRP',
|
|
114
|
-
staticOrDynamic: vrp.staticOrDynamic,
|
|
115
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
116
|
-
},
|
|
30
|
+
const { output } = dto;
|
|
31
|
+
if (dto.outputVersion === '1') {
|
|
32
|
+
return {
|
|
33
|
+
outputVersion: '1',
|
|
34
|
+
completedDateTime: dateFormatDayMonthYearTime,
|
|
35
|
+
ogrs3: mapPredictor('OGRS', (_a = output.groupReconvictionScore) === null || _a === void 0 ? void 0 : _a.scoreLevel, null, (_b = output.groupReconvictionScore) === null || _b === void 0 ? void 0 : _b.twoYears, dateFormatDayMonthYear),
|
|
36
|
+
ovp: mapPredictor('OVP', (_c = output.violencePredictorScore) === null || _c === void 0 ? void 0 : _c.ovpRisk, null, (_d = output.violencePredictorScore) === null || _d === void 0 ? void 0 : _d.twoYears, dateFormatDayMonthYear),
|
|
37
|
+
ogp: mapPredictor('OGP', (_e = output.generalPredictorScore) === null || _e === void 0 ? void 0 : _e.ogpRisk, null, (_f = output.generalPredictorScore) === null || _f === void 0 ? void 0 : _f.ogp2Year, dateFormatDayMonthYear),
|
|
38
|
+
rsr: mapPredictor('RSR', (_g = output.riskOfSeriousRecidivismScore) === null || _g === void 0 ? void 0 : _g.scoreLevel, (_h = output.riskOfSeriousRecidivismScore) === null || _h === void 0 ? void 0 : _h.staticOrDynamic, (_j = output.riskOfSeriousRecidivismScore) === null || _j === void 0 ? void 0 : _j.percentageScore, dateFormatDayMonthYear),
|
|
39
|
+
ospdc: mapPredictor('OSP-DC', (_k = output.sexualPredictorScore) === null || _k === void 0 ? void 0 : _k.ospContactScoreLevel, null, (_l = output.sexualPredictorScore) === null || _l === void 0 ? void 0 : _l.ospContactPercentageScore, dateFormatDayMonthYear),
|
|
40
|
+
ospiic: mapPredictor('OSP-IIC', (_m = output.sexualPredictorScore) === null || _m === void 0 ? void 0 : _m.ospIndecentScoreLevel, null, (_o = output.sexualPredictorScore) === null || _o === void 0 ? void 0 : _o.ospIndecentPercentageScore, dateFormatDayMonthYear),
|
|
117
41
|
};
|
|
118
|
-
badgeEntries.push(entry);
|
|
119
42
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
43
|
+
if (dto.outputVersion === '2') {
|
|
44
|
+
return {
|
|
45
|
+
outputVersion: '2',
|
|
46
|
+
completedDateTime: dateFormatDayMonthYearTime,
|
|
47
|
+
allReoffendingPredictor: mapPredictor('All Reoffending Predictor', (_p = output.allReoffendingPredictor) === null || _p === void 0 ? void 0 : _p.band, (_q = output.allReoffendingPredictor) === null || _q === void 0 ? void 0 : _q.staticOrDynamic, (_r = output.allReoffendingPredictor) === null || _r === void 0 ? void 0 : _r.score, dateFormatDayMonthYear),
|
|
48
|
+
violentReoffendingPredictor: mapPredictor('Violent Reoffending Predictor', (_s = output.violentReoffendingPredictor) === null || _s === void 0 ? void 0 : _s.band, (_t = output.violentReoffendingPredictor) === null || _t === void 0 ? void 0 : _t.staticOrDynamic, (_u = output.violentReoffendingPredictor) === null || _u === void 0 ? void 0 : _u.score, dateFormatDayMonthYear),
|
|
49
|
+
seriousViolentReoffendingPredictor: mapPredictor('Serious Violent Reoffending Predictor', (_v = output.seriousViolentReoffendingPredictor) === null || _v === void 0 ? void 0 : _v.band, (_w = output.seriousViolentReoffendingPredictor) === null || _w === void 0 ? void 0 : _w.staticOrDynamic, (_x = output.seriousViolentReoffendingPredictor) === null || _x === void 0 ? void 0 : _x.score, dateFormatDayMonthYear),
|
|
50
|
+
directContactSexualReoffendingPredictor: mapPredictor('Direct Contact - Sexual Reoffending Predictor', (_y = output.directContactSexualReoffendingPredictor) === null || _y === void 0 ? void 0 : _y.band, null, (_z = output.directContactSexualReoffendingPredictor) === null || _z === void 0 ? void 0 : _z.score, dateFormatDayMonthYear),
|
|
51
|
+
indirectImageContactSexualReoffendingPredictor: mapPredictor('Images and Indirect Contact – Sexual Reoffending Predictor', (_0 = output.indirectImageContactSexualReoffendingPredictor) === null || _0 === void 0 ? void 0 : _0.band, null, (_1 = output.indirectImageContactSexualReoffendingPredictor) === null || _1 === void 0 ? void 0 : _1.score, dateFormatDayMonthYear),
|
|
52
|
+
combinedSeriousReoffendingPredictor: mapPredictor('Combined Serious Reoffending Predictor', (_2 = output.combinedSeriousReoffendingPredictor) === null || _2 === void 0 ? void 0 : _2.band, (_3 = output.combinedSeriousReoffendingPredictor) === null || _3 === void 0 ? void 0 : _3.staticOrDynamic, (_4 = output.combinedSeriousReoffendingPredictor) === null || _4 === void 0 ? void 0 : _4.score, dateFormatDayMonthYear),
|
|
129
53
|
};
|
|
130
|
-
badgeEntries.push(entry);
|
|
131
54
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const entry = {
|
|
146
|
-
indirectImageContactSexualReoffendingPredictor: {
|
|
147
|
-
level: iicsrp.band,
|
|
148
|
-
score: iicsrp.score,
|
|
149
|
-
type: 'IIC/SRP',
|
|
150
|
-
staticOrDynamic: null,
|
|
151
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
badgeEntries.push(entry);
|
|
155
|
-
}
|
|
156
|
-
if (csrp) {
|
|
157
|
-
const entry = {
|
|
158
|
-
combinedSeriousReoffendingPredictor: {
|
|
159
|
-
level: csrp.band,
|
|
160
|
-
score: csrp.score,
|
|
161
|
-
type: 'CSRP',
|
|
162
|
-
staticOrDynamic: csrp.staticOrDynamic,
|
|
163
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
badgeEntries.push(entry);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else
|
|
170
|
-
throw new Error('unexpected version');
|
|
171
|
-
return badgeEntries;
|
|
55
|
+
throw new Error(`Unsupported output version: ${dto.outputVersion}`);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function mapPredictor(name, band, staticOrDynamic, score, date) {
|
|
59
|
+
return {
|
|
60
|
+
name,
|
|
61
|
+
band: band === null || band === void 0 ? void 0 : band.replace(/_/g, ' ').toUpperCase(),
|
|
62
|
+
staticOrDynamic: staticOrDynamic
|
|
63
|
+
? staticOrDynamic.charAt(0).toUpperCase() + staticOrDynamic.slice(1).toLowerCase()
|
|
64
|
+
: null,
|
|
65
|
+
score,
|
|
66
|
+
completedDate: date,
|
|
67
|
+
};
|
|
172
68
|
}
|
|
173
69
|
|
|
174
70
|
class ArnsComponents {
|
|
@@ -178,8 +74,7 @@ class ArnsComponents {
|
|
|
178
74
|
async getRiskData(authOptions, identifierType, identifierValue) {
|
|
179
75
|
const response = await this.restClient.get({ path: `/risks/predictors/all/${identifierType}/${identifierValue}` }, authOptions);
|
|
180
76
|
return {
|
|
181
|
-
|
|
182
|
-
raw: response,
|
|
77
|
+
assessments: transformAllPredictorVersionedDtoToAssessments(response),
|
|
183
78
|
};
|
|
184
79
|
}
|
|
185
80
|
}
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/transformers/AllPredictorVersionedDtoToAssessmentsTransformer.ts","../src/ArnsComponents.ts"],"sourcesContent":[null,null],"names":["RestClient"],"mappings":";;;;AAIM,SAAU,8CAA8C,CAAC,IAAgC,EAAA;;AAE7F,IAAA,MAAM,UAAU,GAA+B,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAC3D,CAAC,CAA2B,EAAE,CAA2B,KA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CAAC;IACpF;AAEA,IAAA,MAAM,WAAW,CACf,WAAiC,EACjC,cAAsB,EACtB,eAAuB,EAAA;QAEvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CACxC,EAAE,IAAI,EAAE,CAAA,sBAAA,EAAyB,cAAc,CAAA,CAAA,EAAI,eAAe,EAAE,EAAE,EACtE,WAAW,CACZ;QAED,OAAO;AACL,YAAA,WAAW,EAAE,8CAA8C,CAAC,QAAQ,CAAC;SACtE;IACH;AACD;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,115 +5,40 @@ import Logger from 'bunyan';
|
|
|
5
5
|
interface ArnsComponentsConfig extends ApiConfig {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
declare enum BandLevel {
|
|
14
|
-
LOW = "LOW",
|
|
15
|
-
MEDIUM = "MEDIUM",
|
|
16
|
-
HIGH = "HIGH",
|
|
17
|
-
VERY_HIGH = "VERY_HIGH",
|
|
18
|
-
NOT_APPLICABLE = "NOT_APPLICABLE"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface BadgeData {
|
|
22
|
-
level: `${BandLevel}`;
|
|
23
|
-
score: number;
|
|
24
|
-
type: string;
|
|
25
|
-
staticOrDynamic: `${StaticOrDynamic}`;
|
|
8
|
+
interface Predictor {
|
|
9
|
+
name: string;
|
|
10
|
+
band: string;
|
|
11
|
+
staticOrDynamic?: string;
|
|
12
|
+
score?: number;
|
|
26
13
|
completedDate: string;
|
|
27
14
|
}
|
|
28
|
-
interface BadgeEntry {
|
|
29
|
-
[key: string]: BadgeData;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare enum AssessmentStatusDto {
|
|
33
|
-
COMPLETE = "COMPLETE",
|
|
34
|
-
LOCKED_INCOMPLETE = "LOCKED_INCOMPLETE"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface BasePredictorDto {
|
|
38
|
-
score: number;
|
|
39
|
-
band: `${BandLevel}`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface StaticOrDynamicPredictorDto extends BasePredictorDto {
|
|
43
|
-
staticOrDynamic: `${StaticOrDynamic}`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface VersionedStaticOrDynamicPredictorDto extends StaticOrDynamicPredictorDto {
|
|
47
|
-
algorithmVersion: string;
|
|
48
|
-
}
|
|
49
15
|
|
|
50
|
-
interface
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
16
|
+
interface AssessmentV1 {
|
|
17
|
+
outputVersion: '1';
|
|
18
|
+
completedDateTime: string;
|
|
19
|
+
ogrs3?: Predictor;
|
|
20
|
+
ovp?: Predictor;
|
|
21
|
+
ogp?: Predictor;
|
|
22
|
+
rsr: Predictor;
|
|
23
|
+
ospdc: Predictor;
|
|
24
|
+
ospiic: Predictor;
|
|
54
25
|
}
|
|
55
26
|
|
|
56
|
-
interface
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
27
|
+
interface AssessmentV2 {
|
|
28
|
+
outputVersion: '2';
|
|
29
|
+
completedDateTime: string;
|
|
30
|
+
allReoffendingPredictor?: Predictor;
|
|
31
|
+
violentReoffendingPredictor?: Predictor;
|
|
32
|
+
seriousViolentReoffendingPredictor?: Predictor;
|
|
33
|
+
directContactSexualReoffendingPredictor?: Predictor;
|
|
34
|
+
indirectImageContactSexualReoffendingPredictor?: Predictor;
|
|
35
|
+
combinedSeriousReoffendingPredictor?: Predictor;
|
|
63
36
|
}
|
|
64
37
|
|
|
65
|
-
|
|
66
|
-
ogpStaticWeightedScore: number;
|
|
67
|
-
ogpDynamicWeightedScore: number;
|
|
68
|
-
ogpTotalWeightedScore: number;
|
|
69
|
-
ogp1Year: number;
|
|
70
|
-
ogp2Year: number;
|
|
71
|
-
ogpRisk: `${BandLevel}`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
declare enum RsrScoreSourceDto {
|
|
75
|
-
OASYS = "OASYS"
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
interface RsrScoreDto {
|
|
79
|
-
percentageScore: number;
|
|
80
|
-
staticOrDynamic: `${StaticOrDynamic}`;
|
|
81
|
-
source: `${RsrScoreSourceDto}`;
|
|
82
|
-
algorithmVersion: string;
|
|
83
|
-
scoreLevel: `${BandLevel}`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface OspScoreDto {
|
|
87
|
-
ospIndecentPercentageScore: number;
|
|
88
|
-
ospContactPercentageScore: number;
|
|
89
|
-
ospIndecentScoreLevel: `${BandLevel}`;
|
|
90
|
-
ospContactScoreLevel: `${BandLevel}`;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
interface AllPredictorDto {
|
|
94
|
-
allReoffendingPredictor?: StaticOrDynamicPredictorDto;
|
|
95
|
-
violentReoffendingPredictor?: StaticOrDynamicPredictorDto;
|
|
96
|
-
seriousViolentReoffendingPredictor?: StaticOrDynamicPredictorDto;
|
|
97
|
-
directContactSexualReoffendingPredictor?: BasePredictorDto;
|
|
98
|
-
indirectImageContactSexualReoffendingPredictor?: BasePredictorDto;
|
|
99
|
-
combinedSeriousReoffendingPredictor?: VersionedStaticOrDynamicPredictorDto;
|
|
100
|
-
groupReconvictionScore?: OgrScoreDto;
|
|
101
|
-
violencePredictorScore?: OvpScoreDto;
|
|
102
|
-
generalPredictorScore?: OgpScoreDto;
|
|
103
|
-
riskOfSeriousRecidivismScore?: RsrScoreDto;
|
|
104
|
-
sexualPredictorScore?: OspScoreDto;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface AllPredictorVersionedDto {
|
|
108
|
-
completedDate: string;
|
|
109
|
-
status: `${AssessmentStatusDto}`;
|
|
110
|
-
outputVersion: string;
|
|
111
|
-
output?: AllPredictorDto;
|
|
112
|
-
}
|
|
38
|
+
type Assessments = AssessmentV1 | AssessmentV2;
|
|
113
39
|
|
|
114
40
|
interface RiskData {
|
|
115
|
-
|
|
116
|
-
raw: AllPredictorVersionedDto[];
|
|
41
|
+
assessments: Assessments[];
|
|
117
42
|
}
|
|
118
43
|
|
|
119
44
|
declare class ArnsComponents {
|
|
@@ -123,4 +48,4 @@ declare class ArnsComponents {
|
|
|
123
48
|
}
|
|
124
49
|
|
|
125
50
|
export { ArnsComponents };
|
|
126
|
-
export type { ArnsComponentsConfig,
|
|
51
|
+
export type { ArnsComponentsConfig, Assessments, RiskData };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,172 +1,68 @@
|
|
|
1
1
|
import { RestClient } from '@ministryofjustice/hmpps-rest-client';
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
ovpPredictorScore: {
|
|
28
|
-
level: ovp.ovpRisk,
|
|
29
|
-
score: ovp.twoYears,
|
|
30
|
-
type: 'OVP',
|
|
31
|
-
staticOrDynamic: null,
|
|
32
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
badgeEntries.push(entry);
|
|
36
|
-
}
|
|
37
|
-
if (ogp) {
|
|
38
|
-
const entry = {
|
|
39
|
-
ogpPredictorScore: {
|
|
40
|
-
level: ogp.ogpRisk,
|
|
41
|
-
score: ogp.ogp2Year,
|
|
42
|
-
type: 'OGP',
|
|
43
|
-
staticOrDynamic: null,
|
|
44
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
badgeEntries.push(entry);
|
|
48
|
-
}
|
|
49
|
-
if (rsr) {
|
|
50
|
-
const entry = {
|
|
51
|
-
rsrPredictorScore: {
|
|
52
|
-
level: rsr.scoreLevel,
|
|
53
|
-
score: rsr.percentageScore,
|
|
54
|
-
type: 'RSR',
|
|
55
|
-
staticOrDynamic: rsr.staticOrDynamic,
|
|
56
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
badgeEntries.push(entry);
|
|
60
|
-
}
|
|
61
|
-
if (osp) {
|
|
62
|
-
const entry = {
|
|
63
|
-
ospdcPredictorScore: {
|
|
64
|
-
level: osp.ospContactScoreLevel,
|
|
65
|
-
score: osp.ospContactPercentageScore,
|
|
66
|
-
type: 'OSP/DC',
|
|
67
|
-
staticOrDynamic: null,
|
|
68
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
badgeEntries.push(entry);
|
|
72
|
-
}
|
|
73
|
-
if (osp) {
|
|
74
|
-
const entry = {
|
|
75
|
-
ospiicPredictorScore: {
|
|
76
|
-
level: osp.ospIndecentScoreLevel,
|
|
77
|
-
score: osp.ospIndecentPercentageScore,
|
|
78
|
-
type: 'OSP/IIC',
|
|
79
|
-
staticOrDynamic: null,
|
|
80
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
badgeEntries.push(entry);
|
|
3
|
+
function transformAllPredictorVersionedDtoToAssessments(dtos) {
|
|
4
|
+
// Sort DTOs by datetime (newest first)
|
|
5
|
+
const sortedDtos = [...dtos].sort((a, b) => {
|
|
6
|
+
return new Date(b.completedDate).getTime() - new Date(a.completedDate).getTime();
|
|
7
|
+
});
|
|
8
|
+
return sortedDtos.map(dto => {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
10
|
+
let dateFormatDayMonthYearTime;
|
|
11
|
+
let dateFormatDayMonthYear;
|
|
12
|
+
if (dto.completedDate) {
|
|
13
|
+
const date = new Date(dto.completedDate);
|
|
14
|
+
if (!Number.isNaN(date.getTime())) {
|
|
15
|
+
dateFormatDayMonthYear = new Intl.DateTimeFormat('en-GB', {
|
|
16
|
+
day: '2-digit',
|
|
17
|
+
month: 'long',
|
|
18
|
+
year: 'numeric',
|
|
19
|
+
}).format(date);
|
|
20
|
+
const time = date.toLocaleTimeString('en-GB', {
|
|
21
|
+
hour: '2-digit',
|
|
22
|
+
minute: '2-digit',
|
|
23
|
+
hour12: false,
|
|
24
|
+
});
|
|
25
|
+
dateFormatDayMonthYearTime = `${dateFormatDayMonthYear} at ${time}`;
|
|
26
|
+
}
|
|
84
27
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
allReoffendingPredictor: {
|
|
97
|
-
level: arp.band,
|
|
98
|
-
score: arp.score,
|
|
99
|
-
type: 'ARP',
|
|
100
|
-
staticOrDynamic: arp.staticOrDynamic,
|
|
101
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
badgeEntries.push(entry);
|
|
105
|
-
}
|
|
106
|
-
if (vrp) {
|
|
107
|
-
const entry = {
|
|
108
|
-
violentReoffendingPredictor: {
|
|
109
|
-
level: vrp.band,
|
|
110
|
-
score: vrp.score,
|
|
111
|
-
type: 'VRP',
|
|
112
|
-
staticOrDynamic: vrp.staticOrDynamic,
|
|
113
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
114
|
-
},
|
|
28
|
+
const { output } = dto;
|
|
29
|
+
if (dto.outputVersion === '1') {
|
|
30
|
+
return {
|
|
31
|
+
outputVersion: '1',
|
|
32
|
+
completedDateTime: dateFormatDayMonthYearTime,
|
|
33
|
+
ogrs3: mapPredictor('OGRS', (_a = output.groupReconvictionScore) === null || _a === void 0 ? void 0 : _a.scoreLevel, null, (_b = output.groupReconvictionScore) === null || _b === void 0 ? void 0 : _b.twoYears, dateFormatDayMonthYear),
|
|
34
|
+
ovp: mapPredictor('OVP', (_c = output.violencePredictorScore) === null || _c === void 0 ? void 0 : _c.ovpRisk, null, (_d = output.violencePredictorScore) === null || _d === void 0 ? void 0 : _d.twoYears, dateFormatDayMonthYear),
|
|
35
|
+
ogp: mapPredictor('OGP', (_e = output.generalPredictorScore) === null || _e === void 0 ? void 0 : _e.ogpRisk, null, (_f = output.generalPredictorScore) === null || _f === void 0 ? void 0 : _f.ogp2Year, dateFormatDayMonthYear),
|
|
36
|
+
rsr: mapPredictor('RSR', (_g = output.riskOfSeriousRecidivismScore) === null || _g === void 0 ? void 0 : _g.scoreLevel, (_h = output.riskOfSeriousRecidivismScore) === null || _h === void 0 ? void 0 : _h.staticOrDynamic, (_j = output.riskOfSeriousRecidivismScore) === null || _j === void 0 ? void 0 : _j.percentageScore, dateFormatDayMonthYear),
|
|
37
|
+
ospdc: mapPredictor('OSP-DC', (_k = output.sexualPredictorScore) === null || _k === void 0 ? void 0 : _k.ospContactScoreLevel, null, (_l = output.sexualPredictorScore) === null || _l === void 0 ? void 0 : _l.ospContactPercentageScore, dateFormatDayMonthYear),
|
|
38
|
+
ospiic: mapPredictor('OSP-IIC', (_m = output.sexualPredictorScore) === null || _m === void 0 ? void 0 : _m.ospIndecentScoreLevel, null, (_o = output.sexualPredictorScore) === null || _o === void 0 ? void 0 : _o.ospIndecentPercentageScore, dateFormatDayMonthYear),
|
|
115
39
|
};
|
|
116
|
-
badgeEntries.push(entry);
|
|
117
40
|
}
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
41
|
+
if (dto.outputVersion === '2') {
|
|
42
|
+
return {
|
|
43
|
+
outputVersion: '2',
|
|
44
|
+
completedDateTime: dateFormatDayMonthYearTime,
|
|
45
|
+
allReoffendingPredictor: mapPredictor('All Reoffending Predictor', (_p = output.allReoffendingPredictor) === null || _p === void 0 ? void 0 : _p.band, (_q = output.allReoffendingPredictor) === null || _q === void 0 ? void 0 : _q.staticOrDynamic, (_r = output.allReoffendingPredictor) === null || _r === void 0 ? void 0 : _r.score, dateFormatDayMonthYear),
|
|
46
|
+
violentReoffendingPredictor: mapPredictor('Violent Reoffending Predictor', (_s = output.violentReoffendingPredictor) === null || _s === void 0 ? void 0 : _s.band, (_t = output.violentReoffendingPredictor) === null || _t === void 0 ? void 0 : _t.staticOrDynamic, (_u = output.violentReoffendingPredictor) === null || _u === void 0 ? void 0 : _u.score, dateFormatDayMonthYear),
|
|
47
|
+
seriousViolentReoffendingPredictor: mapPredictor('Serious Violent Reoffending Predictor', (_v = output.seriousViolentReoffendingPredictor) === null || _v === void 0 ? void 0 : _v.band, (_w = output.seriousViolentReoffendingPredictor) === null || _w === void 0 ? void 0 : _w.staticOrDynamic, (_x = output.seriousViolentReoffendingPredictor) === null || _x === void 0 ? void 0 : _x.score, dateFormatDayMonthYear),
|
|
48
|
+
directContactSexualReoffendingPredictor: mapPredictor('Direct Contact - Sexual Reoffending Predictor', (_y = output.directContactSexualReoffendingPredictor) === null || _y === void 0 ? void 0 : _y.band, null, (_z = output.directContactSexualReoffendingPredictor) === null || _z === void 0 ? void 0 : _z.score, dateFormatDayMonthYear),
|
|
49
|
+
indirectImageContactSexualReoffendingPredictor: mapPredictor('Images and Indirect Contact – Sexual Reoffending Predictor', (_0 = output.indirectImageContactSexualReoffendingPredictor) === null || _0 === void 0 ? void 0 : _0.band, null, (_1 = output.indirectImageContactSexualReoffendingPredictor) === null || _1 === void 0 ? void 0 : _1.score, dateFormatDayMonthYear),
|
|
50
|
+
combinedSeriousReoffendingPredictor: mapPredictor('Combined Serious Reoffending Predictor', (_2 = output.combinedSeriousReoffendingPredictor) === null || _2 === void 0 ? void 0 : _2.band, (_3 = output.combinedSeriousReoffendingPredictor) === null || _3 === void 0 ? void 0 : _3.staticOrDynamic, (_4 = output.combinedSeriousReoffendingPredictor) === null || _4 === void 0 ? void 0 : _4.score, dateFormatDayMonthYear),
|
|
127
51
|
};
|
|
128
|
-
badgeEntries.push(entry);
|
|
129
52
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const entry = {
|
|
144
|
-
indirectImageContactSexualReoffendingPredictor: {
|
|
145
|
-
level: iicsrp.band,
|
|
146
|
-
score: iicsrp.score,
|
|
147
|
-
type: 'IIC/SRP',
|
|
148
|
-
staticOrDynamic: null,
|
|
149
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
badgeEntries.push(entry);
|
|
153
|
-
}
|
|
154
|
-
if (csrp) {
|
|
155
|
-
const entry = {
|
|
156
|
-
combinedSeriousReoffendingPredictor: {
|
|
157
|
-
level: csrp.band,
|
|
158
|
-
score: csrp.score,
|
|
159
|
-
type: 'CSRP',
|
|
160
|
-
staticOrDynamic: csrp.staticOrDynamic,
|
|
161
|
-
completedDate: latestEntry.completedDate.toString(),
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
badgeEntries.push(entry);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else
|
|
168
|
-
throw new Error('unexpected version');
|
|
169
|
-
return badgeEntries;
|
|
53
|
+
throw new Error(`Unsupported output version: ${dto.outputVersion}`);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function mapPredictor(name, band, staticOrDynamic, score, date) {
|
|
57
|
+
return {
|
|
58
|
+
name,
|
|
59
|
+
band: band === null || band === void 0 ? void 0 : band.replace(/_/g, ' ').toUpperCase(),
|
|
60
|
+
staticOrDynamic: staticOrDynamic
|
|
61
|
+
? staticOrDynamic.charAt(0).toUpperCase() + staticOrDynamic.slice(1).toLowerCase()
|
|
62
|
+
: null,
|
|
63
|
+
score,
|
|
64
|
+
completedDate: date,
|
|
65
|
+
};
|
|
170
66
|
}
|
|
171
67
|
|
|
172
68
|
class ArnsComponents {
|
|
@@ -176,8 +72,7 @@ class ArnsComponents {
|
|
|
176
72
|
async getRiskData(authOptions, identifierType, identifierValue) {
|
|
177
73
|
const response = await this.restClient.get({ path: `/risks/predictors/all/${identifierType}/${identifierValue}` }, authOptions);
|
|
178
74
|
return {
|
|
179
|
-
|
|
180
|
-
raw: response,
|
|
75
|
+
assessments: transformAllPredictorVersionedDtoToAssessments(response),
|
|
181
76
|
};
|
|
182
77
|
}
|
|
183
78
|
}
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/transformers/AllPredictorVersionedDtoToAssessmentsTransformer.ts","../src/ArnsComponents.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;AAIM,SAAU,8CAA8C,CAAC,IAAgC,EAAA;;AAE7F,IAAA,MAAM,UAAU,GAA+B,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAC3D,CAAC,CAA2B,EAAE,CAA2B,KAAI;QAC3D,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;AAClF,IAAA,CAAC,CACF;AAED,IAAA,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,IAAG;;AAC1B,QAAA,IAAI,0BAAkC;AACtC,QAAA,IAAI,sBAA8B;AAClC,QAAA,IAAI,GAAG,CAAC,aAAa,EAAE;YACrB,MAAM,IAAI,GA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 -0,0 +1,11 @@
|
|
|
1
|
+
import { Predictor } from './Predictor';
|
|
2
|
+
export interface AssessmentV2 {
|
|
3
|
+
outputVersion: '2';
|
|
4
|
+
completedDateTime: string;
|
|
5
|
+
allReoffendingPredictor?: Predictor;
|
|
6
|
+
violentReoffendingPredictor?: Predictor;
|
|
7
|
+
seriousViolentReoffendingPredictor?: Predictor;
|
|
8
|
+
directContactSexualReoffendingPredictor?: Predictor;
|
|
9
|
+
indirectImageContactSexualReoffendingPredictor?: Predictor;
|
|
10
|
+
combinedSeriousReoffendingPredictor?: Predictor;
|
|
11
|
+
}
|
package/dist/types/RiskData.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AllPredictorVersionedDto } from './dtos/allPredictorVersionedDto';
|
|
1
|
+
import { Assessments } from './Assessments';
|
|
3
2
|
export interface RiskData {
|
|
4
|
-
|
|
5
|
-
raw: AllPredictorVersionedDto[];
|
|
3
|
+
assessments: Assessments[];
|
|
6
4
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BasePredictorDto } from './
|
|
2
|
-
import { StaticOrDynamicPredictorDto } from './
|
|
3
|
-
import { VersionedStaticOrDynamicPredictorDto } from './
|
|
4
|
-
import { OgrScoreDto } from './
|
|
5
|
-
import { OvpScoreDto } from './
|
|
6
|
-
import { OgpScoreDto } from './
|
|
7
|
-
import { RsrScoreDto } from './
|
|
8
|
-
import { OspScoreDto } from './
|
|
1
|
+
import { BasePredictorDto } from './BasePredictorDto';
|
|
2
|
+
import { StaticOrDynamicPredictorDto } from './StaticOrDynamicPredictorDto';
|
|
3
|
+
import { VersionedStaticOrDynamicPredictorDto } from './VersionedStaticOrDynamicPredictorDto';
|
|
4
|
+
import { OgrScoreDto } from './OgrScoreDto';
|
|
5
|
+
import { OvpScoreDto } from './OvpScoreDto';
|
|
6
|
+
import { OgpScoreDto } from './OgpScoreDto';
|
|
7
|
+
import { RsrScoreDto } from './RsrScoreDto';
|
|
8
|
+
import { OspScoreDto } from './OspScoreDto';
|
|
9
9
|
export interface AllPredictorDto {
|
|
10
10
|
allReoffendingPredictor?: StaticOrDynamicPredictorDto;
|
|
11
11
|
violentReoffendingPredictor?: StaticOrDynamicPredictorDto;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssessmentStatusDto } from './
|
|
2
|
-
import { AllPredictorDto } from './
|
|
1
|
+
import { AssessmentStatusDto } from './AssessmentStatusDto';
|
|
2
|
+
import { AllPredictorDto } from './AllPredictorDto';
|
|
3
3
|
export interface AllPredictorVersionedDto {
|
|
4
4
|
completedDate: string;
|
|
5
5
|
status: `${AssessmentStatusDto}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StaticOrDynamic } from '
|
|
2
|
-
import { BandLevel } from '
|
|
3
|
-
import { RsrScoreSourceDto } from './
|
|
1
|
+
import { StaticOrDynamic } from './StaticOrDynamic';
|
|
2
|
+
import { BandLevel } from './BandLevel';
|
|
3
|
+
import { RsrScoreSourceDto } from './RsrScoreSourceDto';
|
|
4
4
|
export interface RsrScoreDto {
|
|
5
5
|
percentageScore: number;
|
|
6
6
|
staticOrDynamic: `${StaticOrDynamic}`;
|
package/dist/types/dtos/{staticOrDynamicPredictorDto.d.ts → StaticOrDynamicPredictorDto.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StaticOrDynamic } from '
|
|
2
|
-
import { BasePredictorDto } from './
|
|
1
|
+
import { StaticOrDynamic } from './StaticOrDynamic';
|
|
2
|
+
import { BasePredictorDto } from './BasePredictorDto';
|
|
3
3
|
export interface StaticOrDynamicPredictorDto extends BasePredictorDto {
|
|
4
4
|
staticOrDynamic: `${StaticOrDynamic}`;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StaticOrDynamicPredictorDto } from './
|
|
1
|
+
import { StaticOrDynamicPredictorDto } from './StaticOrDynamicPredictorDto';
|
|
2
2
|
export interface VersionedStaticOrDynamicPredictorDto extends StaticOrDynamicPredictorDto {
|
|
3
3
|
algorithmVersion: string;
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StaticOrDynamic } from './staticOrDynamic';
|
|
2
|
-
import { BandLevel } from './bandLevel';
|
|
3
|
-
export interface BadgeData {
|
|
4
|
-
level: `${BandLevel}`;
|
|
5
|
-
score: number;
|
|
6
|
-
type: string;
|
|
7
|
-
staticOrDynamic: `${StaticOrDynamic}`;
|
|
8
|
-
completedDate: string;
|
|
9
|
-
}
|
|
10
|
-
export interface BadgeEntry {
|
|
11
|
-
[key: string]: BadgeData;
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|