mahdahar ece101b6d2 Add audit logging plan documentation and update test infrastructure
- Add audit-logging-plan.md with comprehensive logging implementation guide

- Update AGENTS.md with project guidelines

- Refactor test models: remove RefTHoldModel, RefVSetModel, TestDefTechModel

- Update TestDefSiteModel and related migrations

- Update seeder and test data files

- Update API documentation (OpenAPI specs)
2026-02-19 13:20:24 +07:00

451 lines
11 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, VSET]
description: |
NMRIC: Numeric result
VSET: Value set result
RefType:
type: string
enum: [NMRC, TEXT, THOLD, VSET]
description: |
NMRC: Numeric reference range
TEXT: Text reference
THOLD: Threshold reference
VSET: Value set reference
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
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
TestSiteID:
type: integer
HostType:
type: string
description: Host type code
HostID:
type: string
description: Host identifier
HostDataSource:
type: string
description: Host data source
HostTestCode:
type: string
description: Test code in host system
HostTestName:
type: string
description: Test name in host system
ClientType:
type: string
description: Client type code
ClientID:
type: string
description: Client identifier
ClientDataSource:
type: string
description: Client data source
ConDefID:
type: integer
description: Connection 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