@api-client/core 0.18.21 → 0.18.22
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/build/src/modeling/helpers/Intelisense.d.ts +1 -0
- package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
- package/build/src/modeling/helpers/Intelisense.js +1 -0
- package/build/src/modeling/helpers/Intelisense.js.map +1 -1
- package/build/src/modeling/templates/index.d.ts +1 -0
- package/build/src/modeling/templates/index.d.ts.map +1 -1
- package/build/src/modeling/templates/index.js +2 -0
- package/build/src/modeling/templates/index.js.map +1 -1
- package/build/src/modeling/templates/meta/education-management-platform.json +1 -0
- package/build/src/modeling/templates/meta/financial-services-platform.json +1 -0
- package/build/src/modeling/templates/meta/gaming-platform.json +1 -0
- package/build/src/modeling/templates/meta/healthcare-management-platform.json +1 -0
- package/build/src/modeling/templates/meta/hospitality-platform.json +1 -0
- package/build/src/modeling/templates/meta/index.d.ts +2 -2
- package/build/src/modeling/templates/meta/index.d.ts.map +1 -1
- package/build/src/modeling/templates/meta/index.js +31 -1
- package/build/src/modeling/templates/meta/index.js.map +1 -1
- package/build/src/modeling/templates/meta/iot-smart-home-platform.json +1 -0
- package/build/src/modeling/templates/meta/legal-services-platform.json +1 -0
- package/build/src/modeling/templates/meta/manufacturing-platform.json +1 -0
- package/build/src/modeling/templates/meta/non-profit-platform.json +1 -0
- package/build/src/modeling/templates/meta/real-estate-management-platform.json +1 -0
- package/build/src/modeling/templates/template-registry.d.ts +14 -0
- package/build/src/modeling/templates/template-registry.d.ts.map +1 -1
- package/build/src/modeling/templates/template-registry.js +63 -0
- package/build/src/modeling/templates/template-registry.js.map +1 -1
- package/build/src/modeling/templates/{ecommerce-domain.d.ts → verticals/business-services/ecommerce-domain.d.ts} +2 -2
- package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/{ecommerce-domain.js → verticals/business-services/ecommerce-domain.js} +6 -6
- package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js +744 -0
- package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts +45 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js +797 -0
- package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/index.d.ts +21 -0
- package/build/src/modeling/templates/verticals/business-services/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/index.js +50 -0
- package/build/src/modeling/templates/verticals/business-services/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts +46 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js +837 -0
- package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.js +725 -0
- package/build/src/modeling/templates/verticals/education-training/education-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/education-training/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/education-training/index.js +21 -0
- package/build/src/modeling/templates/verticals/education-training/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js +859 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js +21 -0
- package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/index.d.ts +79 -0
- package/build/src/modeling/templates/verticals/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/index.js +186 -0
- package/build/src/modeling/templates/verticals/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js +22 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts +45 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js +710 -0
- package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/public-sector/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/index.js +22 -0
- package/build/src/modeling/templates/verticals/public-sector/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts +47 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js +864 -0
- package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts +18 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.js +21 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts +40 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js +727 -0
- package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js.map +1 -0
- package/build/src/modeling/templates/{blog-domain.d.ts → verticals/technology-media/blog-domain.d.ts} +2 -2
- package/build/src/modeling/templates/verticals/technology-media/blog-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/{blog-domain.js → verticals/technology-media/blog-domain.js} +5 -5
- package/build/src/modeling/templates/verticals/technology-media/blog-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts +46 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js +1033 -0
- package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/index.d.ts +21 -0
- package/build/src/modeling/templates/verticals/technology-media/index.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/index.js +42 -0
- package/build/src/modeling/templates/verticals/technology-media/index.js.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts +47 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts.map +1 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js +1027 -0
- package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/modeling/helpers/Intelisense.ts +1 -0
- package/src/modeling/templates/meta/education-management-platform.json +1 -0
- package/src/modeling/templates/meta/financial-services-platform.json +1 -0
- package/src/modeling/templates/meta/gaming-platform.json +1 -0
- package/src/modeling/templates/meta/healthcare-management-platform.json +1 -0
- package/src/modeling/templates/meta/hospitality-platform.json +1 -0
- package/src/modeling/templates/meta/iot-smart-home-platform.json +1 -0
- package/src/modeling/templates/meta/legal-services-platform.json +1 -0
- package/src/modeling/templates/meta/manufacturing-platform.json +1 -0
- package/src/modeling/templates/meta/non-profit-platform.json +1 -0
- package/src/modeling/templates/meta/real-estate-management-platform.json +1 -0
- package/src/modeling/templates/readme.md +14 -0
- package/src/modeling/templates/template-registry.ts +73 -0
- package/src/modeling/templates/verticals/README.md +122 -0
- package/src/modeling/templates/{ecommerce-domain.ts → verticals/business-services/ecommerce-domain.ts} +7 -7
- package/src/modeling/templates/verticals/business-services/financial-services-domain.ts +943 -0
- package/src/modeling/templates/verticals/business-services/hospitality-domain.ts +994 -0
- package/src/modeling/templates/verticals/business-services/legal-services-domain.ts +1059 -0
- package/src/modeling/templates/verticals/education-training/education-domain.ts +922 -0
- package/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.ts +1111 -0
- package/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.ts +895 -0
- package/src/modeling/templates/verticals/public-sector/non-profit-domain.ts +1109 -0
- package/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.ts +944 -0
- package/src/modeling/templates/{blog-domain.ts → verticals/technology-media/blog-domain.ts} +6 -6
- package/src/modeling/templates/verticals/technology-media/gaming-domain.ts +1290 -0
- package/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.ts +1287 -0
- package/build/src/modeling/templates/blog-domain.d.ts.map +0 -1
- package/build/src/modeling/templates/blog-domain.js.map +0 -1
- package/build/src/modeling/templates/ecommerce-domain.d.ts.map +0 -1
- package/build/src/modeling/templates/ecommerce-domain.js.map +0 -1
|
@@ -0,0 +1,1111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Healthcare Data Domain Example
|
|
3
|
+
*
|
|
4
|
+
* This file demonstrates how to create a comprehensive healthcare data domain
|
|
5
|
+
* using the API Client Core modeling system. It follows the business-first approach
|
|
6
|
+
* and demonstrates proper use of namespaces, models, entities, properties,
|
|
7
|
+
* associations, and semantic annotations.
|
|
8
|
+
*
|
|
9
|
+
* The example includes:
|
|
10
|
+
* - Patient Management with demographics, medical history, and contact information
|
|
11
|
+
* - Provider Management with doctors, nurses, specialists, and facilities
|
|
12
|
+
* - Appointment Scheduling with availability, booking, and scheduling rules
|
|
13
|
+
* - Medical Records with diagnoses, treatments, prescriptions, and lab results
|
|
14
|
+
* - Insurance & Billing with claims, coverage, and payment processing
|
|
15
|
+
* - Compliance features for HIPAA, audit trails, and data privacy
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { createHealthcareDomain } from './healthcare-domain.js'
|
|
20
|
+
*
|
|
21
|
+
* const domain = createHealthcareDomain()
|
|
22
|
+
* console.log('Healthcare domain created with', domain.graph.nodeCount(), 'nodes')
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { DataDomain } from '../../../DataDomain.js'
|
|
27
|
+
import { createSummarySemantic } from '../../../definitions/Summary.js'
|
|
28
|
+
import {
|
|
29
|
+
addIdField,
|
|
30
|
+
addNameField,
|
|
31
|
+
addDescriptionField,
|
|
32
|
+
addEmailField,
|
|
33
|
+
addFirstNameField,
|
|
34
|
+
addLastNameField,
|
|
35
|
+
addPhoneField,
|
|
36
|
+
addCustomStatusField,
|
|
37
|
+
addCreatedAtField,
|
|
38
|
+
addUpdatedAtField,
|
|
39
|
+
addBooleanField,
|
|
40
|
+
addCurrencyAmountField,
|
|
41
|
+
} from '../../../helpers/Intelisense.js'
|
|
42
|
+
import type { CreateTemplateOptions } from '../../types.js'
|
|
43
|
+
|
|
44
|
+
function createDomain(): DataDomain {
|
|
45
|
+
return new DataDomain({
|
|
46
|
+
info: {
|
|
47
|
+
name: 'Healthcare Management Platform',
|
|
48
|
+
displayName: 'Healthcare Management Platform',
|
|
49
|
+
description:
|
|
50
|
+
'A comprehensive healthcare management platform with patient care, provider management, ' +
|
|
51
|
+
'appointment scheduling, and medical records',
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Creates a comprehensive healthcare data domain following domain-driven design principles.
|
|
58
|
+
*
|
|
59
|
+
* This function demonstrates the proper hierarchy and organization for a healthcare platform:
|
|
60
|
+
* 1. Creates the root DataDomain for the healthcare platform
|
|
61
|
+
* 2. Organizes functionality into logical namespaces (Patient Care, Provider Management, etc.)
|
|
62
|
+
* 3. Groups related entities into models within each namespace
|
|
63
|
+
* 4. Defines entities with proper semantic annotations for healthcare workflows
|
|
64
|
+
* 5. Establishes associations with appropriate cardinality for patient-provider relationships
|
|
65
|
+
*
|
|
66
|
+
* @returns A fully configured DataDomain with all healthcare entities and relationships
|
|
67
|
+
*/
|
|
68
|
+
export default function createHealthcareDomain(options: CreateTemplateOptions = {}): DataDomain {
|
|
69
|
+
// Ensure the root data domain
|
|
70
|
+
const domain = options.domain ?? createDomain()
|
|
71
|
+
|
|
72
|
+
//
|
|
73
|
+
// 1. PATIENT CARE NAMESPACE
|
|
74
|
+
//
|
|
75
|
+
const patientCare = domain.addNamespace({
|
|
76
|
+
info: {
|
|
77
|
+
name: 'PatientCare',
|
|
78
|
+
displayName: 'Patient Care',
|
|
79
|
+
description: 'Patient management, demographics, and medical history',
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Patient Management Model
|
|
84
|
+
const patientModel = patientCare.addModel({
|
|
85
|
+
info: {
|
|
86
|
+
name: 'Patients',
|
|
87
|
+
displayName: 'Patient Management',
|
|
88
|
+
description: 'Patient records and demographic information',
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
// Patient Entity
|
|
93
|
+
const patientEntity = patientModel.addEntity({
|
|
94
|
+
info: {
|
|
95
|
+
name: 'patient',
|
|
96
|
+
displayName: 'Patient',
|
|
97
|
+
description: 'Patient record with demographic and medical information',
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
addIdField(patientEntity, { displayName: 'Patient ID', description: 'Unique identifier for the patient' })
|
|
102
|
+
|
|
103
|
+
patientEntity.addProperty({
|
|
104
|
+
info: { name: 'mrn', displayName: 'Medical Record Number', description: 'Medical record number for the patient' },
|
|
105
|
+
type: 'string',
|
|
106
|
+
required: true,
|
|
107
|
+
unique: true,
|
|
108
|
+
schema: { defaultValue: { type: 'function', value: 'uuid-v4' } },
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
addFirstNameField(patientEntity, { description: 'Patient first name' })
|
|
112
|
+
addLastNameField(patientEntity, { description: 'Patient last name' })
|
|
113
|
+
|
|
114
|
+
patientEntity.addProperty({
|
|
115
|
+
info: { name: 'date_of_birth', displayName: 'Date of Birth', description: 'Patient date of birth' },
|
|
116
|
+
type: 'date',
|
|
117
|
+
required: true,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
patientEntity.addProperty({
|
|
121
|
+
info: { name: 'gender', displayName: 'Gender', description: 'Patient gender identity' },
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: true,
|
|
124
|
+
schema: {
|
|
125
|
+
enum: ['male', 'female', 'other', 'prefer_not_to_say'],
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
addPhoneField(patientEntity, { description: 'Patient primary phone number' })
|
|
130
|
+
addEmailField(patientEntity, { description: 'Patient email address' })
|
|
131
|
+
|
|
132
|
+
patientEntity.addProperty({
|
|
133
|
+
info: {
|
|
134
|
+
name: 'emergency_contact_name',
|
|
135
|
+
displayName: 'Emergency Contact Name',
|
|
136
|
+
description: 'Name of emergency contact',
|
|
137
|
+
},
|
|
138
|
+
type: 'string',
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
addPhoneField(patientEntity, {
|
|
142
|
+
name: 'emergency_contact_phone',
|
|
143
|
+
displayName: 'Emergency Contact Phone',
|
|
144
|
+
description: 'Phone number of emergency contact',
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
patientEntity.addProperty({
|
|
148
|
+
info: { name: 'blood_type', displayName: 'Blood Type', description: 'Patient blood type' },
|
|
149
|
+
type: 'string',
|
|
150
|
+
schema: {
|
|
151
|
+
enum: ['A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-'],
|
|
152
|
+
},
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
patientEntity.addProperty({
|
|
156
|
+
info: { name: 'allergies', displayName: 'Allergies', description: 'Known allergies and reactions' },
|
|
157
|
+
type: 'string',
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
patientEntity.addProperty({
|
|
161
|
+
info: { name: 'medical_history', displayName: 'Medical History', description: 'Summary of medical history' },
|
|
162
|
+
type: 'string',
|
|
163
|
+
semantics: [createSummarySemantic()],
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
addCustomStatusField(patientEntity, ['active', 'inactive', 'deceased'], {
|
|
167
|
+
displayName: 'Patient Status',
|
|
168
|
+
description: 'Current status of the patient',
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
addCreatedAtField(patientEntity, { description: 'When the patient record was created' })
|
|
172
|
+
addUpdatedAtField(patientEntity, { description: 'When the patient record was last updated' })
|
|
173
|
+
|
|
174
|
+
// Address Entity
|
|
175
|
+
const addressEntity = patientModel.addEntity({
|
|
176
|
+
info: {
|
|
177
|
+
name: 'address',
|
|
178
|
+
displayName: 'Address',
|
|
179
|
+
description: 'Patient address information',
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
addIdField(addressEntity, { displayName: 'Address ID', description: 'Unique identifier for the address' })
|
|
184
|
+
|
|
185
|
+
addressEntity.addProperty({
|
|
186
|
+
info: { name: 'type', displayName: 'Address Type', description: 'Type of address (home, work, billing)' },
|
|
187
|
+
type: 'string',
|
|
188
|
+
required: true,
|
|
189
|
+
schema: {
|
|
190
|
+
enum: ['home', 'work', 'billing', 'mailing'],
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
addressEntity.addProperty({
|
|
195
|
+
info: { name: 'line1', displayName: 'Address Line 1', description: 'Primary street address' },
|
|
196
|
+
type: 'string',
|
|
197
|
+
required: true,
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
addressEntity.addProperty({
|
|
201
|
+
info: { name: 'line2', displayName: 'Address Line 2', description: 'Secondary address information' },
|
|
202
|
+
type: 'string',
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
addressEntity.addProperty({
|
|
206
|
+
info: { name: 'city', displayName: 'City', description: 'City name' },
|
|
207
|
+
type: 'string',
|
|
208
|
+
required: true,
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
addressEntity.addProperty({
|
|
212
|
+
info: { name: 'state', displayName: 'State/Province', description: 'State or province' },
|
|
213
|
+
type: 'string',
|
|
214
|
+
required: true,
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
addressEntity.addProperty({
|
|
218
|
+
info: { name: 'postal_code', displayName: 'ZIP/Postal Code', description: 'ZIP or postal code' },
|
|
219
|
+
type: 'string',
|
|
220
|
+
required: true,
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
addressEntity.addProperty({
|
|
224
|
+
info: { name: 'country', displayName: 'Country', description: 'Country name' },
|
|
225
|
+
type: 'string',
|
|
226
|
+
required: true,
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
// Patient-Address Association (One-to-Many)
|
|
230
|
+
patientEntity.addAssociation(
|
|
231
|
+
{ key: addressEntity.key },
|
|
232
|
+
{
|
|
233
|
+
info: {
|
|
234
|
+
name: 'addresses',
|
|
235
|
+
displayName: 'Patient Addresses',
|
|
236
|
+
description: 'Addresses associated with the patient',
|
|
237
|
+
},
|
|
238
|
+
required: false,
|
|
239
|
+
multiple: true,
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
//
|
|
244
|
+
// 2. PROVIDER MANAGEMENT NAMESPACE
|
|
245
|
+
//
|
|
246
|
+
const providerManagement = domain.addNamespace({
|
|
247
|
+
info: {
|
|
248
|
+
name: 'ProviderManagement',
|
|
249
|
+
displayName: 'Provider Management',
|
|
250
|
+
description: 'Healthcare providers, staff, and facility management',
|
|
251
|
+
},
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
// Provider Model
|
|
255
|
+
const providerModel = providerManagement.addModel({
|
|
256
|
+
info: {
|
|
257
|
+
name: 'Providers',
|
|
258
|
+
displayName: 'Provider Management',
|
|
259
|
+
description: 'Healthcare providers and staff',
|
|
260
|
+
},
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
// Provider Entity
|
|
264
|
+
const providerEntity = providerModel.addEntity({
|
|
265
|
+
info: {
|
|
266
|
+
name: 'provider',
|
|
267
|
+
displayName: 'Healthcare Provider',
|
|
268
|
+
description: 'Healthcare provider or medical staff member',
|
|
269
|
+
},
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
addIdField(providerEntity, { displayName: 'Provider ID', description: 'Unique identifier for the provider' })
|
|
273
|
+
|
|
274
|
+
addFirstNameField(providerEntity, { description: 'Provider first name' })
|
|
275
|
+
addLastNameField(providerEntity, { description: 'Provider last name' })
|
|
276
|
+
|
|
277
|
+
providerEntity.addProperty({
|
|
278
|
+
info: { name: 'npi', displayName: 'NPI Number', description: 'National Provider Identifier' },
|
|
279
|
+
type: 'string',
|
|
280
|
+
required: true,
|
|
281
|
+
unique: true,
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
providerEntity.addProperty({
|
|
285
|
+
info: { name: 'license_number', displayName: 'License Number', description: 'Medical license number' },
|
|
286
|
+
type: 'string',
|
|
287
|
+
required: true,
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
addEmailField(providerEntity, { description: 'Provider email address' })
|
|
291
|
+
addPhoneField(providerEntity, { description: 'Provider phone number' })
|
|
292
|
+
|
|
293
|
+
addCustomStatusField(providerEntity, ['active', 'inactive', 'suspended'], {
|
|
294
|
+
displayName: 'Provider Status',
|
|
295
|
+
description: 'Current status of the provider',
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
providerEntity.addProperty({
|
|
299
|
+
info: { name: 'provider_type', displayName: 'Provider Type', description: 'Type of healthcare provider' },
|
|
300
|
+
type: 'string',
|
|
301
|
+
required: true,
|
|
302
|
+
schema: {
|
|
303
|
+
enum: ['doctor', 'nurse', 'specialist', 'therapist', 'technician'],
|
|
304
|
+
},
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
providerEntity.addProperty({
|
|
308
|
+
info: {
|
|
309
|
+
name: 'specialty',
|
|
310
|
+
displayName: 'Medical Specialty',
|
|
311
|
+
description: 'Medical specialty or area of expertise',
|
|
312
|
+
},
|
|
313
|
+
type: 'string',
|
|
314
|
+
required: false,
|
|
315
|
+
schema: {
|
|
316
|
+
enum: ['cardiology', 'dermatology', 'neurology', 'orthopedics', 'pediatrics', 'general'],
|
|
317
|
+
},
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
addCreatedAtField(providerEntity, { description: 'When the provider record was created' })
|
|
321
|
+
addUpdatedAtField(providerEntity, { description: 'When the provider record was last updated' })
|
|
322
|
+
|
|
323
|
+
// Facility Entity
|
|
324
|
+
const facilityEntity = providerModel.addEntity({
|
|
325
|
+
info: {
|
|
326
|
+
name: 'facility',
|
|
327
|
+
displayName: 'Healthcare Facility',
|
|
328
|
+
description: 'Hospital, clinic, or medical facility',
|
|
329
|
+
},
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
addIdField(facilityEntity, { displayName: 'Facility ID', description: 'Unique identifier for the facility' })
|
|
333
|
+
|
|
334
|
+
addNameField(facilityEntity, { displayName: 'Facility Name', description: 'Name of the healthcare facility' })
|
|
335
|
+
|
|
336
|
+
addDescriptionField(facilityEntity, { description: 'Description of the facility and services offered' })
|
|
337
|
+
|
|
338
|
+
facilityEntity.addProperty({
|
|
339
|
+
info: { name: 'facility_type', displayName: 'Facility Type', description: 'Type of healthcare facility' },
|
|
340
|
+
type: 'string',
|
|
341
|
+
required: true,
|
|
342
|
+
schema: {
|
|
343
|
+
enum: ['hospital', 'clinic', 'urgent_care', 'specialty_center', 'laboratory'],
|
|
344
|
+
},
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
addPhoneField(facilityEntity, { description: 'Facility phone number' })
|
|
348
|
+
|
|
349
|
+
facilityEntity.addProperty({
|
|
350
|
+
info: { name: 'address', displayName: 'Facility Address', description: 'Physical address of the facility' },
|
|
351
|
+
type: 'string',
|
|
352
|
+
required: true,
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
addCustomStatusField(facilityEntity, ['active', 'inactive', 'temporary_closed'], {
|
|
356
|
+
displayName: 'Facility Status',
|
|
357
|
+
description: 'Current status of the facility',
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
addCreatedAtField(facilityEntity, { description: 'When the facility record was created' })
|
|
361
|
+
|
|
362
|
+
// Provider-Facility Association (Many-to-Many)
|
|
363
|
+
providerEntity.addAssociation(
|
|
364
|
+
{ key: facilityEntity.key },
|
|
365
|
+
{
|
|
366
|
+
info: {
|
|
367
|
+
name: 'facilities',
|
|
368
|
+
displayName: 'Provider Facilities',
|
|
369
|
+
description: 'Facilities where this provider works',
|
|
370
|
+
},
|
|
371
|
+
required: false,
|
|
372
|
+
multiple: true,
|
|
373
|
+
}
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
//
|
|
377
|
+
// 3. APPOINTMENT SCHEDULING NAMESPACE
|
|
378
|
+
//
|
|
379
|
+
const appointmentScheduling = domain.addNamespace({
|
|
380
|
+
info: {
|
|
381
|
+
name: 'AppointmentScheduling',
|
|
382
|
+
displayName: 'Appointment Scheduling',
|
|
383
|
+
description: 'Appointment booking, scheduling, and availability management',
|
|
384
|
+
},
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
// Appointment Model
|
|
388
|
+
const appointmentModel = appointmentScheduling.addModel({
|
|
389
|
+
info: {
|
|
390
|
+
name: 'Appointments',
|
|
391
|
+
displayName: 'Appointment Management',
|
|
392
|
+
description: 'Patient appointments and scheduling',
|
|
393
|
+
},
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
// Appointment Entity
|
|
397
|
+
const appointmentEntity = appointmentModel.addEntity({
|
|
398
|
+
info: {
|
|
399
|
+
name: 'appointment',
|
|
400
|
+
displayName: 'Appointment',
|
|
401
|
+
description: 'Patient appointment with healthcare provider',
|
|
402
|
+
},
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
addIdField(appointmentEntity, { displayName: 'Appointment ID', description: 'Unique identifier for the appointment' })
|
|
406
|
+
|
|
407
|
+
appointmentEntity.addProperty({
|
|
408
|
+
info: { name: 'appointment_date', displayName: 'Appointment Date', description: 'Date of the appointment' },
|
|
409
|
+
type: 'date',
|
|
410
|
+
required: true,
|
|
411
|
+
})
|
|
412
|
+
|
|
413
|
+
appointmentEntity.addProperty({
|
|
414
|
+
info: { name: 'start_time', displayName: 'Start Time', description: 'Appointment start time' },
|
|
415
|
+
type: 'time',
|
|
416
|
+
required: true,
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
appointmentEntity.addProperty({
|
|
420
|
+
info: { name: 'end_time', displayName: 'End Time', description: 'Appointment end time' },
|
|
421
|
+
type: 'time',
|
|
422
|
+
required: true,
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
appointmentEntity.addProperty({
|
|
426
|
+
info: {
|
|
427
|
+
name: 'duration_minutes',
|
|
428
|
+
displayName: 'Duration (Minutes)',
|
|
429
|
+
description: 'Appointment duration in minutes',
|
|
430
|
+
},
|
|
431
|
+
type: 'number',
|
|
432
|
+
required: true,
|
|
433
|
+
schema: {
|
|
434
|
+
minimum: 15,
|
|
435
|
+
maximum: 480,
|
|
436
|
+
},
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
addCustomStatusField(
|
|
440
|
+
appointmentEntity,
|
|
441
|
+
['scheduled', 'confirmed', 'in_progress', 'completed', 'cancelled', 'no_show'],
|
|
442
|
+
{
|
|
443
|
+
displayName: 'Appointment Status',
|
|
444
|
+
description: 'Current status of the appointment',
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
appointmentEntity.addProperty({
|
|
449
|
+
info: { name: 'reason', displayName: 'Appointment Reason', description: 'Reason for the appointment' },
|
|
450
|
+
type: 'string',
|
|
451
|
+
})
|
|
452
|
+
|
|
453
|
+
appointmentEntity.addProperty({
|
|
454
|
+
info: { name: 'notes', displayName: 'Appointment Notes', description: 'Additional notes for the appointment' },
|
|
455
|
+
type: 'string',
|
|
456
|
+
})
|
|
457
|
+
|
|
458
|
+
addCreatedAtField(appointmentEntity, { description: 'When the appointment was created' })
|
|
459
|
+
addUpdatedAtField(appointmentEntity, { description: 'When the appointment was last updated' })
|
|
460
|
+
|
|
461
|
+
// Appointment-Patient Association (Many-to-One)
|
|
462
|
+
appointmentEntity.addAssociation(
|
|
463
|
+
{ key: patientEntity.key },
|
|
464
|
+
{
|
|
465
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient for this appointment' },
|
|
466
|
+
required: true,
|
|
467
|
+
multiple: false,
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
// Appointment-Provider Association (Many-to-One)
|
|
472
|
+
appointmentEntity.addAssociation(
|
|
473
|
+
{ key: providerEntity.key },
|
|
474
|
+
{
|
|
475
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Healthcare provider for this appointment' },
|
|
476
|
+
required: true,
|
|
477
|
+
multiple: false,
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
// Appointment-Facility Association (Many-to-One)
|
|
482
|
+
appointmentEntity.addAssociation(
|
|
483
|
+
{ key: facilityEntity.key },
|
|
484
|
+
{
|
|
485
|
+
info: { name: 'facility', displayName: 'Facility', description: 'Facility where appointment takes place' },
|
|
486
|
+
required: true,
|
|
487
|
+
multiple: false,
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
// Availability Model
|
|
492
|
+
const availabilityModel = appointmentScheduling.addModel({
|
|
493
|
+
info: {
|
|
494
|
+
name: 'Availability',
|
|
495
|
+
displayName: 'Provider Availability',
|
|
496
|
+
description: 'Provider availability and scheduling rules',
|
|
497
|
+
},
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
// Provider Availability Entity
|
|
501
|
+
const availabilityEntity = availabilityModel.addEntity({
|
|
502
|
+
info: {
|
|
503
|
+
name: 'provider_availability',
|
|
504
|
+
displayName: 'Provider Availability',
|
|
505
|
+
description: 'Provider availability schedule and rules',
|
|
506
|
+
},
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
addIdField(availabilityEntity, { displayName: 'Availability ID', description: 'Unique identifier for availability' })
|
|
510
|
+
|
|
511
|
+
availabilityEntity.addProperty({
|
|
512
|
+
info: { name: 'day_of_week', displayName: 'Day of Week', description: 'Day of the week for availability' },
|
|
513
|
+
type: 'string',
|
|
514
|
+
required: true,
|
|
515
|
+
schema: {
|
|
516
|
+
enum: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'],
|
|
517
|
+
},
|
|
518
|
+
})
|
|
519
|
+
|
|
520
|
+
availabilityEntity.addProperty({
|
|
521
|
+
info: { name: 'start_time', displayName: 'Start Time', description: 'Start time for availability' },
|
|
522
|
+
type: 'time',
|
|
523
|
+
required: true,
|
|
524
|
+
})
|
|
525
|
+
|
|
526
|
+
availabilityEntity.addProperty({
|
|
527
|
+
info: { name: 'end_time', displayName: 'End Time', description: 'End time for availability' },
|
|
528
|
+
type: 'time',
|
|
529
|
+
required: true,
|
|
530
|
+
})
|
|
531
|
+
|
|
532
|
+
addBooleanField(availabilityEntity, 'is_available', 'true', {
|
|
533
|
+
displayName: 'Is Available',
|
|
534
|
+
description: 'Whether the provider is available during this time',
|
|
535
|
+
})
|
|
536
|
+
|
|
537
|
+
// Availability-Provider Association (Many-to-One)
|
|
538
|
+
availabilityEntity.addAssociation(
|
|
539
|
+
{ key: providerEntity.key },
|
|
540
|
+
{
|
|
541
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider for this availability' },
|
|
542
|
+
required: true,
|
|
543
|
+
multiple: false,
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
//
|
|
548
|
+
// 4. MEDICAL RECORDS NAMESPACE
|
|
549
|
+
//
|
|
550
|
+
const medicalRecords = domain.addNamespace({
|
|
551
|
+
info: {
|
|
552
|
+
name: 'MedicalRecords',
|
|
553
|
+
displayName: 'Medical Records',
|
|
554
|
+
description: 'Medical records, diagnoses, treatments, and lab results',
|
|
555
|
+
},
|
|
556
|
+
})
|
|
557
|
+
|
|
558
|
+
// Medical Records Model
|
|
559
|
+
const medicalRecordsModel = medicalRecords.addModel({
|
|
560
|
+
info: {
|
|
561
|
+
name: 'MedicalRecords',
|
|
562
|
+
displayName: 'Medical Records Management',
|
|
563
|
+
description: 'Patient medical records and documentation',
|
|
564
|
+
},
|
|
565
|
+
})
|
|
566
|
+
|
|
567
|
+
// Diagnosis Entity
|
|
568
|
+
const diagnosisEntity = medicalRecordsModel.addEntity({
|
|
569
|
+
info: {
|
|
570
|
+
name: 'diagnosis',
|
|
571
|
+
displayName: 'Diagnosis',
|
|
572
|
+
description: 'Medical diagnosis for a patient',
|
|
573
|
+
},
|
|
574
|
+
})
|
|
575
|
+
|
|
576
|
+
addIdField(diagnosisEntity, { displayName: 'Diagnosis ID', description: 'Unique identifier for the diagnosis' })
|
|
577
|
+
|
|
578
|
+
diagnosisEntity.addProperty({
|
|
579
|
+
info: { name: 'icd_code', displayName: 'ICD Code', description: 'International Classification of Diseases code' },
|
|
580
|
+
type: 'string',
|
|
581
|
+
required: true,
|
|
582
|
+
})
|
|
583
|
+
|
|
584
|
+
diagnosisEntity.addProperty({
|
|
585
|
+
info: { name: 'diagnosis_name', displayName: 'Diagnosis Name', description: 'Name of the diagnosis' },
|
|
586
|
+
type: 'string',
|
|
587
|
+
required: true,
|
|
588
|
+
})
|
|
589
|
+
|
|
590
|
+
addDescriptionField(diagnosisEntity, { description: 'Detailed description of the diagnosis' })
|
|
591
|
+
|
|
592
|
+
diagnosisEntity.addProperty({
|
|
593
|
+
info: { name: 'diagnosis_date', displayName: 'Diagnosis Date', description: 'Date when diagnosis was made' },
|
|
594
|
+
type: 'date',
|
|
595
|
+
required: true,
|
|
596
|
+
})
|
|
597
|
+
|
|
598
|
+
addCustomStatusField(diagnosisEntity, ['active', 'resolved', 'chronic'], {
|
|
599
|
+
displayName: 'Diagnosis Status',
|
|
600
|
+
description: 'Current status of the diagnosis',
|
|
601
|
+
})
|
|
602
|
+
|
|
603
|
+
addCreatedAtField(diagnosisEntity, { description: 'When the diagnosis was created' })
|
|
604
|
+
|
|
605
|
+
// Diagnosis-Patient Association (Many-to-One)
|
|
606
|
+
diagnosisEntity.addAssociation(
|
|
607
|
+
{ key: patientEntity.key },
|
|
608
|
+
{
|
|
609
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient with this diagnosis' },
|
|
610
|
+
required: true,
|
|
611
|
+
multiple: false,
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
// Diagnosis-Provider Association (Many-to-One)
|
|
616
|
+
diagnosisEntity.addAssociation(
|
|
617
|
+
{ key: providerEntity.key },
|
|
618
|
+
{
|
|
619
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider who made the diagnosis' },
|
|
620
|
+
required: true,
|
|
621
|
+
multiple: false,
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
// Treatment Entity
|
|
626
|
+
const treatmentEntity = medicalRecordsModel.addEntity({
|
|
627
|
+
info: {
|
|
628
|
+
name: 'treatment',
|
|
629
|
+
displayName: 'Treatment',
|
|
630
|
+
description: 'Medical treatment or procedure',
|
|
631
|
+
},
|
|
632
|
+
})
|
|
633
|
+
|
|
634
|
+
addIdField(treatmentEntity, { displayName: 'Treatment ID', description: 'Unique identifier for the treatment' })
|
|
635
|
+
|
|
636
|
+
addNameField(treatmentEntity, { displayName: 'Treatment Name', description: 'Name of the treatment or procedure' })
|
|
637
|
+
|
|
638
|
+
addDescriptionField(treatmentEntity, { description: 'Detailed description of the treatment' })
|
|
639
|
+
|
|
640
|
+
treatmentEntity.addProperty({
|
|
641
|
+
info: { name: 'treatment_date', displayName: 'Treatment Date', description: 'Date when treatment was performed' },
|
|
642
|
+
type: 'date',
|
|
643
|
+
required: true,
|
|
644
|
+
})
|
|
645
|
+
|
|
646
|
+
addCustomStatusField(treatmentEntity, ['planned', 'in_progress', 'completed', 'cancelled'], {
|
|
647
|
+
displayName: 'Treatment Status',
|
|
648
|
+
description: 'Current status of the treatment',
|
|
649
|
+
})
|
|
650
|
+
|
|
651
|
+
addCreatedAtField(treatmentEntity, { description: 'When the treatment was created' })
|
|
652
|
+
|
|
653
|
+
// Treatment-Patient Association (Many-to-One)
|
|
654
|
+
treatmentEntity.addAssociation(
|
|
655
|
+
{ key: patientEntity.key },
|
|
656
|
+
{
|
|
657
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient receiving the treatment' },
|
|
658
|
+
required: true,
|
|
659
|
+
multiple: false,
|
|
660
|
+
}
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
// Treatment-Provider Association (Many-to-One)
|
|
664
|
+
treatmentEntity.addAssociation(
|
|
665
|
+
{ key: providerEntity.key },
|
|
666
|
+
{
|
|
667
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider performing the treatment' },
|
|
668
|
+
required: true,
|
|
669
|
+
multiple: false,
|
|
670
|
+
}
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
// Treatment-Diagnosis Association (Many-to-Many)
|
|
674
|
+
treatmentEntity.addAssociation(
|
|
675
|
+
{ key: diagnosisEntity.key },
|
|
676
|
+
{
|
|
677
|
+
info: { name: 'diagnoses', displayName: 'Related Diagnoses', description: 'Diagnoses related to this treatment' },
|
|
678
|
+
required: false,
|
|
679
|
+
multiple: true,
|
|
680
|
+
}
|
|
681
|
+
)
|
|
682
|
+
|
|
683
|
+
// Prescription Entity
|
|
684
|
+
const prescriptionEntity = medicalRecordsModel.addEntity({
|
|
685
|
+
info: {
|
|
686
|
+
name: 'prescription',
|
|
687
|
+
displayName: 'Prescription',
|
|
688
|
+
description: 'Medication prescription',
|
|
689
|
+
},
|
|
690
|
+
})
|
|
691
|
+
|
|
692
|
+
addIdField(prescriptionEntity, {
|
|
693
|
+
displayName: 'Prescription ID',
|
|
694
|
+
description: 'Unique identifier for the prescription',
|
|
695
|
+
})
|
|
696
|
+
|
|
697
|
+
prescriptionEntity.addProperty({
|
|
698
|
+
info: { name: 'medication_name', displayName: 'Medication Name', description: 'Name of the prescribed medication' },
|
|
699
|
+
type: 'string',
|
|
700
|
+
required: true,
|
|
701
|
+
})
|
|
702
|
+
|
|
703
|
+
prescriptionEntity.addProperty({
|
|
704
|
+
info: { name: 'dosage', displayName: 'Dosage', description: 'Prescribed dosage information' },
|
|
705
|
+
type: 'string',
|
|
706
|
+
required: true,
|
|
707
|
+
})
|
|
708
|
+
|
|
709
|
+
prescriptionEntity.addProperty({
|
|
710
|
+
info: { name: 'frequency', displayName: 'Frequency', description: 'How often to take the medication' },
|
|
711
|
+
type: 'string',
|
|
712
|
+
required: true,
|
|
713
|
+
})
|
|
714
|
+
|
|
715
|
+
prescriptionEntity.addProperty({
|
|
716
|
+
info: { name: 'duration_days', displayName: 'Duration (Days)', description: 'Duration of prescription in days' },
|
|
717
|
+
type: 'number',
|
|
718
|
+
required: true,
|
|
719
|
+
schema: {
|
|
720
|
+
minimum: 1,
|
|
721
|
+
},
|
|
722
|
+
})
|
|
723
|
+
|
|
724
|
+
prescriptionEntity.addProperty({
|
|
725
|
+
info: {
|
|
726
|
+
name: 'prescribed_date',
|
|
727
|
+
displayName: 'Prescribed Date',
|
|
728
|
+
description: 'Date when medication was prescribed',
|
|
729
|
+
},
|
|
730
|
+
type: 'date',
|
|
731
|
+
required: true,
|
|
732
|
+
})
|
|
733
|
+
|
|
734
|
+
addCustomStatusField(prescriptionEntity, ['active', 'completed', 'discontinued'], {
|
|
735
|
+
displayName: 'Prescription Status',
|
|
736
|
+
description: 'Current status of the prescription',
|
|
737
|
+
})
|
|
738
|
+
|
|
739
|
+
addCreatedAtField(prescriptionEntity, { description: 'When the prescription was created' })
|
|
740
|
+
|
|
741
|
+
// Prescription-Patient Association (Many-to-One)
|
|
742
|
+
prescriptionEntity.addAssociation(
|
|
743
|
+
{ key: patientEntity.key },
|
|
744
|
+
{
|
|
745
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient prescribed the medication' },
|
|
746
|
+
required: true,
|
|
747
|
+
multiple: false,
|
|
748
|
+
}
|
|
749
|
+
)
|
|
750
|
+
|
|
751
|
+
// Prescription-Provider Association (Many-to-One)
|
|
752
|
+
prescriptionEntity.addAssociation(
|
|
753
|
+
{ key: providerEntity.key },
|
|
754
|
+
{
|
|
755
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider who prescribed the medication' },
|
|
756
|
+
required: true,
|
|
757
|
+
multiple: false,
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
|
|
761
|
+
// Lab Result Entity
|
|
762
|
+
const labResultEntity = medicalRecordsModel.addEntity({
|
|
763
|
+
info: {
|
|
764
|
+
name: 'lab_result',
|
|
765
|
+
displayName: 'Lab Result',
|
|
766
|
+
description: 'Laboratory test results',
|
|
767
|
+
},
|
|
768
|
+
})
|
|
769
|
+
|
|
770
|
+
addIdField(labResultEntity, { displayName: 'Lab Result ID', description: 'Unique identifier for the lab result' })
|
|
771
|
+
|
|
772
|
+
addNameField(labResultEntity, { displayName: 'Test Name', description: 'Name of the laboratory test' })
|
|
773
|
+
|
|
774
|
+
labResultEntity.addProperty({
|
|
775
|
+
info: { name: 'test_date', displayName: 'Test Date', description: 'Date when the test was performed' },
|
|
776
|
+
type: 'date',
|
|
777
|
+
required: true,
|
|
778
|
+
})
|
|
779
|
+
|
|
780
|
+
labResultEntity.addProperty({
|
|
781
|
+
info: { name: 'result_value', displayName: 'Result Value', description: 'Numerical or text result value' },
|
|
782
|
+
type: 'string',
|
|
783
|
+
required: true,
|
|
784
|
+
})
|
|
785
|
+
|
|
786
|
+
labResultEntity.addProperty({
|
|
787
|
+
info: {
|
|
788
|
+
name: 'reference_range',
|
|
789
|
+
displayName: 'Reference Range',
|
|
790
|
+
description: 'Normal reference range for the test',
|
|
791
|
+
},
|
|
792
|
+
type: 'string',
|
|
793
|
+
})
|
|
794
|
+
|
|
795
|
+
addCustomStatusField(labResultEntity, ['normal', 'abnormal', 'critical', 'pending'], {
|
|
796
|
+
displayName: 'Result Status',
|
|
797
|
+
description: 'Status of the lab result',
|
|
798
|
+
})
|
|
799
|
+
|
|
800
|
+
addDescriptionField(labResultEntity, { description: 'Additional notes about the lab result' })
|
|
801
|
+
|
|
802
|
+
addCreatedAtField(labResultEntity, { description: 'When the lab result was created' })
|
|
803
|
+
|
|
804
|
+
// LabResult-Patient Association (Many-to-One)
|
|
805
|
+
labResultEntity.addAssociation(
|
|
806
|
+
{ key: patientEntity.key },
|
|
807
|
+
{
|
|
808
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient for this lab result' },
|
|
809
|
+
required: true,
|
|
810
|
+
multiple: false,
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
|
|
814
|
+
// LabResult-Provider Association (Many-to-One)
|
|
815
|
+
labResultEntity.addAssociation(
|
|
816
|
+
{ key: providerEntity.key },
|
|
817
|
+
{
|
|
818
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider who ordered the test' },
|
|
819
|
+
required: true,
|
|
820
|
+
multiple: false,
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
|
|
824
|
+
//
|
|
825
|
+
// 5. INSURANCE & BILLING NAMESPACE
|
|
826
|
+
//
|
|
827
|
+
const insuranceBilling = domain.addNamespace({
|
|
828
|
+
info: {
|
|
829
|
+
name: 'InsuranceBilling',
|
|
830
|
+
displayName: 'Insurance & Billing',
|
|
831
|
+
description: 'Insurance coverage, claims, and billing management',
|
|
832
|
+
},
|
|
833
|
+
})
|
|
834
|
+
|
|
835
|
+
// Insurance Model
|
|
836
|
+
const insuranceModel = insuranceBilling.addModel({
|
|
837
|
+
info: {
|
|
838
|
+
name: 'Insurance',
|
|
839
|
+
displayName: 'Insurance Management',
|
|
840
|
+
description: 'Insurance coverage and policy information',
|
|
841
|
+
},
|
|
842
|
+
})
|
|
843
|
+
|
|
844
|
+
// Insurance Policy Entity
|
|
845
|
+
const insurancePolicyEntity = insuranceModel.addEntity({
|
|
846
|
+
info: {
|
|
847
|
+
name: 'insurance_policy',
|
|
848
|
+
displayName: 'Insurance Policy',
|
|
849
|
+
description: 'Patient insurance policy information',
|
|
850
|
+
},
|
|
851
|
+
})
|
|
852
|
+
|
|
853
|
+
addIdField(insurancePolicyEntity, { displayName: 'Policy ID', description: 'Unique identifier for the policy' })
|
|
854
|
+
|
|
855
|
+
insurancePolicyEntity.addProperty({
|
|
856
|
+
info: { name: 'policy_number', displayName: 'Policy Number', description: 'Insurance policy number' },
|
|
857
|
+
type: 'string',
|
|
858
|
+
required: true,
|
|
859
|
+
unique: true,
|
|
860
|
+
})
|
|
861
|
+
|
|
862
|
+
addNameField(insurancePolicyEntity, {
|
|
863
|
+
displayName: 'Insurance Provider',
|
|
864
|
+
description: 'Name of the insurance provider',
|
|
865
|
+
})
|
|
866
|
+
|
|
867
|
+
addCustomStatusField(insurancePolicyEntity, ['active', 'inactive', 'expired', 'pending'], {
|
|
868
|
+
displayName: 'Policy Status',
|
|
869
|
+
description: 'Current status of the insurance policy',
|
|
870
|
+
})
|
|
871
|
+
|
|
872
|
+
insurancePolicyEntity.addProperty({
|
|
873
|
+
info: { name: 'effective_date', displayName: 'Effective Date', description: 'Date when policy becomes effective' },
|
|
874
|
+
type: 'date',
|
|
875
|
+
required: true,
|
|
876
|
+
})
|
|
877
|
+
|
|
878
|
+
insurancePolicyEntity.addProperty({
|
|
879
|
+
info: { name: 'expiration_date', displayName: 'Expiration Date', description: 'Date when policy expires' },
|
|
880
|
+
type: 'date',
|
|
881
|
+
required: true,
|
|
882
|
+
})
|
|
883
|
+
|
|
884
|
+
addCurrencyAmountField(insurancePolicyEntity, 'deductible', 'Deductible Amount', {
|
|
885
|
+
description: 'Annual deductible amount',
|
|
886
|
+
})
|
|
887
|
+
|
|
888
|
+
addCurrencyAmountField(insurancePolicyEntity, 'copay', 'Copay Amount', {
|
|
889
|
+
description: 'Copay amount for office visits',
|
|
890
|
+
})
|
|
891
|
+
|
|
892
|
+
addCreatedAtField(insurancePolicyEntity, { description: 'When the policy was created' })
|
|
893
|
+
|
|
894
|
+
// InsurancePolicy-Patient Association (Many-to-One)
|
|
895
|
+
insurancePolicyEntity.addAssociation(
|
|
896
|
+
{ key: patientEntity.key },
|
|
897
|
+
{
|
|
898
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient covered by this policy' },
|
|
899
|
+
required: true,
|
|
900
|
+
multiple: false,
|
|
901
|
+
}
|
|
902
|
+
)
|
|
903
|
+
|
|
904
|
+
// Claim Entity
|
|
905
|
+
const claimEntity = insuranceModel.addEntity({
|
|
906
|
+
info: {
|
|
907
|
+
name: 'claim',
|
|
908
|
+
displayName: 'Insurance Claim',
|
|
909
|
+
description: 'Insurance claim for medical services',
|
|
910
|
+
},
|
|
911
|
+
})
|
|
912
|
+
|
|
913
|
+
addIdField(claimEntity, { displayName: 'Claim ID', description: 'Unique identifier for the claim' })
|
|
914
|
+
|
|
915
|
+
claimEntity.addProperty({
|
|
916
|
+
info: { name: 'claim_number', displayName: 'Claim Number', description: 'Insurance claim number' },
|
|
917
|
+
type: 'string',
|
|
918
|
+
required: true,
|
|
919
|
+
unique: true,
|
|
920
|
+
})
|
|
921
|
+
|
|
922
|
+
addCurrencyAmountField(claimEntity, 'billed_amount', 'Billed Amount', {
|
|
923
|
+
description: 'Amount billed to insurance',
|
|
924
|
+
})
|
|
925
|
+
|
|
926
|
+
addCurrencyAmountField(claimEntity, 'approved_amount', 'Approved Amount', {
|
|
927
|
+
description: 'Amount approved by insurance',
|
|
928
|
+
})
|
|
929
|
+
|
|
930
|
+
addCurrencyAmountField(claimEntity, 'patient_responsibility', 'Patient Responsibility', {
|
|
931
|
+
description: 'Amount patient is responsible for',
|
|
932
|
+
})
|
|
933
|
+
|
|
934
|
+
addCustomStatusField(claimEntity, ['submitted', 'processing', 'approved', 'denied', 'paid'], {
|
|
935
|
+
displayName: 'Claim Status',
|
|
936
|
+
description: 'Current status of the insurance claim',
|
|
937
|
+
})
|
|
938
|
+
|
|
939
|
+
claimEntity.addProperty({
|
|
940
|
+
info: { name: 'service_date', displayName: 'Service Date', description: 'Date when service was provided' },
|
|
941
|
+
type: 'date',
|
|
942
|
+
required: true,
|
|
943
|
+
})
|
|
944
|
+
|
|
945
|
+
addCreatedAtField(claimEntity, { description: 'When the claim was created' })
|
|
946
|
+
|
|
947
|
+
// Claim-Patient Association (Many-to-One)
|
|
948
|
+
claimEntity.addAssociation(
|
|
949
|
+
{ key: patientEntity.key },
|
|
950
|
+
{
|
|
951
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient for this claim' },
|
|
952
|
+
required: true,
|
|
953
|
+
multiple: false,
|
|
954
|
+
}
|
|
955
|
+
)
|
|
956
|
+
|
|
957
|
+
// Claim-Provider Association (Many-to-One)
|
|
958
|
+
claimEntity.addAssociation(
|
|
959
|
+
{ key: providerEntity.key },
|
|
960
|
+
{
|
|
961
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider who provided the service' },
|
|
962
|
+
required: true,
|
|
963
|
+
multiple: false,
|
|
964
|
+
}
|
|
965
|
+
)
|
|
966
|
+
|
|
967
|
+
// Claim-InsurancePolicy Association (Many-to-One)
|
|
968
|
+
claimEntity.addAssociation(
|
|
969
|
+
{ key: insurancePolicyEntity.key },
|
|
970
|
+
{
|
|
971
|
+
info: {
|
|
972
|
+
name: 'insurance_policy',
|
|
973
|
+
displayName: 'Insurance Policy',
|
|
974
|
+
description: 'Insurance policy for this claim',
|
|
975
|
+
},
|
|
976
|
+
required: true,
|
|
977
|
+
multiple: false,
|
|
978
|
+
}
|
|
979
|
+
)
|
|
980
|
+
|
|
981
|
+
// Billing Model
|
|
982
|
+
const billingModel = insuranceBilling.addModel({
|
|
983
|
+
info: {
|
|
984
|
+
name: 'Billing',
|
|
985
|
+
displayName: 'Billing Management',
|
|
986
|
+
description: 'Patient billing and payment processing',
|
|
987
|
+
},
|
|
988
|
+
})
|
|
989
|
+
|
|
990
|
+
// Invoice Entity
|
|
991
|
+
const invoiceEntity = billingModel.addEntity({
|
|
992
|
+
info: {
|
|
993
|
+
name: 'invoice',
|
|
994
|
+
displayName: 'Invoice',
|
|
995
|
+
description: 'Patient invoice for medical services',
|
|
996
|
+
},
|
|
997
|
+
})
|
|
998
|
+
|
|
999
|
+
addIdField(invoiceEntity, { displayName: 'Invoice ID', description: 'Unique identifier for the invoice' })
|
|
1000
|
+
|
|
1001
|
+
invoiceEntity.addProperty({
|
|
1002
|
+
info: { name: 'invoice_number', displayName: 'Invoice Number', description: 'Human-readable invoice number' },
|
|
1003
|
+
type: 'string',
|
|
1004
|
+
required: true,
|
|
1005
|
+
unique: true,
|
|
1006
|
+
})
|
|
1007
|
+
|
|
1008
|
+
addCurrencyAmountField(invoiceEntity, 'total_amount', 'Total Amount', {
|
|
1009
|
+
description: 'Total amount due on the invoice',
|
|
1010
|
+
})
|
|
1011
|
+
|
|
1012
|
+
addCurrencyAmountField(invoiceEntity, 'paid_amount', 'Paid Amount', {
|
|
1013
|
+
description: 'Amount already paid',
|
|
1014
|
+
})
|
|
1015
|
+
|
|
1016
|
+
addCurrencyAmountField(invoiceEntity, 'balance_due', 'Balance Due', {
|
|
1017
|
+
description: 'Remaining balance due',
|
|
1018
|
+
})
|
|
1019
|
+
|
|
1020
|
+
addCustomStatusField(invoiceEntity, ['draft', 'sent', 'paid', 'overdue', 'cancelled'], {
|
|
1021
|
+
displayName: 'Invoice Status',
|
|
1022
|
+
description: 'Current status of the invoice',
|
|
1023
|
+
})
|
|
1024
|
+
|
|
1025
|
+
invoiceEntity.addProperty({
|
|
1026
|
+
info: { name: 'due_date', displayName: 'Due Date', description: 'Date when payment is due' },
|
|
1027
|
+
type: 'date',
|
|
1028
|
+
required: true,
|
|
1029
|
+
})
|
|
1030
|
+
|
|
1031
|
+
addCreatedAtField(invoiceEntity, { description: 'When the invoice was created' })
|
|
1032
|
+
|
|
1033
|
+
// Invoice-Patient Association (Many-to-One)
|
|
1034
|
+
invoiceEntity.addAssociation(
|
|
1035
|
+
{ key: patientEntity.key },
|
|
1036
|
+
{
|
|
1037
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient for this invoice' },
|
|
1038
|
+
required: true,
|
|
1039
|
+
multiple: false,
|
|
1040
|
+
}
|
|
1041
|
+
)
|
|
1042
|
+
|
|
1043
|
+
// Invoice-Provider Association (Many-to-One)
|
|
1044
|
+
invoiceEntity.addAssociation(
|
|
1045
|
+
{ key: providerEntity.key },
|
|
1046
|
+
{
|
|
1047
|
+
info: { name: 'provider', displayName: 'Provider', description: 'Provider who provided the services' },
|
|
1048
|
+
required: true,
|
|
1049
|
+
multiple: false,
|
|
1050
|
+
}
|
|
1051
|
+
)
|
|
1052
|
+
|
|
1053
|
+
// Payment Entity
|
|
1054
|
+
const paymentEntity = billingModel.addEntity({
|
|
1055
|
+
info: {
|
|
1056
|
+
name: 'payment',
|
|
1057
|
+
displayName: 'Payment',
|
|
1058
|
+
description: 'Payment transaction for medical services',
|
|
1059
|
+
},
|
|
1060
|
+
})
|
|
1061
|
+
|
|
1062
|
+
addIdField(paymentEntity, { displayName: 'Payment ID', description: 'Unique identifier for the payment' })
|
|
1063
|
+
|
|
1064
|
+
addCurrencyAmountField(paymentEntity, 'amount', 'Payment Amount', {
|
|
1065
|
+
description: 'Amount of the payment',
|
|
1066
|
+
})
|
|
1067
|
+
|
|
1068
|
+
paymentEntity.addProperty({
|
|
1069
|
+
info: { name: 'payment_method', displayName: 'Payment Method', description: 'Method used for payment' },
|
|
1070
|
+
type: 'string',
|
|
1071
|
+
required: true,
|
|
1072
|
+
schema: {
|
|
1073
|
+
enum: ['cash', 'check', 'credit_card', 'debit_card', 'insurance', 'bank_transfer'],
|
|
1074
|
+
},
|
|
1075
|
+
})
|
|
1076
|
+
|
|
1077
|
+
addCustomStatusField(paymentEntity, ['pending', 'completed', 'failed', 'refunded'], {
|
|
1078
|
+
displayName: 'Payment Status',
|
|
1079
|
+
description: 'Current status of the payment',
|
|
1080
|
+
})
|
|
1081
|
+
|
|
1082
|
+
paymentEntity.addProperty({
|
|
1083
|
+
info: { name: 'payment_date', displayName: 'Payment Date', description: 'Date when payment was made' },
|
|
1084
|
+
type: 'date',
|
|
1085
|
+
required: true,
|
|
1086
|
+
})
|
|
1087
|
+
|
|
1088
|
+
addCreatedAtField(paymentEntity, { description: 'When the payment was created' })
|
|
1089
|
+
|
|
1090
|
+
// Payment-Patient Association (Many-to-One)
|
|
1091
|
+
paymentEntity.addAssociation(
|
|
1092
|
+
{ key: patientEntity.key },
|
|
1093
|
+
{
|
|
1094
|
+
info: { name: 'patient', displayName: 'Patient', description: 'Patient who made the payment' },
|
|
1095
|
+
required: true,
|
|
1096
|
+
multiple: false,
|
|
1097
|
+
}
|
|
1098
|
+
)
|
|
1099
|
+
|
|
1100
|
+
// Payment-Invoice Association (Many-to-One)
|
|
1101
|
+
paymentEntity.addAssociation(
|
|
1102
|
+
{ key: invoiceEntity.key },
|
|
1103
|
+
{
|
|
1104
|
+
info: { name: 'invoice', displayName: 'Invoice', description: 'Invoice this payment applies to' },
|
|
1105
|
+
required: true,
|
|
1106
|
+
multiple: false,
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
|
|
1110
|
+
return domain
|
|
1111
|
+
}
|