clqms-be/public/paths/calc.yaml
root 30c4e47304 chore(repo): normalize EOL and harden contact patch flow
- handle contact PATCH failures by checking model save result and returning HTTP 400 with the model error message
- update ContactDetailModel nested updates to enforce active-detail checks and use model update() with explicit failure propagation
- extend contact patch assertions and align test-create variants expectations to status=success for POST responses
- refresh composer lock metadata/dependency constraints and include generated docs/data/test files updated during normalization
- impact: API contract unchanged except clearer 400 error responses on invalid contact detail updates
2026-04-17 05:38:11 +07:00

113 lines
3.5 KiB
YAML
Executable File

/api/calc/testcode/{codeOrName}:
post:
tags: [Calculation]
summary: Evaluate a configured calculation by test code or name and return the raw result map.
security: []
parameters:
- name: codeOrName
in: path
required: true
schema:
type: string
description: TestSiteCode or TestSiteName of the calculated test (case-insensitive).
requestBody:
required: true
content:
application/json:
schema:
type: object
description: Key-value pairs where keys match member tests used in the formula.
additionalProperties:
type: number
example:
TBIL: 5
DBIL: 3
responses:
'200':
description: Returns a single key/value pair with the canonical TestSiteCode or an empty object when the calculation is incomplete or missing.
content:
application/json:
schema:
type: object
examples:
success:
value:
IBIL: 2.0
incomplete:
value: {}
/api/calc/testsite/{testSiteID}:
post:
tags: [Calculation]
summary: Evaluate a calculation defined for a test site and return a structured result.
security: []
parameters:
- name: testSiteID
in: path
required: true
schema:
type: integer
description: Identifier for the test site whose definition should be evaluated.
requestBody:
required: true
content:
application/json:
schema:
type: object
description: Variable assignments required by the test site formula.
additionalProperties:
type: number
example:
result: 85
gender: "female"
age: 30
responses:
'200':
description: Returns the calculated result, testSiteID, formula code, and echoed variables.
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
result:
type: number
testSiteID:
type: integer
formula:
type: string
variables:
type: object
additionalProperties:
type: number
examples:
success:
value:
status: success
data:
result: 92.4
testSiteID: 123
formula: "{result} * {factor} + {age}"
variables:
result: 85
gender: female
age: 30
'404':
description: No calculation defined for the requested test site.
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: failed
message:
type: string
example: No calculation defined for this test site