~oship-dev/oshippy/trunk

« back to all changes in this revision

Viewing changes to src/mlhim/oship/rm/content/interfaces.py

  • Committer: Tim Cook
  • Date: 2011-02-06 12:08:13 UTC
  • Revision ID: timothywayne.cook@gmail.com-20110206120813-qwmawxoaocsrbjtq
Created the overall structure of the Reference Model. Added images and other content to start the Welcome to OSHIHP demo app.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: UTF-8 -*-
 
2
##############################################################################
 
3
# Copyright (c) 2011 Timothy W. Cook and Contributors.
 
4
# All Rights Reserved. See CONTRIBUTORS.txt
 
5
#
 
6
# This software is subject to the provisions of the GNU LESSER GENERAL 
 
7
# PUBLIC LICENSE Version 3, Dated: 29 June 2007 See docs/LICENSE.txt or 
 
8
# http://www.gnu.org/licenses/lgpl.html 
 
9
##############################################################################
 
10
 
 
11
from zope.interface import Interface, Attribute
 
12
from zope.schema import Bool, TextLine, Object
 
13
from zope.i18nmessageid.message import MessageFactory
 
14
 
 
15
_ = MessageFactory('mlhim.rm')
 
16
 
 
17
class IContentItem(Interface):
 
18
    """
 
19
    Abstract ancestor of all concrete content types.
 
20
    """
 
21
    
 
22
    
 
23
class IEventContext(Interface):
 
24
    """
 
25
    The context information of a healthcare event.
 
26
    These include patient contacts or other investigations.
 
27
    """
 
28
 
 
29
    healthCareFacility=Object(
 
30
        schema=IPartyIdentified,
 
31
        title=_(u"Healthcare Facility"),
 
32
        description=_(u"Where this event took place."),
 
33
        required=False,
 
34
    )
 
35
 
 
36
    startTime=Object(
 
37
        schema=IDvDateTime,
 
38
        title=_(u"Start Time"),
 
39
        description=_(u"Start Time"),
 
40
 
 
41
    )
 
42
 
 
43
    endTime=Object(
 
44
        schema=IDvDateTime,
 
45
        title=_(u"End Time"),
 
46
        description=_(u"End Time"),
 
47
        required=False,
 
48
    )
 
49
 
 
50
    participations=List(
 
51
        title=_(u"Participations"),
 
52
        description=_(u"List of all parties involved in the event."),
 
53
        value_type=Object(schema=IParticipation),
 
54
        required=False,
 
55
    )
 
56
 
 
57
    location=TextLine(
 
58
        title=_(u"Location"),
 
59
        description=_(u"Physical location of this event; ABCLab, home,etc."),
 
60
        required=False,
 
61
    )
 
62
 
 
63
    setting=Object(
 
64
        schema=IDvCodedText,
 
65
        title=_(u"Setting"),
 
66
        description=_(u"The setting of the clinical event."),
 
67
 
 
68
    )
 
69
 
 
70
    otherContext=Object(
 
71
        schema=IItemStructure,
 
72
        title=_(u"Other Context"),
 
73
        description=_(u"Other optional archetyped context."),
 
74
        required=False,
 
75
    )
 
76
 
 
77
 
 
78
class IComposition(Interface):
 
79
    """
 
80
    One version in a VersionedComposition.  A composition is considered the unit of modification in an EHR.
 
81
    """
 
82
 
 
83
    content=List(
 
84
        title=_(u"Content"),
 
85
        description=_(u"Content of this composition."),
 
86
        value_type=Object(schema=IContentItem),
 
87
        required=False,
 
88
    )
 
89
 
 
90
    context=Object(
 
91
        schema=IEventContext,
 
92
        title=_(u"Context"),
 
93
        description=_(u"The clinical session context."),
 
94
        required=False,
 
95
    )
 
96
 
 
97
    composer=Object(
 
98
        schema=IPartyProxy,
 
99
        title=_(u"Composer"),
 
100
        description=_(u"The party responsible for the content. It may not be the actual person entering the data."),
 
101
 
 
102
    )
 
103
 
 
104
    category=Object(
 
105
        schema=IDvCodedText,
 
106
        title=_(u"Category"),
 
107
        description=_(u"Defines the broad category of this composition."),
 
108
 
 
109
    )
 
