Skip to content

Commit c79fc2d

Browse files
added schema documentation (#566)
* added schema documentation * added schema documentation
1 parent d4f2d64 commit c79fc2d

File tree

2 files changed

+135
-2
lines changed

2 files changed

+135
-2
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/hmpps/InductionSchedule.kt

+45-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import java.time.LocalDate
1414
@JsonIgnoreProperties(ignoreUnknown = true)
1515
@JsonInclude(JsonInclude.Include.USE_DEFAULTS)
1616
data class InductionSchedules(
17+
@Schema(
18+
description = """
19+
A list of induction schedule versions for this prisoner. The prisoner will only have one induction schedule but for various reasons the schedule can be updated.
20+
This list will show each change the schedule has been through. This allows for reports to be generated.
21+
""",
22+
)
1723
val inductionSchedules: List<InductionSchedule>,
1824
)
1925

@@ -27,12 +33,42 @@ data class InductionSchedule(
2733
)
2834
val deadlineDate: LocalDate? = null,
2935
@Schema(
30-
description = "The current status of the Induction Schedule",
36+
description = """
37+
The current status of the Induction Schedule.
38+
list of values:
39+
SCHEDULED
40+
COMPLETED
41+
EXEMPT_PRISONER_DRUG_OR_ALCOHOL_DEPENDENCY
42+
EXEMPT_PRISONER_OTHER_HEALTH_ISSUES
43+
EXEMPT_PRISONER_FAILED_TO_ENGAGE
44+
EXEMPT_PRISONER_ESCAPED_OR_ABSCONDED
45+
EXEMPT_PRISONER_SAFETY_ISSUES
46+
EXEMPT_PRISON_REGIME_CIRCUMSTANCES
47+
EXEMPT_PRISON_STAFF_REDEPLOYMENT
48+
EXEMPT_PRISON_OPERATION_OR_SECURITY_ISSUE
49+
EXEMPT_SECURITY_ISSUE_RISK_TO_STAFF
50+
EXEMPT_SYSTEM_TECHNICAL_ISSUE
51+
EXEMPT_PRISONER_TRANSFER
52+
EXEMPT_PRISONER_RELEASE
53+
EXEMPT_PRISONER_DEATH
54+
EXEMPT_SCREENING_AND_ASSESSMENT_IN_PROGRESS
55+
EXEMPT_SCREENING_AND_ASSESSMENT_INCOMPLETE
56+
""",
3157
example = "SCHEDULED",
3258
)
3359
val status: String? = null,
3460
@Schema(
35-
description = "The Induction Schedule rule used to determine deadline date.",
61+
description = """
62+
The Induction Schedule rule used to determine deadline date.
63+
list of values are:
64+
NEW_PRISON_ADMISSION
65+
EXISTING_PRISONER_LESS_THAN_6_MONTHS_TO_SERVE
66+
EXISTING_PRISONER_BETWEEN_6_AND_12_MONTHS_TO_SERVE
67+
EXISTING_PRISONER_BETWEEN_12_AND_60_MONTHS_TO_SERVE
68+
EXISTING_PRISONER_INDETERMINATE_SENTENCE
69+
EXISTING_PRISONER_ON_REMAND
70+
EXISTING_PRISONER_UN_SENTENCED
71+
""",
3672
example = "NEW_PRISON_ADMISSION",
3773
)
3874
val calculationRule: String? = null,
@@ -62,6 +98,13 @@ data class InductionSchedule(
6298
)
6399
val inductionPerformedAt: LocalDate? = null,
64100
val exemptionReason: String? = null,
101+
@Schema(
102+
description = """
103+
The induction schedule can change status numerous times.
104+
When looking at the plp-induction-schedule/history of the inductions.
105+
The version number indicates which version of the induction schedule this one is, the higher the number the newer the update.
106+
""",
107+
)
65108
val version: Int? = null,
66109
)
67110

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/hmpps/ReviewSchedule.kt

+90
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,78 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps
22

33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
44
import com.fasterxml.jackson.annotation.JsonInclude
5+
import io.swagger.v3.oas.annotations.media.Schema
56
import java.time.Instant
67
import java.time.LocalDate
78
import java.util.UUID
89

910
@JsonIgnoreProperties(ignoreUnknown = true)
1011
@JsonInclude(JsonInclude.Include.USE_DEFAULTS)
1112
data class ReviewSchedules(
13+
@Schema(
14+
description = """
15+
A list of review schedules for this prisoner.
16+
Note that this will return multiple versions of the the same schedule.
17+
This is because down stream clients need to know the previous states of the review schedules.
18+
grouping by reference and then ordering by highest version number will present the review schedules with the most up to date data.
19+
""",
20+
)
1221
val reviewSchedules: List<ReviewSchedule>,
1322
)
1423

