~oship-dev/oshippy/trunk

« back to all changes in this revision

Viewing changes to src/mlhim/oship/rm/entity/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
 
 
18
class IAddress(Interface):
 
19
    """
 
20
    Address of contact.
 
21
    """
 
22
 
 
23
    details=Object(
 
24
        schema=IItemStructure,
 
25
        title=_(u"Details"),
 
26
        description=_(u"The details of the address."),
 
27
    )
 
28
 
 
29
    def type():
 
30
        """
 
31
        Return the type of address from 'name'.
 
32
        """
 
33
 
 
34
    def asString():
 
35
        """
 
36
        Address in the form of a string.
 
37
        """
 
38
 
 
39
 
 
40
 
 
41
class IPartyIdentity(Interface):
 
42
    """
 
43
    An identity owned by a party.
 
44
    """
 
45
 
 
46
    details=Object(
 
47
        schema=IItemStructure,
 
48
        title=_(u"Details"),
 
49
        description=_(u"The value of the identitiy"),
 
50
    )
 
51
 
 
52
    def asString():
 
53
        """
 
54
        Identity in the form of a string.
 
55
        """
 
56
 
 
57
    def purpose():
 
58
        """
 
59
        Purpose of Identity.
 
60
        Taken from value of inherited name attribute.
 
61
        """
 
62
 
 
63
 
 
64
class IContact(Interface):
 
65
    """
 
66
    Description of a means of contacting a party.
 
67
    """
 
68
 
 
69
    timeValidity=Object(
 
70
        schema=IDvInterval,
 
71
        title=_(u"Time Validity"),
 
72
        description=_(u"Valid time interval for this contact descriptor."),
 
73
        required=False,
 
74
    )
 
75
 
 
76
    addresses=List(
 
77
        value_type = Object(schema = IAddress),
 
78
        title=_(u"Addresses"),
 
79
        description=_(u"A set of addresses for this purpose and time frame."),
 
80
    )
 
81
 
 
82
    def purpose():
 
83
        """
 
84
        Purpose for which this contact is used.
 
85
        Taken from the inherited 'name' attribute.
 
86
        """
 
87
        return self.name
 
88
 
 
89
 
 
90
class IPartyRelationship(Interface):
 
91
    """
 
92
    Generic description of a relationship between parties.
 
93
    """
 
94
 
 
95
    uid=Object(
 
96
        schema=IUidBasedId,
 
97
        title=_(u"UID"),
 
98
        description=_(u"Identifier of this party."),
 
99
 
 
100
    )
 
101
 
 
102
    details=Object(
 
103
        schema=IItemStructure,
 
104
        title=_(u"Details"),
 
105
        description=(u"Description of the relationship."),
 
106
        required=False,
 
107
    )
 
108
 
 
109
    timeValidity=Object(
 
110
        schema=IDvInterval,
 
111
        title=_(u"Time Validity"),
 
112
        description=_(u"Valid time interval for this relationship."),
 
113
        required=False,
 
114
    )
 
115
 
 
116
    source=Object(
 
117
        schema=IPartyRef,
 
118
        title=_(u"Source"),
 
119
        description=_(u"Source of relationship."),
 
120
 
 
121
    )
 
122
 
 
123
    target=Object(
 
124
        schema=IPartyRef,
 
125
        title=_(u"Target"),
 
126
        description=_(u"Target of relationship."),
 
127
 
 
128
    )
 
129
 
 
130
    def type():
 
131
        """
 
132
        Type of relationship such as employment, authority, etc.
 
133
        """
 
134
 
 
135
 
 
136
class IParty(Interface):
 
137
    """
 
138
    Ancestor of all party types.
 
139
    """
 
140
 
 
141
    uid=Object(
 
142
        schema=IUidBasedId,
 
143
        title=_(u"UID"),
 
144
        description=_(u"Identifier of this party."),
 
145
    )
 
146
 
 
147
    identities=Set(
 
148
        title=_(u"Indentities"),
 
149
        description=_(u"Identities used by the party to identify itself."),
 
150
        value_type = Object(schema = IPartyIdentity))
 
151
 
 
152
    contacts=Set(
 
153
        title=_(u"Contacts"),
 
154
        description=_(u"Contacts for this party."),
 
155
        value_type = Object(schema = IContact))
 
156
 
 
157
    relationships=Set(
 
158
        title=_(u"Relationships"),
 
159
        description=_(u"Relationships in which this role takes part as"
 
160
                      " source."),
 
161
        required=False,
 
162
        value_type = Object(schema = IPartyRelationship))
 
163
 
 
164
    reverseRelationships=Set(
 
165
        title=_(u"Reverse Relationships"),
 
166
        description=_(u"Relationships in which this role takes part as source."),
 
167
        required=False,
 
168
        value_type = Object(schema = ILocatableRef))
 
169
 
 
170
    details=Object(
 
171
        schema=IItemStructure,
 
172
        title=_(u"Details"),
 
173
        description=_(u"All other party details."),
 
174
    )
 
175
 
 
176
    def type():
 
177
        """
 
178
        Return the type of party from the inherited 'name' attribute.
 
179
        """
 
180
 
 
181
 
 
182
 
 
183
class IActor(Interface):
 