110
 
 
111
    language=Object(
 
112
        schema=ICodePhrase,
 
113
        title=_(u"Language"),
 
114
        description=_(u"Indicator of the localised language where this composition was created."),
 
115
 
 
116
    )
 
117
 
 
118
    territory=Object(
 
119
        schema=ICodePhrase,
 
120
        title=_(u"Territory"),
 
121
        description=_(u"Territory where this composition was written. ISO 3166."),
 
122
 
 
123
    )
 
124
 
 
125
    def isPersistent():
 
126
        """Used to locate items that are of interest to most users."""
 
127
 
 
128
class ICareEntry(Interface):
 
129
    u"""
 
130
            The abstract parent of all clinical ENTRY subtypes. A CARE_ENTRY defines
 
131
            protocol and guideline attributes for all clinical Entry subtypes.
 
132
 
 
133
    """
 
134
 
 
135
    protocol = Object(
 
136
        schema=IItemStructure,
 
137
        title=_(u"Protocol"),
 
138
        description=_(u"""Description of the method (i.e. how) the information in this
 
139
                    entry was arrived at. For OBSERVATIONs, this is a description of the
 
140
                    method or instrument used. For EVALUATIONs, how the evaluation was
 
141
                    arrived at. For INSTRUCTIONs, how to execute the Instruction.
 
142
                    This may take the form of references to guidelines, including
 
143
                    manually followed and executable; knowledge references such as a
 
144
                    paper in Medline; clinical reasons within a largercare process."""),
 
145
        required=False
 
146
    )
 
147
 
 
148
    guidelineId = Object(
 
149
        schema=IObjectRef,
 
150
        title=_(u"guidelineId"),
 
151
        description=_(u"""Optional external identifier of guideline creating this
 
152
                    action if relevant."""),
 
153
        required=False
 
154
    )
 
155
 
 
156
 
 
157
 
 
158
class IAdminEntry(Interface):
 
159
    u"""
 
160
        Entry subtype for administrative information, i.e. information about setting up the
 
161
        clinical process, but not itself clinically relevant. Archetypes will define con-
 
162
        tained information.
 
163
        Used for admistrative details of admission, episode, ward location, discharge,
 
164
        appointment (if not stored in a practice management or appointments system).
 
165
 
 
166
        Not used for any clinically significant information.
 
167
    """
 
168
 
 
169
    data = Object(
 
170
        schema=IItemStructure,
 
171
        title=u"""data""",
 
172
        description=u"""The data of the Entry; modelled in archetypes.""",
 
173
        required=True
 
174
        )
 
175
 
 
176
 
 
177
 
 
178
class IEvaluation(Interface):
 
179
    """
 
180
    Entry type for evaluation statements.
 
181
    """
 
182
 
 
183
    data=Object(
 
184
        schema=IItemStructure,
 
185
        title=_(u"Data"),
 
186
        description=_(u"The data of this evaluation."),
 
187
 
 
188
    )
 
189
 
 
190
 
 
191
 
 
192
class IIsmTransition(Interface):
 
193
    """
 
194
    Model of a transition in the Instruction state machine.
 
195
    """
 
196
 
 
197
    currentState=Object(
 
198
        schema=IDvCodedText,
 
199
        title=_(u"Current State"),
 
200
        description=_(u"The ISM current state."),
 
201
 
 
202
    )
 
203
 
 
204
    transition=Object(
 
205
        schema=IDvCodedText,
 
206
        title=_(u"Transition"),
 
207
        description=_(u"The ISM transition which occured to arrive at the current state."),
 
208
        required=False,
 
209
    )
 
210
 
 
211
    careflowStep=Object(
 
212
        schema=IDvCodedText,
 
213
        title=_(u"Careflow Step"),
 
214
        description=_(u"The step in the careflow process which occured as part of this process."),
 
215
        required=False,
 
216
    )
 
217
 
 
218
 
 
219
 
 
220
class IEntry(Interface):
 
