Major updates to order system: - Add specimen and test data to order responses (index, show, create, update, status update) - Implement getOrderSpecimens() and getOrderTests() private methods in OrderTestController - Support 'include=details' query parameter for expanded order data - Update OrderTestModel with enhanced query capabilities and transaction handling API documentation: - Update OpenAPI specs for orders, patient-visits, and tests - Add new schemas for order specimens and tests - Regenerate bundled API documentation Database: - Add Requestable field to TestDefSite migration - Create OrderSeeder and ClearOrderDataSeeder for test data - Update DBSeeder to include order seeding Patient visits: - Add filtering by PatientID, PatientName, and date ranges - Include LastLocation in visit queries Testing: - Add OrderCreateTest with comprehensive test coverage Documentation: - Update AGENTS.md with improved controller structure examples
493 lines
12 KiB
YAML
493 lines
12 KiB
YAML
TestDefinition:
|
|
type: object
|
|
properties:
|
|
TestSiteID:
|
|
type: integer
|
|
SiteID:
|
|
type: integer
|
|
TestSiteCode:
|
|
type: string
|
|
TestSiteName:
|
|
type: string
|
|
TestType:
|
|
type: string
|
|
enum: [TEST, PARAM, CALC, GROUP, TITLE]
|
|
description: |
|
|
TEST: Technical test
|
|
PARAM: Parameter
|
|
CALC: Calculated
|
|
GROUP: Panel/Profile
|
|
TITLE: Section header
|
|
Description:
|
|
type: string
|
|
DisciplineID:
|
|
type: integer
|
|
DisciplineName:
|
|
type: string
|
|
DepartmentID:
|
|
type: integer
|
|
DepartmentName:
|
|
type: string
|
|
ResultType:
|
|
type: string
|
|
enum: [NMRIC, RANGE, TEXT, VSET, NORES]
|
|
description: |
|
|
Result type determines the format of test results:
|
|
- NMRIC: Single numeric value
|
|
- RANGE: Numeric range (min-max)
|
|
- TEXT: Free text result
|
|
- VSET: Value set/enum result
|
|
- NORES: No result (for GROUP and TITLE types)
|
|
|
|
TestType to ResultType mapping:
|
|
- TEST: NMRIC | RANGE | TEXT | VSET
|
|
- PARAM: NMRIC | RANGE | TEXT | VSET
|
|
- CALC: NMRIC (calculated result is always numeric)
|
|
- GROUP: NORES (no result, container only)
|
|
- TITLE: NORES (no result, header only)
|
|
RefType:
|
|
type: string
|
|
enum: [RANGE, THOLD, VSET, TEXT, NOREF]
|
|
description: |
|
|
Reference type determines which reference range table to use:
|
|
- RANGE: Numeric reference range
|
|
- THOLD: Threshold/panic range
|
|
- VSET: Value set reference
|
|
- TEXT: Free text reference
|
|
- NOREF: No reference (for NORES result type)
|
|
|
|
ResultType to RefType mapping:
|
|
- NMRIC: RANGE | THOLD → refnum table
|
|
- RANGE: RANGE | THOLD → refnum table
|
|
- VSET: VSET → reftxt table
|
|
- TEXT: TEXT → reftxt table
|
|
- NORES: NOREF → (no reference table)
|
|
VSet:
|
|
type: integer
|
|
description: Value set ID for VSET result type
|
|
ReqQty:
|
|
type: number
|
|
format: decimal
|
|
description: Required sample quantity
|
|
ReqQtyUnit:
|
|
type: string
|
|
description: Unit for required quantity
|
|
Unit1:
|
|
type: string
|
|
description: Primary unit
|
|
Factor:
|
|
type: number
|
|
format: decimal
|
|
description: Conversion factor
|
|
Unit2:
|
|
type: string
|
|
description: Secondary unit (after conversion)
|
|
Decimal:
|
|
type: integer
|
|
description: Number of decimal places
|
|
CollReq:
|
|
type: string
|
|
description: Collection requirements
|
|
Method:
|
|
type: string
|
|
description: Test method
|
|
ExpectedTAT:
|
|
type: integer
|
|
description: Expected turnaround time
|
|
SeqScr:
|
|
type: integer
|
|
description: Screen sequence
|
|
SeqRpt:
|
|
type: integer
|
|
description: Report sequence
|
|
IndentLeft:
|
|
type: integer
|
|
default: 0
|
|
FontStyle:
|
|
type: string
|
|
VisibleScr:
|
|
type: integer
|
|
default: 1
|
|
description: Screen visibility (0=hidden, 1=visible)
|
|
VisibleRpt:
|
|
type: integer
|
|
default: 1
|
|
description: Report visibility (0=hidden, 1=visible)
|
|
CountStat:
|
|
type: integer
|
|
default: 1
|
|
Level:
|
|
type: integer
|
|
Requestable:
|
|
type: integer
|
|
default: 1
|
|
description: Flag indicating if test can be requested (1=yes, 0=no)
|
|
CreateDate:
|
|
type: string
|
|
format: date-time
|
|
StartDate:
|
|
type: string
|
|
format: date-time
|
|
EndDate:
|
|
type: string
|
|
format: date-time
|
|
FormulaInput:
|
|
type: string
|
|
description: Input variables for calculated tests
|
|
FormulaCode:
|
|
type: string
|
|
description: Formula expression for calculated tests
|
|
testdefcal:
|
|
type: array
|
|
description: Calculated test details (only for CALC type)
|
|
items:
|
|
type: object
|
|
testdefgrp:
|
|
type: array
|
|
description: Group members (only for GROUP type)
|
|
items:
|
|
type: object
|
|
testmap:
|
|
type: array
|
|
description: Test mappings
|
|
items:
|
|
$ref: '#/TestMap'
|
|
refnum:
|
|
type: array
|
|
description: Numeric reference ranges (optional). Mutually exclusive with reftxt - a test can only have ONE reference type.
|
|
items:
|
|
type: object
|
|
properties:
|
|
RefNumID:
|
|
type: integer
|
|
NumRefType:
|
|
type: string
|
|
enum: [NMRC, THOLD]
|
|
description: NMRC=Numeric range, THOLD=Threshold
|
|
NumRefTypeLabel:
|
|
type: string
|
|
RangeType:
|
|
type: string
|
|
RangeTypeLabel:
|
|
type: string
|
|
Sex:
|
|
type: string
|
|
SexLabel:
|
|
type: string
|
|
LowSign:
|
|
type: string
|
|
LowSignLabel:
|
|
type: string
|
|
HighSign:
|
|
type: string
|
|
HighSignLabel:
|
|
type: string
|
|
High:
|
|
type: number
|
|
format: float
|
|
Low:
|
|
type: number
|
|
format: float
|
|
AgeStart:
|
|
type: integer
|
|
AgeEnd:
|
|
type: integer
|
|
Flag:
|
|
type: string
|
|
Interpretation:
|
|
type: string
|
|
reftxt:
|
|
type: array
|
|
description: Text reference ranges (optional). Mutually exclusive with refnum - a test can only have ONE reference type.
|
|
items:
|
|
type: object
|
|
properties:
|
|
RefTxtID:
|
|
type: integer
|
|
TxtRefType:
|
|
type: string
|
|
enum: [TEXT, VSET]
|
|
description: TEXT=Free text, VSET=Value set
|
|
TxtRefTypeLabel:
|
|
type: string
|
|
Sex:
|
|
type: string
|
|
SexLabel:
|
|
type: string
|
|
AgeStart:
|
|
type: integer
|
|
AgeEnd:
|
|
type: integer
|
|
RefTxt:
|
|
type: string
|
|
Flag:
|
|
type: string
|
|
examples:
|
|
TEST_numeric:
|
|
summary: Technical test with numeric reference
|
|
value:
|
|
TestSiteID: 1
|
|
SiteID: 1
|
|
TestSiteCode: GLU
|
|
TestSiteName: Glucose
|
|
TestType: TEST
|
|
DisciplineID: 2
|
|
DepartmentID: 2
|
|
ResultType: NMRIC
|
|
RefType: NMRC
|
|
Unit1: mg/dL
|
|
ReqQty: 300
|
|
ReqQtyUnit: uL
|
|
Decimal: 0
|
|
Method: Hexokinase
|
|
SeqScr: 11
|
|
SeqRpt: 11
|
|
VisibleScr: 1
|
|
VisibleRpt: 1
|
|
CountStat: 1
|
|
refnum:
|
|
- RefNumID: 1
|
|
NumRefType: NMRC
|
|
NumRefTypeLabel: Numeric
|
|
RangeType: REF
|
|
RangeTypeLabel: Reference Range
|
|
Sex: '2'
|
|
SexLabel: Male
|
|
LowSign: GE
|
|
LowSignLabel: ">="
|
|
HighSign: LE
|
|
HighSignLabel: "<="
|
|
Low: 70
|
|
High: 100
|
|
AgeStart: 18
|
|
AgeEnd: 99
|
|
Flag: N
|
|
Interpretation: Normal
|
|
TEST_threshold:
|
|
summary: Technical test with threshold reference (panic)
|
|
value:
|
|
TestSiteID: 2
|
|
SiteID: 1
|
|
TestSiteCode: GLU
|
|
TestSiteName: Glucose
|
|
TestType: TEST
|
|
DisciplineID: 2
|
|
DepartmentID: 2
|
|
ResultType: NMRIC
|
|
RefType: THOLD
|
|
Unit1: mg/dL
|
|
Decimal: 0
|
|
Method: Hexokinase
|
|
SeqScr: 11
|
|
SeqRpt: 11
|
|
VisibleScr: 1
|
|
VisibleRpt: 1
|
|
CountStat: 1
|
|
refnum:
|
|
- RefNumID: 2
|
|
NumRefType: THOLD
|
|
NumRefTypeLabel: Threshold
|
|
RangeType: PANIC
|
|
RangeTypeLabel: Panic Range
|
|
Sex: '1'
|
|
SexLabel: Female
|
|
LowSign: LT
|
|
LowSignLabel: "<"
|
|
High: 40
|
|
AgeStart: 0
|
|
AgeEnd: 120
|
|
Flag: L
|
|
Interpretation: Critical Low
|
|
TEST_text:
|
|
summary: Technical test with text reference
|
|
value:
|
|
TestSiteID: 3
|
|
SiteID: 1
|
|
TestSiteCode: STAGE
|
|
TestSiteName: Disease Stage
|
|
TestType: TEST
|
|
DisciplineID: 1
|
|
DepartmentID: 1
|
|
ResultType: VSET
|
|
RefType: TEXT
|
|
SeqScr: 50
|
|
SeqRpt: 50
|
|
VisibleScr: 1
|
|
VisibleRpt: 1
|
|
CountStat: 1
|
|
reftxt:
|
|
- RefTxtID: 1
|
|
TxtRefType: TEXT
|
|
TxtRefTypeLabel: Text
|
|
Sex: '2'
|
|
SexLabel: Male
|
|
AgeStart: 18
|
|
AgeEnd: 99
|
|
RefTxt: 'NORM=Normal;HYPO=Hypochromic;MACRO=Macrocytic'
|
|
Flag: N
|
|
PARAM:
|
|
summary: Parameter test
|
|
value:
|
|
TestSiteID: 4
|
|
SiteID: 1
|
|
TestSiteCode: HEIGHT
|
|
TestSiteName: Height
|
|
TestType: PARAM
|
|
DisciplineID: 10
|
|
ResultType: NMRIC
|
|
Unit1: cm
|
|
Decimal: 0
|
|
SeqScr: 40
|
|
SeqRpt: 40
|
|
VisibleScr: 1
|
|
VisibleRpt: 0
|
|
CountStat: 0
|
|
CALC:
|
|
summary: Calculated test with reference
|
|
value:
|
|
TestSiteID: 5
|
|
SiteID: 1
|
|
TestSiteCode: EGFR
|
|
TestSiteName: eGFR
|
|
TestType: CALC
|
|
DisciplineID: 2
|
|
DepartmentID: 2
|
|
Unit1: mL/min/1.73m2
|
|
Decimal: 0
|
|
SeqScr: 20
|
|
SeqRpt: 20
|
|
VisibleScr: 1
|
|
VisibleRpt: 1
|
|
CountStat: 0
|
|
testdefcal:
|
|
- TestCalID: 1
|
|
DisciplineID: 2
|
|
DepartmentID: 2
|
|
FormulaInput: CREA,AGE,GENDER
|
|
FormulaCode: CKD_EPI(CREA,AGE,GENDER)
|
|
Unit1: mL/min/1.73m2
|
|
Decimal: 0
|
|
refnum:
|
|
- RefNumID: 5
|
|
NumRefType: NMRC
|
|
NumRefTypeLabel: Numeric
|
|
RangeType: REF
|
|
RangeTypeLabel: Reference Range
|
|
Sex: '1'
|
|
SexLabel: Female
|
|
LowSign: GE
|
|
LowSignLabel: ">="
|
|
HighSign: LE
|
|
HighSignLabel: "<="
|
|
Low: 10
|
|
High: 20
|
|
AgeStart: 18
|
|
AgeEnd: 120
|
|
Flag: N
|
|
Interpretation: Normal
|
|
GROUP:
|
|
summary: Panel/Profile test
|
|
value:
|
|
TestSiteID: 6
|
|
SiteID: 1
|
|
TestSiteCode: LIPID
|
|
TestSiteName: Lipid Panel
|
|
TestType: GROUP
|
|
DisciplineID: 2
|
|
DepartmentID: 2
|
|
SeqScr: 51
|
|
SeqRpt: 51
|
|
VisibleScr: 1
|
|
VisibleRpt: 1
|
|
CountStat: 1
|
|
testdefgrp:
|
|
- TestGrpID: 1
|
|
Member: 100
|
|
TestSiteCode: CHOL
|
|
TestSiteName: Total Cholesterol
|
|
- TestGrpID: 2
|
|
Member: 101
|
|
TestSiteCode: TG
|
|
TestSiteName: Triglycerides
|
|
TITLE:
|
|
summary: Section header
|
|
value:
|
|
TestSiteID: 7
|
|
SiteID: 1
|
|
TestSiteCode: CHEM_HEADER
|
|
TestSiteName: '--- CHEMISTRY ---'
|
|
TestType: TITLE
|
|
DisciplineID: 2
|
|
DepartmentID: 2
|
|
SeqScr: 100
|
|
SeqRpt: 100
|
|
VisibleScr: 1
|
|
VisibleRpt: 1
|
|
CountStat: 0
|
|
|
|
TestMap:
|
|
type: object
|
|
properties:
|
|
TestMapID:
|
|
type: integer
|
|
HostType:
|
|
type: string
|
|
description: Host type code (e.g., SITE, WORKSTATION, INSTRUMENT)
|
|
HostID:
|
|
type: string
|
|
description: Host identifier
|
|
ClientType:
|
|
type: string
|
|
description: Client type code (e.g., SITE, WORKSTATION, INSTRUMENT)
|
|
ClientID:
|
|
type: string
|
|
description: Client identifier
|
|
HostName:
|
|
type: string
|
|
description: Resolved host name (from view)
|
|
ClientName:
|
|
type: string
|
|
description: Resolved client name (from view)
|
|
details:
|
|
type: array
|
|
description: Test mapping detail records
|
|
items:
|
|
$ref: '#/TestMapDetail'
|
|
CreateDate:
|
|
type: string
|
|
format: date-time
|
|
EndDate:
|
|
type: string
|
|
format: date-time
|
|
description: Soft delete timestamp
|
|
|
|
TestMapDetail:
|
|
type: object
|
|
properties:
|
|
TestMapDetailID:
|
|
type: integer
|
|
TestMapID:
|
|
type: integer
|
|
HostTestCode:
|
|
type: string
|
|
description: Test code in host system
|
|
HostTestName:
|
|
type: string
|
|
description: Test name in host system
|
|
ConDefID:
|
|
type: integer
|
|
description: Container definition ID
|
|
ClientTestCode:
|
|
type: string
|
|
description: Test code in client system
|
|
ClientTestName:
|
|
type: string
|
|
description: Test name in client system
|
|
CreateDate:
|
|
type: string
|
|
format: date-time
|
|
EndDate:
|
|
type: string
|
|
format: date-time
|
|
description: Soft delete timestamp
|