184
    """
 
185
    Ancestor of all real world types.
 
186
    """
 
187
 
 
188
    roles=Set(
 
189
        title=_(u"Roles"),
 
190
        description=_(u"Identifiers of the Version container for "
 
191
                      "each Role played by this party."),
 
192
        required=False,
 
193
        value_type = Object(schema = IPartyRef))
 
194
 
 
195
    languages=List(
 
196
        title=_(u"Languages"),
 
197
        description=_(u"A list of languages to be used to communice"
 
198
                      " with this actor."),
 
199
        required=False,
 
200
        value_type = Object(schema = IDvText))
 
201
 
 
202
    def hasLegalIdentity():
 
203
        """
 
204
        Return True if there is an identity with purpose 'legal identity'
 
205
        """
 
206
 
 
207
 
 
208
 
 
209
class IAgent(IActor):
 
210
    """
 
211
    Generic concept of of any kind of agent including devices.
 
212
    """
 
213
    pass
 
214
 
 
215
class ICapability(Interface):
 
216
    """
 
217
    Capability of a role such as ehr modifier, healthcare provider, etc.
 
218
    """
 
219
 
 
220
    credentials=Object(
 
221
        schema=IItemStructure,
 
222
        title=_(u"Credentials"),
 
223
        description=_(u"Qualifications of the performer of the role."),
 
224
 
 
225
    )
 
226
 
 
227
    timeValidity=Object(
 
228
        schema=IDvInterval,
 
229
        title=_(u"Time Validity"),
 
230
        description=_(u"Valid time interval for the credentials of this capability."),
 
231
        required=False,
 
232
    )
 
233
class ICapability(Interface):
 
234
    """
 
235
    Capability of a role such as ehr modifier, healthcare provider, etc.
 
236
    """
 
237
 
 
238
    credentials=Object(
 
239
        schema=IItemStructure,
 
240
        title=_(u"Credentials"),
 
241
        description=_(u"Qualifications of the performer of the role."),
 
242
 
 
243
    )
 
244
 
 
245
    timeValidity=Object(
 
246
        schema=IDvInterval,
 
247
        title=_(u"Time Validity"),
 
248
        description=_(u"Valid time interval for the credentials of this capability."),
 
249
        required=False,
 
250
    )
 
251
class ICapability(Interface):
 
252
    """
 
253
    Capability of a role such as ehr modifier, healthcare provider, etc.
 
254
    """
 
255
 
 
256
    credentials=Object(
 
257
        schema=IItemStructure,
 
258
        title=_(u"Credentials"),
 
259
        description=_(u"Qualifications of the performer of the role."),
 
260
 
 
261
    )
 
262
 
 
263
    timeValidity=Object(
 
264
        schema=IDvInterval,
 
265
        title=_(u"Time Validity"),
 
266
        description=_(u"Valid time interval for the credentials of this capability."),
 
267
        required=False,
 
268
    )
 
269
class ICapability(Interface):
 
270
    """
 
271
    Capability of a role such as ehr modifier, healthcare provider, etc.
 
272
    """
 
273
 
 
274
    credentials=Object(
 
275
        schema=IItemStructure,
 
276
        title=_(u"Credentials"),
 
277
        description=_(u"Qualifications of the performer of the role."),
 
278
 
 
279
    )
 
280
 
 
281
    timeValidity=Object(
 
282
        schema=IDvInterval,
 
283
        title=_(u"Time Validity"),
 
284
        description=_(u"Valid time interval for the credentials of this capability."),
 
285
        required=False,
 
286
    )
 
287
 
 
288
 
 
289
 
 
290
class IGroup(IActor):
 
291
    """
 
292
    A real world group of parties.
 
293
    """
 
294
    pass
 
295
 
 
296
 
 
297
 
 
298
class IOrganisation(IActor):
 
299
    """
 
300
    Generic descriptions of organizations.
 
301
    """
 
302
    pass
 
303
 
 
304
 
 
305
 
 
306
class IPerson(IActor):
 
307
    """
 
308
    Generic description of of persons.  Provides a dedicated type to whicih Person archetypes can be targeted."),
 
309
    """
 
310
    pass
 
311
 
 
312
 
 
313
 
 
314
class IRole(Interface):
 
315
    """
 
316
    Generic role played by a party.
 
317
    """
 
318
 
 
319
    capabilities=List(
 
320
        title=_(u"Capabilities"),
 
321
        description=_(u"Capabilities of this role."),
 
322
        required=False,
 
323
        value_type = Object(schema = ICapability)
 
324
    )
 
325
 
 
326
    timeValidity=Object(
 
327
        schema=IDvInterval,
 
328
        title=_(u"Time Validity"),
 
329
        description=_(u"Valid time interval for this role."),
 
330
        required=False,
 
331
    )
 
332
 
 
333
    performer=Object(
 
334
        schema=IPartyRef,
 
335
        title=_(u"Performer"),
 
336
        description=_(u"Reference to Version container of Actor playing this role."),
 
337
    )
 
338
 
 
339
 
 
340
 
 
341
class ISearchableActor(Interface):
 
342
 
 
343
    relationships = Attribute("")
 
344
 
 
345
    reverse_relationships = Attribute("")
 
346
    legal_identity = Attribute("")