221
    u"""
 
222
        The abstract parent of all ENTRY subtypes. An ENTRY is the root of a logical item
 
223
        of "hard" clinical information created in the "clinical statement" context, within a
 
224
        clinical session. There can be numerous such contexts in a clinical session. Obser-
 
225
        vations and other Entry types only ever document information captured/created in
 
226
        the event documented by the enclosing Composition.
 
227
        An ENTRY is also the minimal unit of information any query should return, since a
 
228
        whole ENTRY (including subparts) records spatial structure, timing information,
 
229
        and contextual information, as well as the subject and generator of the informa-
 
230
        tion.
 
231
 
 
232
    """
 
233
 
 
234
    language = Object(
 
235
        schema=ICodePhrase,
 
236
        title = _(u"language"),
 
237
        description = _(u"""Mandatory indicator of the localised language in which this Entry
 
238
                      is written. Coded from openEHR Code Set "languages"."""),
 
239
        required = True
 
240
        )
 
241
 
 
242
    encoding = Object(
 
243
        schema=ICodePhrase,
 
244
        title = _(u"encoding"),
 
245
        description = _(u"""Name of character set in which text values in this Entry are encoded.
 
246
                      Coded from openEHR Code Set "character sets"."""),
 
247
        required = True
 
248
        )
 
249
 
 
250
 
 
251
    subject = Object(
 
252
        schema=IPartyProxy,
 
253
        title = _(u"subject"),
 
254
        description = _(u"""Id of human subject of this ENTRY, e.g.
 
255
                           organ donor, foetus, a family member
 
256
                           another clinically relevant person."""),
 
257
        required = True
 
258
        )
 
259
 
 
260
    provider = Object(
 
261
        schema=IPartyProxy,
 
262
        title = _(u"provider"),
 
263
        description = _(u"""Optional identification of provider of the information in this ENTRY, which might be:
 
264
                        the patient
 
265
                        a patient agent, e.g. parent, guardian
 
266
                        the clinician
 
267
                        a device or software
 
268
                       Generally only used when the recorder needs to make it explicit. Otherwise, Composition
 
269
                       composer and other participants are assumed. """),
 
270
        required = False
 
271
        )
 
272
 
 
273
    otherParticipations = List(
 
274
        title = _(u"otherParticipations"),
 
275
        description = _(u"""Other participations at ENTRY level."""),
 
276
        value_type=Object(schema=IParticipation),
 
277
        required = False
 
278
        )
 
279
 
 
280
    workflowId = Object(
 
281
        schema=IObjectRef,
 
282
        title = _(u"workflowId"),
 
283
        description = _(u"""Identifier of externally held workflow engine data for this
 
284
                      workflow execution, for this subject of care."""),
 
285
        required = False
 
286
        )
 
287
 
 
288
 
 
289
    def subectIsSelf():
 
290
        u"""Returns True if this Entry is about the subject of the EHR, in which case the
 
291
        subject attribute is of type PARTY_SELF. """
 
292
 
 
293
 
 
294
 
 
295
 
 
296
class IInstructionDetails(Interface):
 
297
    """
 
298
    Used to record the details of an Instruction causing an Action.
 
299
    """
 
300
 
 
301
    instructionId=Object(
 
302
        schema=ILocatableRef,
 
303
        title=_(u"Instruction Id"),
 
304
        description=_(u"Reference to causing Instruction."),
 
305
 
 
306
    )
 
307
 
 
308
    activityId=TextLine(
 
309
        title=_(u"Activity Id"),
 
310
        description=_(u"Indentifier of Activity within Instruction."),
 
311
        required=False,
 
312
    )
 
313
 
 
314
    wfDetails=Object(
 
315
        schema=IItemStructure,
 
316
        title=_(u"WF Details"),
 
317
        description=_(u"Various workflow engine state details."),
 
318
        required=False,
 
319
    )
 
320
 
 
321
 
 
322
 
 
323
 
 
324
class IAction(Interface):
 
325
    """
 
326
    Used to record a clinical action that has been performed.
 
327
    """
 
328
 
 
329
    time=Object(
 
330
        schema=IDvDateTime,
 
331
        title=_(u"Timing"),
 
332
        description=_(u"Point in time of completion of this action."),
 
333
    )
 
334
 
 
335
    description=Object(
 
336
        schema=IItemStructure,
 
337
        title=_(u"Description"),
 
338
        description=_(u"Description of the activity in ItemStructure form."),
 
339
    )
 