1524
@JsonIgnoreProperties(ignoreUnknown = true)
1625
@JsonInclude(JsonInclude.Include.USE_DEFAULTS)
1726
data class ReviewSchedule(
27+
@Schema(
28+
description = "The UUID reference for the review schedule record.",
29+
)
1830
val reference: UUID,
31+
@Schema(
32+
description = "The earliest date that the review should be carried out.",
33+
)
1934
val reviewDateFrom: LocalDate,
35+
@Schema(
36+
description = "The latest date that the review should be carried out.",
37+
)
2038
val reviewDateTo: LocalDate,
39+
@Schema(
40+
description = """
41+
The status of this review schedule possible values are:
42+
SCHEDULED
43+
EXEMPT_PRISONER_DRUG_OR_ALCOHOL_DEPENDENCY
44+
EXEMPT_PRISONER_OTHER_HEALTH_ISSUES
45+
EXEMPT_PRISONER_FAILED_TO_ENGAGE
46+
EXEMPT_PRISONER_ESCAPED_OR_ABSCONDED
47+
EXEMPT_PRISONER_SAFETY_ISSUES
48+
EXEMPT_PRISON_REGIME_CIRCUMSTANCES
49+
EXEMPT_PRISON_STAFF_REDEPLOYMENT
50+
EXEMPT_PRISON_OPERATION_OR_SECURITY_ISSUE
51+
EXEMPT_SECURITY_ISSUE_RISK_TO_STAFF
52+
EXEMPT_SYSTEM_TECHNICAL_ISSUE
53+
EXEMPT_PRISONER_TRANSFER
54+
EXEMPT_PRISONER_RELEASE
55+
EXEMPT_PRISONER_DEATH
56+
COMPLETED
57+
""",
58+
)
2159
val status: String,
60+
@Schema(
61+
description = """
62+
The calculation rule that was used to workout the review schedule window.
63+
Possible values are:
64+
PRISONER_READMISSION
65+
PRISONER_TRANSFER
66+
BETWEEN_RELEASE_AND_3_MONTHS_TO_SERVE
67+
BETWEEN_3_MONTHS_AND_3_MONTHS_7_DAYS_TO_SERVE
68+
BETWEEN_3_MONTHS_8_DAYS_AND_6_MONTHS_TO_SERVE
69+
BETWEEN_6_AND_12_MONTHS_TO_SERVE
70+
BETWEEN_12_AND_60_MONTHS_TO_SERVE
71+
MORE_THAN_60_MONTHS_TO_SERVE
72+
INDETERMINATE_SENTENCE
73+
PRISONER_ON_REMAND
74+
PRISONER_UN_SENTENCED
75+
""",
76+
)
2277
val calculationRule: String,
2378
val createdBy: String,
2479
val createdByDisplayName: String,
@@ -28,11 +83,46 @@ data class ReviewSchedule(
2883
val updatedByDisplayName: String,
2984
val updatedAt: Instant,
3085
val updatedAtPrison: String,
86+
@Schema(
87+
description = """
88+
The review schedule can change status numerous times.
89+
The version number indicates which version of the review schedule this one is, the higher the number the newer the update.
90+
use the version number in conjunction with the reference UUID.
91+
ie if you group the schedules by reference then the version numbers represent different versions of the same schedule.
92+
The final status of each grouping is COMPLETED.
93+
""",
94+
)
3195
val version: Int,
96+
@Schema(
97+
description = "When the review schedule has a completed review this will be populated by the name of the person who did the review.",
98+
)
3299
var reviewCompletedBy: String?,
100+
@Schema(
101+
description = "When the review schedule has a completed review this will be populated by the role of the person who did the review.",
102+
)
33103
var reviewCompletedByRole: String?,
104+
@Schema(
105+
description = "When the review schedule has a completed review this will be populated with the date of the review.",
106+
)
34107
var reviewCompletedAt: Instant?,
108+
@Schema(
109+
description = """
110+
When the review schedule has a completed review this will be populated with the type of the review.
111+
values are:
112+
REGULAR,
113+
PRE_RELEASE
114+
""",
115+
)
35116
val reviewType: String?,
117+
@Schema(
118+
description = """
119+
When the review schedule has a completed review this will be populated with the reason for the review.
120+
values are:
121+
REOFFENCE,
122+
TRANSFER,
123+
REGULAR
124+
""",
125+
)
36126
val reviewReason: String?,
37127
)
38128

0 commit comments

Comments
 (0)