340
 
 
341
    ismTransition=Object(
 
342
        schema=IIsmTransition,
 
343
        title=_(u"ISM Transition"),
 
344
        description=_(u"Details of the transition of the Instruction state."),
 
345
    )
 
346
 
 
347
    instructionDetails=Object(
 
348
        schema=IInstructionDetails,
 
349
        title=_(u"Instruction Details"),
 
350
        description=_(u"Details of the Instruction causing this Action."),
 
351
        required=False,
 
352
    )
 
353
 
 
354
 
 
355
class IActivity(Interface):
 
356
    """
 
357
    A single activity within an instruction.
 
358
    """
 
359
 
 
360
    description=Object(
 
361
        schema=IItemStructure,
 
362
        title=_(u"Description"),
 
363
        description=_(u"Description of the activity."),
 
364
        required=True,
 
365
    )
 
366
 
 
367
    timing=Object(
 
368
        schema=IDvParsable,
 
369
        title=_(u"Timing"),
 
370
        description=_(u"Timing of the activity in a format such as ISO8601."),
 
371
        required=True,
 
372
    )
 
373
 
 
374
    actionArchetypeId=TextLine(
 
375
        title=_(u"Action ArchetypeId"),
 
376
        description=_(u"re pattern enclosed in '//' delimiters."),
 
377
        required=False,
 
378
    )
 
379
 
 
380
 
 
381
class IInstruction(Interface):
 
382
    """
 
383
    Used to specify future actions and includes a workflow form.
 
384
    """
 
385
 
 
386
    narrative=Object(
 
387
        schema=IDvText,
 
388
        title=_(u"Narrative"),
 
389
        description=_(u"Human readable version of the Instructions."),
 
390
        required=True
 
391
    )
 
392
 
 
393
    activities=List(
 
394
        value_type = Object(schema = IActivity),
 
395
        title=_(u"Activities"),
 
396
        description=_(u"List of all activities in the Instruction."),
 
397
        required=False,
 
398
    )
 
399
 
 
400
    expiryTime=Object(
 
401
        schema=IDvDateTime,
 
402
        title=_(u"Expiry Time"),
 
403
        description=_(u"Data/time when this Instruction can be assumed to have expired."),
 
404
        required=False,
 
405
    )
 
406
 
 
407
    wfDefinition=Object(
 
408
        schema=IDvParsable,
 
409
        title=_(u"Workflow Definition"),
 
410
        description=_(u"Workflow engine executable expression of the Instruction."),
 
411
        required=False,
 
412
    )
 
413
 
 
414
 
 
415
 
 
416
class IObservation(Interface):
 
417
    u"""Entry subtype for all clinical data in the past or present, i.e. which (by the time it
 
418
    is recorded) has already occurred. OBSERVATION data is expressed using the class
 
419
    HISTORY<T>, which guarantees that it is situated in time.
 
420
    OBSERVATION is used for all notionally objective (i.e. measured in some way)
 
421
    observations of phenomena, and patient-reported phenomena, e.g. pain.
 
422
    Not used for recording opinion or future statements of any kind, including instructions,
 
423
    intentions, plans etc."""
 
424
 
 
425
    data = Object(
 
426
        schema=IHistory,
 
427
        title=_(u"data"),
 
428
        description=_(u"""The data of this observation, in the form of a history of
 
429
                    values which may be of any complexity."""),
 
430
        required=True
 
431
    )
 
432
 
 
433
    state = Object(
 
434
        schema=IHistory,
 
435
        title=_(u"state"),
 
436
        description=_(u"""Optional recording of the state of subject of this
 
437
                    observation during the observation process, in the form of
 
438
                    a separate history of values which may be of any complexity.
 
439
                    State may also be recorded within the History of the data attribute."""),
 
440
        required=False
 
441
    )
 
442
 
 
443
    
 
444
class ISection(Interface):
 
445
    """
 
446
    Represents a heading in a heading structure or 'section tree'.
 
447
    """
 
448
 
 
449
    items=List(
 
450
        title=_(u"Items"),
 
451
        description=_(u"Ordered list of content items that may include more SECTIONs or ENTRYs."),
 
452
        value_type=Object(schema=IContentItem),
 
453
        required=False,
 
454
    )