← Back to team overview

oship-dev team mailing list archive

[Merge] lp:~oship-dev/oship/mlhim into lp:oship

 

Tim Cook has proposed merging lp:~oship-dev/oship/mlhim into lp:oship.

Requested reviews:
  OSHIP Development Team (oship-dev)


Created mlhim namespace reference model as a mirror of openehr 1.0.2The attached diff has been truncated due to its size.
-- 
https://code.launchpad.net/~oship-dev/oship/mlhim/+merge/31923
Your team OSHIP Development Team is requested to review the proposed merge of lp:~oship-dev/oship/mlhim into lp:oship.
=== removed file 'src/oship/km/mlhim/clinical/cluster/device_v1.py'
--- src/oship/km/mlhim/clinical/cluster/device_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/mlhim/clinical/cluster/device_v1.py	1970-01-01 00:00:00 +0000
@@ -1,219 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class DeviceV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-CLUSTER.device.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Sam Heard', u'organisation', u'Ocean Informatics', u'email', u'sam.heard@xxxxxxxxxxxxxxxxxxxx', u'date', u'19/03/2008', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Record details of devices use in clinical care', u'use', u'Use to record the details pertaining to the device that is used to record clinical details.  This is likely to be as a nested archetype as part of a Protocol.', u'keywords', u'Device', u'Machine', u'Tool', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'other_details', u'references', u''] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{u'at0000':[_(u'text'),_(u'Device details'),_(u'description'),_(u'The details of the device used')],\
-        u'at0001':[_(u'text'),_(u'Name'),_(u'description'),_(u'The name of the device')],\
-        u'at0002':[_(u'text'),_(u'Description'),_(u'description'),_(u'Description of the device')],\
-        u'at0003':[_(u'text'),_(u'Manufacturer'),_(u'description'),_(u'The name of the manufacturer')],\
-        u'at0004':[_(u'text'),_(u'Manufacturer details'),_(u'description'),_(u'Information about the manufacture of the device')],\
-        u'at0005':[_(u'text'),_(u'Model'),_(u'description'),_(u'The model of the device')],\
-        u'at0006':[_(u'text'),_(u'Serial number'),_(u'description'),_(u'The serial number of the device')],\
-        u'at0007':[_(u'text'),_(u'Components'),_(u'description'),_(u'Information about the device components')],\
-        u'at0008':[_(u'text'),_(u'Servicing'),_(u'description'),_(u'Details of servicing')],\
-        u'at0009':[_(u'text'),_(u'Date last serviced'),_(u'description'),_(u'The date the device was last serviced')],\
-        u'at0010':[_(u'text'),_(u'Date last calibration'),_(u'description'),_(u'Date the device was last calibrated')],\
-        u'at0011':[_(u'text'),_(u'Serviced by'),_(u'description'),_(u'Agent performed the servicing')],\
-        u'at0012':[_(u'text'),_(u'Components'),_(u'description'),_()]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 144
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0011'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'yyyy-??-??T??:??:??'
-        #u'value'
-        #1
-        #u'..'
-        #1
-        DvDateTime(value)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0010'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'yyyy-??-??T??:??:??'
-        #u'value'
-        #1
-        #u'..'
-        #1
-        DvDateTime(value)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0009'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0008'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'exclude'
-        #u'/openEHR-EHR-CLUSTER\\.device\\.v1/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0012'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0007'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0006'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0003'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0004'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0002'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0001'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)

=== removed file 'src/oship/km/mlhim/clinical/cluster/level_of_exertion_v1.py'
--- src/oship/km/mlhim/clinical/cluster/level_of_exertion_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/mlhim/clinical/cluster/level_of_exertion_v1.py	1970-01-01 00:00:00 +0000
@@ -1,150 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class LevelOfExertionV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-CLUSTER.level_of_exertion.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Heather Leslie', u'organisation', u'Ocean Informatics', u'email', u'heather.leslie@xxxxxxxxxxxxxxxxxxxx', u'date', u'27/10/2008', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Record information about the amount of energy expenditure that has been, or is being, experienced by the patient', u'use', u'Record information about phase and levels of exertion - to provide state/context information within OBSERVATIONS such as Blood Pressure.', u'keywords', u'exercise', u'work', u'exertion', u'activity', u'energy', u'misuse', u'Not to be used to record actual exercise activities and measurements which should be recorded as OBSERVATIONS in their own right.', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'other_details', u'references', u''] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{        u'at0000':[_(u'text'),_(u'Level of Exertion'),_(u'description'),_(u'Record information about level of exertion')],\
-        u'at0005':[_(u'text'),_(u'Measured'),_(u'description'),_(u'The measured level of exertion')],\
-        u'at0006':[_(u'text'),_(u'At rest'),_(u'description'),_(u'The person is at rest, prior to undertaking exercise')],\
-        u'at0007':[_(u'text'),_(u'During exertion'),_(u'description'),_(u'The person is exerting themselves at the time')],\
-        u'at0008':[_(u'text'),_(u'Post-exertion'),_(u'description'),_(u'Measurement is taken after exertion has ceased')],\
-        u'at0009':[_(u'text'),_(u'Phase'),_(u'description'),_(u'The phase or context of exercise')],\
-        u'at0010':[_(u'text'),_(u'Exercise intensity'),_(u'description'),_(u'Amount of work being done during exercise')],\
-        u'at0011':[_(u'text'),_(u'Intensity'),_(u'description'),_(u'Semiquantitative description of the intensity of exercise undertaken')],\
-        u'at0012':[_(u'text'),_(u'Low Intensity'),_(u'description'),_(u'Up to 80% Maximal Heart Rate')],\
-        u'at0013':[_(u'text'),_(u'Medium Intensity '),_(u'description'),_(u'80-85% of Maximal Heart Rate')],\
-        u'at0014':[_(u'text'),_(u'High Intensity '),_(u'description'),_(u'85-90% Maximal Heart Rate')],\
-        u'at0015':[_(u'text'),_(u'Flat Out '),_(u'description'),_(u'90-100% Maximal Heart Rate')],\
-        u'at0016':[_(u'text'),_(u'Description'),_(u'description'),_()]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 82
-        #u'at0008'
-        #u'at0007'
-        #u'at0006'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0009'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #1000.0
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'J/min'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::130_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'at0015'
-        #u'at0014'
-        #u'at0013'
-        #u'at0012'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0011'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0016'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0010'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)

=== removed file 'src/oship/km/mlhim/clinical/composition/encounter_v1.py'
--- src/oship/km/mlhim/clinical/composition/encounter_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/mlhim/clinical/composition/encounter_v1.py	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-
-_ = MessageFactory('oship')
-
-class EncounterV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-COMPOSITION.encounter.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Thomas Beale', u'organisation', u'Ocean Informatics', u'date', u'2005-10-10', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Record of encounter as a progress note.', u'use', u'', u'keywords', u'progress', u'note', u'encounter', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors'] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{ u'at0000':[_(u'text'),_(u'Encounter'),_(u'description'),_(u'Generic encounter or progress note composition')]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 12
-        #u'433'
-        #u'openehr::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        defining_code = CodePhrase(TerminologyId('openehr'),'433')
-        DvCodedText(definingCode,value='',mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'category'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Composition(content,context,composer,category,lang,terr,uid,nodeid,name,atdetails,fdraudit,links)

=== removed file 'src/oship/km/mlhim/clinical/entry/observation/blood_pressure_v1.py'
--- src/oship/km/mlhim/clinical/entry/observation/blood_pressure_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/mlhim/clinical/entry/observation/blood_pressure_v1.py	1970-01-01 00:00:00 +0000
@@ -1,532 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class BloodPressureV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-OBSERVATION.blood_pressure.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Sam Heard', u'organisation', u'Ocean Informatics', u'email', u'sam.heard@xxxxxxxxxxxxxxxxxxxx', u'date', u'22/03/2006', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'To record the systemic arterial blood pressure of a person. ', u'use', u'All systemic arterial blood pressure measurements are recorded using this archetype. There is a rich state model, which can be used to support exercise/stress testing and research using tilt tables.', u'keywords', u'observations', u'measurement', u'bp', u'vital signs', u'mean arterial pressure', u'pulse pressure', u'systolic', u'diastolic', u'RR', u'NIBP', u'misuse', u'Not to be used for intravenous pressure.\r\nNot to be used for the recording of the measurement of arterial pressure specific locations such as the radial artery or brachial artery.\r\nUse OBSERVATION.intravascular_pressure and related specialisations in these situations.', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'ja', u'language', u'_ISO_639-1::ja_', u'purpose', u'*To record the systemic blood pressure of a person. The measurement records the systolic and the diastolic pressure by some means suitable for the result to be seen as a surrogate for the general and systemic blood pressure.(en)', u'use', u'*All blood pressure measurements are recorded using this archetype. There is a rich state model for use with exercise ECGs and Tilt Table measurements.(en)', u'keywords', u'*observations(en)', u'*blood pressure(en)', u'*measurement(en)', u'misuse', u'*Not to be used for intravascular pressure.(en)', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'de', u'language', u'_ISO_639-1::de_', u'purpose', u'Dient der Dokumentation des systemischen Blutdrucks einer Person. Die Messung zeichnet den systolischen und diastolischen Blutdruck auf geeignete Art und Weise auf, sodass das Resultat der Messung als charakteristisch f\xfcr den tats\xe4chlichen systemischen Blutdruck angesehen werden kann.', u'use', u'Alle Blutdruckmessungen werden unter Zuhilfenahme dieses Archetypen dokumentiert. Der Archetyp beinhaltet ein umfassendes Status-Modell z.B. bei Durchf\xfchrung von Belastungs-EKGs und Kipptischuntersuchungen.', u'misuse', u'Nicht zu Benutzen zur Dokumentation des intravaskul\xe4ren Drucks.', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'zh-cn', u'language', u'_ISO_639-1::zh-cn_', u'purpose', u'*To record the systemic blood pressure of a person. The measurement records the systolic and the diastolic pressure by some means suitable for the result to be seen as a surrogate for the general and systemic blood pressure.(en)', u'use', u'*All blood pressure measurements are recorded using this archetype. There is a rich state model for use with exercise ECGs and Tilt Table measurements.(en)', u'keywords', u'*observations(en)', u'*blood pressure(en)', u'*measurement(en)', u'misuse', u'*Not to be used for intravascular pressure.(en)', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'Heather Leslie, Ocean Informatics', u'Sundaresan Jagannathan, NHS Scotland', u'Sebastian Garde, Ocean Informatics', u'Jeroen Meintjens, Medisch Centrum Alkmaar, Netherlands', u'Pieter Hummel, Medisch Centrum Alkmaar, Netherlands', u'Melvin Reynolds, UK', u'Evelyn Hovenga, Australia', u'Ian McNicoll, Ocean Informatics, Scotland', u'Derek Hoy, Scotland', u'Anneke Goossen, Netherlands', u'Tony Shannon, NHS, UK', u'Rong Chen, Sweden', u'Beatriz De Faria Leao, Brazil', u'Knut Bernstein, Denmark', u'Eugene Igras, IRIS Systems, Canada', u'other_details', u'references', u'Cuff sizes:  Circulation (1993;88:2460-2467), by Dorothee Perloff,MD; Carlene Grim, MSN, SpDN; John Flack, MD; Edward D. Frohlich, MD; Martha Hill, PhD, RN; Mary McDonald, MSPH, RN; and Bruce Z. Morgenstern, MD, Writing Group'] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[u'SNOMED-CT',u'...',]
-
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{        u'at0000':[_(u'text'),_(u'Blood pressure'),_(u'description'),_(u'The measurement of arterial blood pressure which is a surrogate for arterial pressure in the systemic circulation.')],\
-        u'at0001':[_(u'text'),_(u'history'),_(u'description'),_(u'history Structural node')],\
-        u'at0003':[_(u'text'),_(u'blood pressure'),_(u'description'),_(u'@ internal @')],\
-        u'at0004':[_(u'text'),_(u'Systolic'),_(u'description'),_(u'Peak systemic arterial blood pressure over one cycle - measured in systolic or contraction phase of the heart cycle')],\
-        u'at0005':[_(u'text'),_(u'Diastolic'),_(u'description'),_(u'Minimum systemic arterial blood pressure over one cycle - measured in the diastolic or relaxation phase')],\
-        u'at0006':[_(u'text'),_(u'any event'),_(u'description'),_(u'Other event in event history')],\
-        u'at0007':[_(u'text'),_(u'state structure'),_(u'description'),_(u'@ internal @')],\
-        u'at0008':[_(u'text'),_(u'Position'),_(u'description'),_(u'The position of the person at the time of measurement')],\
-        u'at0011':[_(u'text'),_(u'list structure'),_(u'description'),_(u'list structure')],\
-        u'at0013':[_(u'text'),_(u'Cuff size'),_(u'description'),_(u'The size of the cuff used for blood pressure measurement')],\
-        u'at0014':[_(u'text'),_(u'Location of measurement'),_(u'description'),_(u'The site of the measurement of the blood pressure')],\
-        u'at0015':[_(u'text'),_(u'Adult'),_(u'description'),_(u'A cuff that is standard for an adult - bladder approx 13cm x 30cm')],\
-        u'at0016':[_(u'text'),_(u'Large Adult'),_(u'description'),_(u'A cuff for adults with larger arms - bladder approx 16cm x 38cm')],\
-        u'at0017':[_(u'text'),_(u'Paediatric/Child'),_(u'description'),_(u'A cuff that is appropriate for a child or thin arm - bladder approx 8cm x 21cm')],\
-        u'at0025':[_(u'text'),_(u'Right arm'),_(u'description'),_(u'The right arm of the person')],\
-        u'at0026':[_(u'text'),_(u'Left arm'),_(u'description'),_(u'The left arm of the person')],\
-        u'at0027':[_(u'text'),_(u'Right thigh'),_(u'description'),_(u'The right thigh of the person')],\
-        u'at0028':[_(u'text'),_(u'Left thigh'),_(u'description'),_(u'The left thigh of the person')],\
-        u'at0031':[_(u'text'),_(u'Postural change'),_(u'description'),_(u'The difference between standing and sitting/lying blood pressure')],\
-        u'at0033':[_(u'text'),_(u'Comment'),_(u'description'),_(u'Comment on blood pressure measurement')],\
-        u'at1000':[_(u'text'),_(u'Standing'),_(u'description'),_(u'Standing at the time of blood pressure measurement')],\
-        u'at1001':[_(u'text'),_(u'Sitting'),_(u'description'),_(u'Sitting (for example on bed or chair) at the time of blood pressure measurement')],\
-        u'at1002':[_(u'text'),_(u'Reclining'),_(u'description'),_(u'Reclining at the time of blood pressure measurement')],\
-        u'at1003':[_(u'text'),_(u'Lying'),_(u'description'),_(u'Lying flat at the time of blood pressure measurement')],\
-        u'at1004':[_(u'text'),_(u'Paradox'),_(u'description'),_(u'Variation in blood pressure with respiration')],\
-        u'at1005':[_(u'text'),_(u'Tilt'),_(u'description'),_(u'The craniocaudal tilt of the surface on which the person is lying at the time of measurement')],\
-        u'at1006':[_(u'text'),_(u'Mean Arterial Pressure'),_(u'description'),_(u'The average arterial pressure that occurs over the entire course of the heart contraction and relaxation cycle.   ')],\
-        u'at1007':[_(u'text'),_(u'Pulse Pressure'),_(u'description'),_(u'The difference between the systolic and diastolic pressure over one contraction cycle.')],\
-        u'at1008':[_(u'text'),_(u'Adult Thigh'),_(u'description'),_(u'A cuff used for an adult thigh - bladder approx 20cm x 42cm')],\
-        u'at1009':[_(u'text'),_(u'Neonatal'),_(u'description'),_(u'A cuff used for a new born - bladder approx 3cm x 6cm')],\
-        u'at1010':[_(u'text'),_(u'Korotkoff sounds'),_(u'description'),_(u'Record which Korotkoff sound is used for determining diastolic pressure')],\
-        u'at1011':[_(u'text'),_(u'Fourth sound'),_(u'description'),_(u'The fourth Korotkoff sound is identified as an abrupt muffling of sounds')],\
-        u'at1012':[_(u'text'),_(u'Fifth sound'),_(u'description'),_(u'The fifth Korotkoff sound is identified by absence of sounds as the cuff pressure drops below the diastolic blood pressure')],\
-        u'at1013':[_(u'text'),_(u'Trendelenburg'),_(u'description'),_(u'Lying flat on the back (supine position) with the feet higher than the head at the time of blood pressure measurement')],\
-        u'at1014':[_(u'text'),_(u'Left Lateral'),_(u'description'),_(u'Lying on the left side at the time of blood pressure measurement')],\
-        u'at1018':[_(u'text'),_(u'Infant'),_(u'description'),_(u'A cuff used for infants - bladder approx 5cm x 15cm')],\
-        u'at1019':[_(u'text'),_(u'Small Adult'),_(u'description'),_(u'A cuff used for a small adult - bladder approx 10cm x 24cm')],\
-        u'at1020':[_(u'text'),_(u'Right wrist'),_(u'description'),_(u'The right wrist of the person')],\
-        u'at1021':[_(u'text'),_(u'Left wrist'),_(u'description'),_(u'The left wrist of the person')],\
-        u'at1025':[_(u'text'),_(u'Device'),_(u'description'),_(u'Details about sphygmomanometer or other device used to measure the blood pressure')],\
-        u'at1026':[_(u'text'),_(u'Finger'),_(u'description'),_(u'A finger of the person')],\
-        u'at1030':[_(u'text'),_(u'Exertion  '),_(u'description'),_(u'Details about physical activity undertaken at the time of blood pressure measurement')],\
-        u'at1031':[_(u'text'),_(u'Right ankle'),_(u'description'),_(u'The right ankle of the person')],\
-        u'at1032':[_(u'text'),_(u'Left ankle'),_(u'description'),_(u'The left ankle of the person')],\
-        u'at1033':[_(u'text'),_(u'Location'),_(u'description'),_(u'Body site of blood pressure location')],\
-        u'at1034':[_(u'text'),_(u'Description of location'),_(u'description'),_(u'Detailed description about the site of the measurement of the blood pressure')],\
-        u'at1035':[_(u'text'),_(u'Method'),_(u'description'),_(u'Method of measurement of blood pressure')],\
-        u'at1036':[_(u'text'),_(u'Auscultation'),_(u'description'),_(u'Method of measuring blood pressure externally, using a stethoscope and Korotkoff sounds')],\
-        u'at1037':[_(u'text'),_(u'Palpation'),_(u'description'),_(u'Method of measuring blood pressure externally, using palpation (usually of the radial artery at the wrist)')],\
-        u'at1038':[_(u'text'),_(u'Mean Arterial Pressure Formula'),_(u'description'),_(u'Formula used to calculate the MAP (if recorded in data)')],\
-        u'at1039':[_(u'text'),_(u'Machine'),_(u'description'),_(u'Method of measuring blood pressure externally, using a blood pressure machine')],\
-        u'at1040':[_(u'text'),_(u'Invasive'),_(u'description'),_(u'Method of measuring blood pressure internally ie involving penetration of the skin and measuring inside blood vessels')],\
-        u'at1041':[_(u'text'),_(u'Anxiety '),_(u'description'),_(u"Details about the subject's level of anxiety at the time of blood pressure measurement")]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={u'SNOMED-CT':[{u'at0000':u'_SNOMED-CT(2003)::163020007_'},{u'at0004':u'_SNOMED-CT(2003)::163030003_'},{u'at0005':u'_SNOMED-CT(2003)::163031004_'},{u'at0013':u'_SNOMED-CT(2003)::246153002_'},]}
-
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 399
-        #u'at1012'
-        #u'at1011'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1010'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1038'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'exclude'
-        #u'/openEHR-EHR-CLUSTER\\.device\\.v1/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1025'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'at1040'
-        #u'at1039'
-        #u'at1037'
-        #u'at1036'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1035'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1034'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'at1032'
-        #u'at1031'
-        #u'at1026'
-        #u'at1021'
-        #u'at1020'
-        #u'at0028'
-        #u'at0027'
-        #u'at0026'
-        #u'at0025'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0014'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1033'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'at1019'
-        #u'at1018'
-        #u'at1009'
-        #u'at1008'
-        #u'at0017'
-        #u'at0016'
-        #u'at0015'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0013'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0011'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'protocol'
-        nodeid=u'at0001_/events_at0006_/state_at0007'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'state'
-        nodeid=u'at0001_/events_at0006_/data_at0003'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'data'
-        #u'149'
-        #u'openehr::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'math_function'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1004'
-        IntervalEvent(width,mfunc,scount)
-        nodeid=u'at0001_/events_at0006_/state_at0007'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'state'
-        nodeid=u'at0001_/events_at0006_/data_at0003'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'data'
-        #u'147'
-        #u'openehr::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'math_function'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0031'
-        IntervalEvent(width,mfunc,scount)
-        #0
-        #u'precision'
-        #u'\xb0'
-        #u'units'
-        #0.0
-        #u'magnitude'
-        #u'assumed_value'
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #90.0
-        #u'..'
-        #-90.0
-        #u'|'
-        #u'magnitude'
-        #u'\xb0'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::497_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'exclude'
-        #u'/.*/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1041'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'exclude'
-        #u'/openEHR-EHR-CLUSTER\\.level_of_exertion\\.v1/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1030'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'at1001'
-        #u'at1014'
-        #u'at1013'
-        #u'at1003'
-        #u'at1002'
-        #u'at1001'
-        #u'at1000'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0008'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0007'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'state'
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0033'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1007'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1006'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0004'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0003'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'data'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0006'
-        Event(time,data,state,parent,offset)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #1
-        #u'cardinality'
-        #u'events'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0001'
-        History(origin,events,period,duration,summary,uid,nodeid,name,atdetails,fdraudit,links)
-        #u'data'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Observation(data,state,nodeid,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)

=== removed file 'src/oship/km/mlhim/demographics/person_name_iso_v1.py'
--- src/oship/km/mlhim/demographics/person_name_iso_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/mlhim/demographics/person_name_iso_v1.py	1970-01-01 00:00:00 +0000
@@ -1,413 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class PersonNameIsoV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-DEMOGRAPHIC-PARTY_IDENTITY.person_name_iso.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Rigoleta Dutra & Sergio Miranda Freire', u'organisation', u'Universidade do Estado do Rio de Janeiro - UERJ', u'email', u'sergio@xxxxxxxxxxxxxxx', u'date', u'20/05/2009', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Representation of a personal name, based on ISO standards.', u'use', u'Used in demographic services to represent the names by which a person is known.', u'keywords', u'demographic service', u'person name', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'pt-br', u'language', u'_ISO_639-1::pt-br_', u'purpose', u'Representa\xe7\xe3o do nome de uma pessoa', u'use', u'Utilizado em servi\xe7os de demografia para representar os nomes que uma pessoa pode ter', u'keywords', u'servi\xe7o demogr\xe1fico', u'nome de uma pessoa', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'other_details', u'references', u'ISO/TS 22220:2008(E) - Identification of Subject of Care - Technical Specification- International Organization for Standardization.'] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section
-        termCodes={u'pt-br':{u'at0000':[_(u'text'),_(u'Nome da pessoa'),_(u'description'),_(u'Estrutura do nome de uma pessoa')],\
-        u'at0001':[_(u'text'),_(u'Componentes do nome'),_(u'description'),_(u'Componentes do nome da pessoa')],\
-        u'at0002':[_(u'text'),_(u'Grupo do nome atribu\xeddo'),_(u'description'),_(u'Grupo que consiste de um nome atribu\xeddo e a ordem dele no nome')],\
-        u'at0003':[_(u'text'),_(u'Grupo do sobrenome'),_(u'description'),_(u'Grupo que consiste de um sobrenome e a ordem dele no nome')],\
-        u'at0004':[_(u'text'),_(u'Grupo de t\xedtulo do nome'),_(u'description'),_(u'Grupo que consiste de um t\xedtulo do nome de uma pessoa e a ordem dele no nome')],\
-        u'at0005':[_(u'text'),_(u'Grupo de sufixo do nome'),_(u'description'),_(u'Grupo que consiste de um sufixo do nome de uma pessoa e a ordem dele no nome')],\
-        u'at0006':[_(u'text'),_(u'Grupo de utiliza\xe7\xe3o do nome'),_(u'description'),_(u'Grupo que descreve como este nome deve ser usado')],\
-        u'at0007':[_(u'text'),_(u'Representa\xe7\xe3o alternativa do nome'),_(u'description'),_(u'Grupo que descreve uma forma alternativa de representar o nome de uma pessoa')],\
-        u'at0008':[_(u'text'),_(u'Nome preferencial'),_(u'description'),_(u'Indica o nome pelo qual a pessoa prefere ser identificada')],\
-        u'at0009':[_(u'text'),_(u'Indicador de uso condicional'),_(u'description'),_(u'Um indicador das condi\xe7\xf5es espec\xedficas ou regras que devem ser aplicadas ao nome de uma pessoa')],\
-        u'at0010':[_(u'text'),_(u'Nome atribu\xeddo'),_(u'description'),_(u'O nome que identifica a pessoa no grupo familiar ou pelo qual ela \xe9 univocamente identificada socialmente')],\
-        u'at0011':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do nome atribu\xeddo'),_(u'description'),_(u'Um indicator da ordem de uso para os nomes atribu\xeddos')],\
-        u'at0012':[_(u'text'),_(u'Nome de fam\xedlia'),_(u'description'),_(u'A parte do nome que uma pessoa possui em comum com outros membros de sua fam\xedlia, distinta do(s) seu(s) nome(s) atribu\xeddo(s)')],\
-        u'at0013':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do sobrenome'),_(u'description'),_(u'Um indicator da ordem de uso para os sobrenomes')],\
-        u'at0014':[_(u'text'),_(u'T\xedtulo do nome'),_(u'description'),_(u'Uma forma honor\xedfica que inicia o nome, usada ao se referir a uma pessoa pelo nome, seja por correspond\xeancia ou por telefone, ou, dependendo da situa\xe7\xe3o cultural, pessoalmente')],\
-        u'at0015':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do t\xedtulo do nome'),_(u'description'),_(u'Um indicator da ordem de uso para os t\xedtulos do nome')],\
-        u'at0016':[_(u'text'),_(u'Sufixo do nome'),_(u'description'),_(u'Termo adicional usado ap\xf3s o nome da pessoa')],\
-        u'at0017':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do sufixo do nome'),_(u'description'),_(u'Um indicator da ordem de uso para os sufixos do nome')],\
-        u'at0018':[_(u'text'),_(u'Uso do nome'),_(u'description'),_(u'Uma classifica\xe7\xe3o que permite a diferencia\xe7\xe3o entre os usos do nome de uma pessoa. Um nome de um indiv\xedduo pode ter muitos usos')],\
-        u'at0019':[_(u'text'),_(u'Intervalo de utiliza\xe7\xe3o'),_(u'description'),_(u'O per\xedodo de tempo para o qual este uso do nome se aplica para o nome ao qual ele est\xe1 associado')],\
-        u'at0020':[_(u'text'),_(u'Identificador usado'),_(u'description'),_(u'A combina\xe7\xe3o do tipo de identificador, emissor do identificador e nome do identificador que especifica o v\xednculo entre este nome e o uso do identificador para relat\xf3rio, ou outros usos')],\
-        u'at0021':[_(u'text'),_(u'Uso da representa\xe7\xe3o'),_(u'description'),_(u'Nome da forma de representa\xe7\xe3o usada')],\
-        u'at0022':[_(u'text'),_(u'Representa\xe7\xe3o alternativa do nome'),_(u'description'),_(u'Representa\xe7\xe3o alternativa do nome desta pessoa usando estilos alternativos de representa\xe7\xe3o, tais como caracteres ou varia\xe7\xf5es do conjunto de caracteres do idioma para exibi\xe7\xe3o local')],\
-        u'at0023':[_(u'text'),_(u'Nome para relat\xf3rio'),_(u'description'),_(u'o nome do sujeito usado para relat\xf3rio, quando acompanhado por um identificador espec\xedfico')],\
-        u'at0024':[_(u'text'),_(u'Nome de rec\xe9m-nascido'),_(u'description'),_(u'tipo reservado para identifica\xe7\xe3o de rec\xe9m-nascidos sem nome')],\
-        u'at0025':[_(u'text'),_(u'Nome profissional ou comercial'),_(u'description'),_(u'o nome usado pela pessoa para prop\xf3sitos profissionais ou de neg\xf3cios')],\
-        u'at0026':[_(u'text'),_(u'Nome de solteiro(a)'),_(u'description'),_(u'o nome usado pela pessoa antes de se casar')],\
-        u'at0027':[_(u'text'),_(u'Nome legal'),_(u'description'),_(u'Nome registrado (legal) para a pessoa')],\
-        u'at0028':[_(u'text'),_(u'Outro nome'),_(u'description'),_(u'qualquer outro nome pelo qual o sujeito \xe9 conhecido, ou foi conhecido no passado')],\
-        u'at0031':[_(u'text'),_(u'Nome n\xe3o confi\xe1vel'),_(u'description'),_(u'indica que o nome registrado \xe9 um nome fict\xedcio ou parcial')],\
-        u'at0032':[_(u'text'),_(u'Escrito de forma errada'),_(u'description'),_(u'Este indicador permite ao usu\xe1rio indicar que h\xe1 um erro de digita\xe7\xe3o, mas que deve ser retido para um uso potencial na vincula\xe7\xe3o de registros')],\
-        u'at0033':[_(u'text'),_(u'Nome para n\xe3o ser usado'),_(u'description'),_(u'Indica que este nome n\xe3o deve ser usado ao se referir \xe0 pessoa')],\
-        u'at0034':[_(u'text'),_(u'V\xednculo do nome proibido por lei'),_(u'description'),_(u'indica que este nome e todos os nomes antes dele na seq\xfc\xeancia de nomes n\xe3o devem ser exibidos ou indicados de nenhum modo ao procurar por ou lidar com informa\xe7\xf5es e eventos associados com um nome que segue a este na seq\xfc\xeancia de nomes')],\
-        u'at0035':[_(u'text'),_(u'Requisito especial seguranca/privacidade'),_(u'description'),_(u'indica um nome para o qual epis\xf3dios s\xe3o vinculados e devem somente ser acessados por pessoas autorizadas')],\
-        u'at0036':[_(u'text'),_(u'Nome tempor\xe1rio'),_(u'description'),_(u'Indica que o nome da pessoa n\xe3o foi determinado')]}}
-
-        {u'en':{u'at0000':[_(u'text'),_(u'Person name'),_(u'description'),_(u'Person name details.')],\
-        u'at0001':[_(u'text'),_(u'Name'),_(u'description'),_(u'Components of a person name.')],\
-        u'at0002':[_(u'text'),_(u'Given names'),_(u'description'),_(u'Details of given names.')],\
-        u'at0003':[_(u'text'),_(u'Family names'),_(u'description'),_(u'Details of family names.')],\
-        u'at0004':[_(u'text'),_(u'Titles'),_(u'description'),_(u'Details of person titles.')],\
-        u'at0005':[_(u'text'),_(u'Suffixes'),_(u'description'),_(u'Details of person suffixes.')],\
-        u'at0006':[_(u'text'),_(u'Name usages'),_(u'description'),_(u'Details of person name usages.')],\
-        u'at0007':[_(u'text'),_(u'Alternative name repesentations'),_(u'description'),_(u'Details of alternative representations such as local codesets or language variations.')],\
-        u'at0008':[_(u'text'),_(u'Preferred name'),_(u'description'),_(u'Indicates that this is the name by which a person chooses to be identified.')],\
-        u'at0009':[_(u'text'),_(u'Specific issues'),_(u'description'),_(u'Specific issues that apply to use of the person name.')],\
-        u'at0010':[_(u'text'),_(u'Given name'),_(u'description'),_(u"The person's identifying name(s) within the family group or by which he/she is uniquely socially identified.")],\
-        u'at0011':[_(u'text'),_(u'Given name sequence number'),_(u'description'),_(u'The order of use for a Given name')],\
-        u'at0012':[_(u'text'),_(u'Family name'),_(u'description'),_(u'The part of a name a person usually has in common with some other members of his/her family, as distinguished from his/her given names.')],\
-        u'at0013':[_(u'text'),_(u'Family name sequence number'),_(u'description'),_(u'An indicator of the order of use for a Family name.')],\
-        u'at0014':[_(u'text'),_(u'Title'),_(u'description'),_(u'An honorific form of address commencing a name, used when addressing a person by name, whether by mail, by phone, or depending upon cultural situation in person.')],\
-        u'at0015':[_(u'text'),_(u'Title sequence number'),_(u'description'),_(u'An indicator of the order of use for the name Title.')],\
-        u'at0016':[_(u'text'),_(u'Suffix'),_(u'description'),_(u'Additional term used following a person name.')],\
-        u'at0017':[_(u'text'),_(u'Suffix sequence number'),_(u'description'),_(u'An indicator of the order of use for the name Suffix')],\
-        u'at0018':[_(u'text'),_(u'Name usage'),_(u'description'),_(u'A classification that enables differentiation between the usage of names for a person. An individual name may have many name uses')],\
-        u'at0019':[_(u'text'),_(u'Usage interval'),_(u'description'),_(u'The period of time for which this name usage applies.')],\
-        u'at0020':[_(u'text'),_(u'Usage identifier'),_(u'description'),_(u'The combination of identifier type, identifier issuer and identifier name that specify the link between this name and reporting or other unique identifier usage.')],\
-        u'at0021':[_(u'text'),_(u'Representation usage'),_(u'description'),_(u'Name of the representational form used.')],\
-        u'at0022':[_(u'text'),_(u'Alternative representation'),_(u'description'),_(u'Alternative Representation of this subject of care name using alternative styles of representation such as characters or language character set variations for local display.')],\
-        u'at0023':[_(u'text'),_(u'Reporting name'),_(u'description'),_(u'The subject\u2019s name as it is to be used for reporting, when used with a specific identifier.')],\
-        u'at0024':[_(u'text'),_(u'Newborn name'),_(u'description'),_(u'A type reserved for the identification of unnamed newborn babies.')],\
-        u'at0025':[_(u'text'),_(u'Professional or business name'),_(u'description'),_(u'The name used by the subject for business or professional purposes.')],\
-        u'at0026':[_(u'text'),_(u'Maiden name'),_(u'description'),_(u'The name used by the subject of care prior to marriage.')],\
-        u'at0027':[_(u'text'),_(u'Legal name'),_(u'description'),_(u'Registered name (Legal name).')],\
-        u'at0028':[_(u'text'),_(u'Other name'),_(u'description'),_(u'Any other name by which the subject is known, or has been known by in the past.')],\
-        u'at0031':[_(u'text'),_(u'Unreliable information'),_(u'description'),_(u'The name recorded is a fictitious or partial name.')],\
-        u'at0032':[_(u'text'),_(u'Known misspelling'),_(u'description'),_(u'This is a misspelling, but should be retained for potential future matching.')],\
-        u'at0033':[_(u'text'),_(u'Name not to be used'),_(u'description'),_(u'This name should not be used when referring to this subject.')],\
-        u'at0034':[_(u'text'),_(u'Name linkage forbidden by law'),_(u'description'),_(u'By Law, this name and all names prior to it in the name sequence are not to be displayed or indicated in any way when searching for or dealing with information and events associated with a name that is subsequent to this one in the name sequence.')],\
-        u'at0035':[_(u'text'),_(u'Special privacy/security requirements'),_(u'description'),_(u'A name for which episodes are attached that should only be accessible to specified authorised persons.')],\
-        u'at0036':[_(u'text'),_(u'Temporary name'),_(u'description'),_()]}}
-
-        # Constraint Code Section
-        constCodes={u'pt-br':{u'ac0000':[u'text',u'T\xedtulos',u'description',u'Termos como Doutor, Mestre, ....'],\
-        u'ac0001':[u'text',u'Sufixos',u'description',u'Sufixos do nome \u2013 neto, neta, junior, ...'],\
-        u'ac0002':[u'text',u'C\xf3digos para o idioma de representa\xe7\xe3o',u'description',u'idiomas para a representa\xe7\xe3o alternativa do nome']}},\
-        {u'en':{u'ac0000':[u'text',u'Titles',u'description',u'Terms like Dr, Prof, Rev etc used as an honorific form of addressing a person.'],\
-        u'ac0001':[u'text',u'Suffixes',u'description',u'Terms like Jr, PhD used after the name.'],\
-        u'ac0002':[u'text',u'Language code',u'description',]}}
-
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 264
-        #u'at0036'
-        #u'at0035'
-        #u'at0034'
-        #u'at0033'
-        #u'at0032'
-        #u'at0031'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0009'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvBoolean(value)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0008'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0022'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'_ac0002_'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0021'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #u'*'
-        #u'..'
-        #1
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0007'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0020'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        #u'DV_INTERVAL<DV_DATE>'
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0019'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'at0028'
-        #u'at0027'
-        #u'at0026'
-        #u'at0025'
-        #u'at0024'
-        #u'at0023'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0018'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #3
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0006'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0017'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'_ac0001_'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0016'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0015'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'_ac0000_'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0014'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0004'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0013'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0012'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0003'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0011'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0010'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0002'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'ordered'
-        #u'*'
-        #u'..'
-        #1
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0001'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'details'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        #u'PARTY_IDENTITY'

=== removed file 'src/oship/km/openehr/demographics/person_name_iso_v1.py'
--- src/oship/km/openehr/demographics/person_name_iso_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/openehr/demographics/person_name_iso_v1.py	1970-01-01 00:00:00 +0000
@@ -1,413 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class PersonNameIsoV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-DEMOGRAPHIC-PARTY_IDENTITY.person_name_iso.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Rigoleta Dutra & Sergio Miranda Freire', u'organisation', u'Universidade do Estado do Rio de Janeiro - UERJ', u'email', u'sergio@xxxxxxxxxxxxxxx', u'date', u'20/05/2009', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Representation of a personal name, based on ISO standards.', u'use', u'Used in demographic services to represent the names by which a person is known.', u'keywords', u'demographic service', u'person name', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'pt-br', u'language', u'_ISO_639-1::pt-br_', u'purpose', u'Representa\xe7\xe3o do nome de uma pessoa', u'use', u'Utilizado em servi\xe7os de demografia para representar os nomes que uma pessoa pode ter', u'keywords', u'servi\xe7o demogr\xe1fico', u'nome de uma pessoa', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'other_details', u'references', u'ISO/TS 22220:2008(E) - Identification of Subject of Care - Technical Specification- International Organization for Standardization.'] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section
-        termCodes={u'pt-br':{u'at0000':[_(u'text'),_(u'Nome da pessoa'),_(u'description'),_(u'Estrutura do nome de uma pessoa')],\
-        u'at0001':[_(u'text'),_(u'Componentes do nome'),_(u'description'),_(u'Componentes do nome da pessoa')],\
-        u'at0002':[_(u'text'),_(u'Grupo do nome atribu\xeddo'),_(u'description'),_(u'Grupo que consiste de um nome atribu\xeddo e a ordem dele no nome')],\
-        u'at0003':[_(u'text'),_(u'Grupo do sobrenome'),_(u'description'),_(u'Grupo que consiste de um sobrenome e a ordem dele no nome')],\
-        u'at0004':[_(u'text'),_(u'Grupo de t\xedtulo do nome'),_(u'description'),_(u'Grupo que consiste de um t\xedtulo do nome de uma pessoa e a ordem dele no nome')],\
-        u'at0005':[_(u'text'),_(u'Grupo de sufixo do nome'),_(u'description'),_(u'Grupo que consiste de um sufixo do nome de uma pessoa e a ordem dele no nome')],\
-        u'at0006':[_(u'text'),_(u'Grupo de utiliza\xe7\xe3o do nome'),_(u'description'),_(u'Grupo que descreve como este nome deve ser usado')],\
-        u'at0007':[_(u'text'),_(u'Representa\xe7\xe3o alternativa do nome'),_(u'description'),_(u'Grupo que descreve uma forma alternativa de representar o nome de uma pessoa')],\
-        u'at0008':[_(u'text'),_(u'Nome preferencial'),_(u'description'),_(u'Indica o nome pelo qual a pessoa prefere ser identificada')],\
-        u'at0009':[_(u'text'),_(u'Indicador de uso condicional'),_(u'description'),_(u'Um indicador das condi\xe7\xf5es espec\xedficas ou regras que devem ser aplicadas ao nome de uma pessoa')],\
-        u'at0010':[_(u'text'),_(u'Nome atribu\xeddo'),_(u'description'),_(u'O nome que identifica a pessoa no grupo familiar ou pelo qual ela \xe9 univocamente identificada socialmente')],\
-        u'at0011':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do nome atribu\xeddo'),_(u'description'),_(u'Um indicator da ordem de uso para os nomes atribu\xeddos')],\
-        u'at0012':[_(u'text'),_(u'Nome de fam\xedlia'),_(u'description'),_(u'A parte do nome que uma pessoa possui em comum com outros membros de sua fam\xedlia, distinta do(s) seu(s) nome(s) atribu\xeddo(s)')],\
-        u'at0013':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do sobrenome'),_(u'description'),_(u'Um indicator da ordem de uso para os sobrenomes')],\
-        u'at0014':[_(u'text'),_(u'T\xedtulo do nome'),_(u'description'),_(u'Uma forma honor\xedfica que inicia o nome, usada ao se referir a uma pessoa pelo nome, seja por correspond\xeancia ou por telefone, ou, dependendo da situa\xe7\xe3o cultural, pessoalmente')],\
-        u'at0015':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do t\xedtulo do nome'),_(u'description'),_(u'Um indicator da ordem de uso para os t\xedtulos do nome')],\
-        u'at0016':[_(u'text'),_(u'Sufixo do nome'),_(u'description'),_(u'Termo adicional usado ap\xf3s o nome da pessoa')],\
-        u'at0017':[_(u'text'),_(u'N\xfamero de seq\xfc\xeancia do sufixo do nome'),_(u'description'),_(u'Um indicator da ordem de uso para os sufixos do nome')],\
-        u'at0018':[_(u'text'),_(u'Uso do nome'),_(u'description'),_(u'Uma classifica\xe7\xe3o que permite a diferencia\xe7\xe3o entre os usos do nome de uma pessoa. Um nome de um indiv\xedduo pode ter muitos usos')],\
-        u'at0019':[_(u'text'),_(u'Intervalo de utiliza\xe7\xe3o'),_(u'description'),_(u'O per\xedodo de tempo para o qual este uso do nome se aplica para o nome ao qual ele est\xe1 associado')],\
-        u'at0020':[_(u'text'),_(u'Identificador usado'),_(u'description'),_(u'A combina\xe7\xe3o do tipo de identificador, emissor do identificador e nome do identificador que especifica o v\xednculo entre este nome e o uso do identificador para relat\xf3rio, ou outros usos')],\
-        u'at0021':[_(u'text'),_(u'Uso da representa\xe7\xe3o'),_(u'description'),_(u'Nome da forma de representa\xe7\xe3o usada')],\
-        u'at0022':[_(u'text'),_(u'Representa\xe7\xe3o alternativa do nome'),_(u'description'),_(u'Representa\xe7\xe3o alternativa do nome desta pessoa usando estilos alternativos de representa\xe7\xe3o, tais como caracteres ou varia\xe7\xf5es do conjunto de caracteres do idioma para exibi\xe7\xe3o local')],\
-        u'at0023':[_(u'text'),_(u'Nome para relat\xf3rio'),_(u'description'),_(u'o nome do sujeito usado para relat\xf3rio, quando acompanhado por um identificador espec\xedfico')],\
-        u'at0024':[_(u'text'),_(u'Nome de rec\xe9m-nascido'),_(u'description'),_(u'tipo reservado para identifica\xe7\xe3o de rec\xe9m-nascidos sem nome')],\
-        u'at0025':[_(u'text'),_(u'Nome profissional ou comercial'),_(u'description'),_(u'o nome usado pela pessoa para prop\xf3sitos profissionais ou de neg\xf3cios')],\
-        u'at0026':[_(u'text'),_(u'Nome de solteiro(a)'),_(u'description'),_(u'o nome usado pela pessoa antes de se casar')],\
-        u'at0027':[_(u'text'),_(u'Nome legal'),_(u'description'),_(u'Nome registrado (legal) para a pessoa')],\
-        u'at0028':[_(u'text'),_(u'Outro nome'),_(u'description'),_(u'qualquer outro nome pelo qual o sujeito \xe9 conhecido, ou foi conhecido no passado')],\
-        u'at0031':[_(u'text'),_(u'Nome n\xe3o confi\xe1vel'),_(u'description'),_(u'indica que o nome registrado \xe9 um nome fict\xedcio ou parcial')],\
-        u'at0032':[_(u'text'),_(u'Escrito de forma errada'),_(u'description'),_(u'Este indicador permite ao usu\xe1rio indicar que h\xe1 um erro de digita\xe7\xe3o, mas que deve ser retido para um uso potencial na vincula\xe7\xe3o de registros')],\
-        u'at0033':[_(u'text'),_(u'Nome para n\xe3o ser usado'),_(u'description'),_(u'Indica que este nome n\xe3o deve ser usado ao se referir \xe0 pessoa')],\
-        u'at0034':[_(u'text'),_(u'V\xednculo do nome proibido por lei'),_(u'description'),_(u'indica que este nome e todos os nomes antes dele na seq\xfc\xeancia de nomes n\xe3o devem ser exibidos ou indicados de nenhum modo ao procurar por ou lidar com informa\xe7\xf5es e eventos associados com um nome que segue a este na seq\xfc\xeancia de nomes')],\
-        u'at0035':[_(u'text'),_(u'Requisito especial seguranca/privacidade'),_(u'description'),_(u'indica um nome para o qual epis\xf3dios s\xe3o vinculados e devem somente ser acessados por pessoas autorizadas')],\
-        u'at0036':[_(u'text'),_(u'Nome tempor\xe1rio'),_(u'description'),_(u'Indica que o nome da pessoa n\xe3o foi determinado')]}}
-
-        {u'en':{u'at0000':[_(u'text'),_(u'Person name'),_(u'description'),_(u'Person name details.')],\
-        u'at0001':[_(u'text'),_(u'Name'),_(u'description'),_(u'Components of a person name.')],\
-        u'at0002':[_(u'text'),_(u'Given names'),_(u'description'),_(u'Details of given names.')],\
-        u'at0003':[_(u'text'),_(u'Family names'),_(u'description'),_(u'Details of family names.')],\
-        u'at0004':[_(u'text'),_(u'Titles'),_(u'description'),_(u'Details of person titles.')],\
-        u'at0005':[_(u'text'),_(u'Suffixes'),_(u'description'),_(u'Details of person suffixes.')],\
-        u'at0006':[_(u'text'),_(u'Name usages'),_(u'description'),_(u'Details of person name usages.')],\
-        u'at0007':[_(u'text'),_(u'Alternative name repesentations'),_(u'description'),_(u'Details of alternative representations such as local codesets or language variations.')],\
-        u'at0008':[_(u'text'),_(u'Preferred name'),_(u'description'),_(u'Indicates that this is the name by which a person chooses to be identified.')],\
-        u'at0009':[_(u'text'),_(u'Specific issues'),_(u'description'),_(u'Specific issues that apply to use of the person name.')],\
-        u'at0010':[_(u'text'),_(u'Given name'),_(u'description'),_(u"The person's identifying name(s) within the family group or by which he/she is uniquely socially identified.")],\
-        u'at0011':[_(u'text'),_(u'Given name sequence number'),_(u'description'),_(u'The order of use for a Given name')],\
-        u'at0012':[_(u'text'),_(u'Family name'),_(u'description'),_(u'The part of a name a person usually has in common with some other members of his/her family, as distinguished from his/her given names.')],\
-        u'at0013':[_(u'text'),_(u'Family name sequence number'),_(u'description'),_(u'An indicator of the order of use for a Family name.')],\
-        u'at0014':[_(u'text'),_(u'Title'),_(u'description'),_(u'An honorific form of address commencing a name, used when addressing a person by name, whether by mail, by phone, or depending upon cultural situation in person.')],\
-        u'at0015':[_(u'text'),_(u'Title sequence number'),_(u'description'),_(u'An indicator of the order of use for the name Title.')],\
-        u'at0016':[_(u'text'),_(u'Suffix'),_(u'description'),_(u'Additional term used following a person name.')],\
-        u'at0017':[_(u'text'),_(u'Suffix sequence number'),_(u'description'),_(u'An indicator of the order of use for the name Suffix')],\
-        u'at0018':[_(u'text'),_(u'Name usage'),_(u'description'),_(u'A classification that enables differentiation between the usage of names for a person. An individual name may have many name uses')],\
-        u'at0019':[_(u'text'),_(u'Usage interval'),_(u'description'),_(u'The period of time for which this name usage applies.')],\
-        u'at0020':[_(u'text'),_(u'Usage identifier'),_(u'description'),_(u'The combination of identifier type, identifier issuer and identifier name that specify the link between this name and reporting or other unique identifier usage.')],\
-        u'at0021':[_(u'text'),_(u'Representation usage'),_(u'description'),_(u'Name of the representational form used.')],\
-        u'at0022':[_(u'text'),_(u'Alternative representation'),_(u'description'),_(u'Alternative Representation of this subject of care name using alternative styles of representation such as characters or language character set variations for local display.')],\
-        u'at0023':[_(u'text'),_(u'Reporting name'),_(u'description'),_(u'The subject\u2019s name as it is to be used for reporting, when used with a specific identifier.')],\
-        u'at0024':[_(u'text'),_(u'Newborn name'),_(u'description'),_(u'A type reserved for the identification of unnamed newborn babies.')],\
-        u'at0025':[_(u'text'),_(u'Professional or business name'),_(u'description'),_(u'The name used by the subject for business or professional purposes.')],\
-        u'at0026':[_(u'text'),_(u'Maiden name'),_(u'description'),_(u'The name used by the subject of care prior to marriage.')],\
-        u'at0027':[_(u'text'),_(u'Legal name'),_(u'description'),_(u'Registered name (Legal name).')],\
-        u'at0028':[_(u'text'),_(u'Other name'),_(u'description'),_(u'Any other name by which the subject is known, or has been known by in the past.')],\
-        u'at0031':[_(u'text'),_(u'Unreliable information'),_(u'description'),_(u'The name recorded is a fictitious or partial name.')],\
-        u'at0032':[_(u'text'),_(u'Known misspelling'),_(u'description'),_(u'This is a misspelling, but should be retained for potential future matching.')],\
-        u'at0033':[_(u'text'),_(u'Name not to be used'),_(u'description'),_(u'This name should not be used when referring to this subject.')],\
-        u'at0034':[_(u'text'),_(u'Name linkage forbidden by law'),_(u'description'),_(u'By Law, this name and all names prior to it in the name sequence are not to be displayed or indicated in any way when searching for or dealing with information and events associated with a name that is subsequent to this one in the name sequence.')],\
-        u'at0035':[_(u'text'),_(u'Special privacy/security requirements'),_(u'description'),_(u'A name for which episodes are attached that should only be accessible to specified authorised persons.')],\
-        u'at0036':[_(u'text'),_(u'Temporary name'),_(u'description'),_()]}}
-
-        # Constraint Code Section
-        constCodes={u'pt-br':{u'ac0000':[u'text',u'T\xedtulos',u'description',u'Termos como Doutor, Mestre, ....'],\
-        u'ac0001':[u'text',u'Sufixos',u'description',u'Sufixos do nome \u2013 neto, neta, junior, ...'],\
-        u'ac0002':[u'text',u'C\xf3digos para o idioma de representa\xe7\xe3o',u'description',u'idiomas para a representa\xe7\xe3o alternativa do nome']}},\
-        {u'en':{u'ac0000':[u'text',u'Titles',u'description',u'Terms like Dr, Prof, Rev etc used as an honorific form of addressing a person.'],\
-        u'ac0001':[u'text',u'Suffixes',u'description',u'Terms like Jr, PhD used after the name.'],\
-        u'ac0002':[u'text',u'Language code',u'description',]}}
-
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 264
-        #u'at0036'
-        #u'at0035'
-        #u'at0034'
-        #u'at0033'
-        #u'at0032'
-        #u'at0031'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0009'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvBoolean(value)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0008'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0022'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'_ac0002_'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0021'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #u'*'
-        #u'..'
-        #1
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0007'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0020'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        #u'DV_INTERVAL<DV_DATE>'
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0019'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'at0028'
-        #u'at0027'
-        #u'at0026'
-        #u'at0025'
-        #u'at0024'
-        #u'at0023'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0018'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #3
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0006'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0017'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'_ac0001_'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0016'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0015'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'_ac0000_'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0014'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0004'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0013'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0012'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0003'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0011'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #1
-        #u'occurrences'
-        nodeid=u'at0010'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'ordered'
-        #2
-        #u'..'
-        #2
-        #u'cardinality'
-        #u'items'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0002'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'ordered'
-        #u'*'
-        #u'..'
-        #1
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0001'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'details'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        #u'PARTY_IDENTITY'

=== removed file 'src/oship/km/openehr/ehr/cluster/device_v1.py'
--- src/oship/km/openehr/ehr/cluster/device_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/openehr/ehr/cluster/device_v1.py	1970-01-01 00:00:00 +0000
@@ -1,219 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class DeviceV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-CLUSTER.device.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Sam Heard', u'organisation', u'Ocean Informatics', u'email', u'sam.heard@xxxxxxxxxxxxxxxxxxxx', u'date', u'19/03/2008', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Record details of devices use in clinical care', u'use', u'Use to record the details pertaining to the device that is used to record clinical details.  This is likely to be as a nested archetype as part of a Protocol.', u'keywords', u'Device', u'Machine', u'Tool', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'other_details', u'references', u''] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{u'at0000':[_(u'text'),_(u'Device details'),_(u'description'),_(u'The details of the device used')],\
-        u'at0001':[_(u'text'),_(u'Name'),_(u'description'),_(u'The name of the device')],\
-        u'at0002':[_(u'text'),_(u'Description'),_(u'description'),_(u'Description of the device')],\
-        u'at0003':[_(u'text'),_(u'Manufacturer'),_(u'description'),_(u'The name of the manufacturer')],\
-        u'at0004':[_(u'text'),_(u'Manufacturer details'),_(u'description'),_(u'Information about the manufacture of the device')],\
-        u'at0005':[_(u'text'),_(u'Model'),_(u'description'),_(u'The model of the device')],\
-        u'at0006':[_(u'text'),_(u'Serial number'),_(u'description'),_(u'The serial number of the device')],\
-        u'at0007':[_(u'text'),_(u'Components'),_(u'description'),_(u'Information about the device components')],\
-        u'at0008':[_(u'text'),_(u'Servicing'),_(u'description'),_(u'Details of servicing')],\
-        u'at0009':[_(u'text'),_(u'Date last serviced'),_(u'description'),_(u'The date the device was last serviced')],\
-        u'at0010':[_(u'text'),_(u'Date last calibration'),_(u'description'),_(u'Date the device was last calibrated')],\
-        u'at0011':[_(u'text'),_(u'Serviced by'),_(u'description'),_(u'Agent performed the servicing')],\
-        u'at0012':[_(u'text'),_(u'Components'),_(u'description'),_()]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 144
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0011'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'yyyy-??-??T??:??:??'
-        #u'value'
-        #1
-        #u'..'
-        #1
-        DvDateTime(value)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0010'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'yyyy-??-??T??:??:??'
-        #u'value'
-        #1
-        #u'..'
-        #1
-        DvDateTime(value)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0009'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0008'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'exclude'
-        #u'/openEHR-EHR-CLUSTER\\.device\\.v1/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0012'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0007'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0006'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0003'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0004'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0002'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0001'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)

=== removed file 'src/oship/km/openehr/ehr/cluster/level_of_exertion_v1.py'
--- src/oship/km/openehr/ehr/cluster/level_of_exertion_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/openehr/ehr/cluster/level_of_exertion_v1.py	1970-01-01 00:00:00 +0000
@@ -1,150 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class LevelOfExertionV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-CLUSTER.level_of_exertion.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Heather Leslie', u'organisation', u'Ocean Informatics', u'email', u'heather.leslie@xxxxxxxxxxxxxxxxxxxx', u'date', u'27/10/2008', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Record information about the amount of energy expenditure that has been, or is being, experienced by the patient', u'use', u'Record information about phase and levels of exertion - to provide state/context information within OBSERVATIONS such as Blood Pressure.', u'keywords', u'exercise', u'work', u'exertion', u'activity', u'energy', u'misuse', u'Not to be used to record actual exercise activities and measurements which should be recorded as OBSERVATIONS in their own right.', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'other_details', u'references', u''] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{        u'at0000':[_(u'text'),_(u'Level of Exertion'),_(u'description'),_(u'Record information about level of exertion')],\
-        u'at0005':[_(u'text'),_(u'Measured'),_(u'description'),_(u'The measured level of exertion')],\
-        u'at0006':[_(u'text'),_(u'At rest'),_(u'description'),_(u'The person is at rest, prior to undertaking exercise')],\
-        u'at0007':[_(u'text'),_(u'During exertion'),_(u'description'),_(u'The person is exerting themselves at the time')],\
-        u'at0008':[_(u'text'),_(u'Post-exertion'),_(u'description'),_(u'Measurement is taken after exertion has ceased')],\
-        u'at0009':[_(u'text'),_(u'Phase'),_(u'description'),_(u'The phase or context of exercise')],\
-        u'at0010':[_(u'text'),_(u'Exercise intensity'),_(u'description'),_(u'Amount of work being done during exercise')],\
-        u'at0011':[_(u'text'),_(u'Intensity'),_(u'description'),_(u'Semiquantitative description of the intensity of exercise undertaken')],\
-        u'at0012':[_(u'text'),_(u'Low Intensity'),_(u'description'),_(u'Up to 80% Maximal Heart Rate')],\
-        u'at0013':[_(u'text'),_(u'Medium Intensity '),_(u'description'),_(u'80-85% of Maximal Heart Rate')],\
-        u'at0014':[_(u'text'),_(u'High Intensity '),_(u'description'),_(u'85-90% Maximal Heart Rate')],\
-        u'at0015':[_(u'text'),_(u'Flat Out '),_(u'description'),_(u'90-100% Maximal Heart Rate')],\
-        u'at0016':[_(u'text'),_(u'Description'),_(u'description'),_()]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 82
-        #u'at0008'
-        #u'at0007'
-        #u'at0006'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0009'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #1000.0
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'J/min'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::130_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'at0015'
-        #u'at0014'
-        #u'at0013'
-        #u'at0012'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0011'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0016'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0010'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)

=== removed file 'src/oship/km/openehr/ehr/composition/encounter_v1.py'
--- src/oship/km/openehr/ehr/composition/encounter_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/openehr/ehr/composition/encounter_v1.py	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-
-_ = MessageFactory('oship')
-
-class EncounterV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-COMPOSITION.encounter.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Thomas Beale', u'organisation', u'Ocean Informatics', u'date', u'2005-10-10', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'Record of encounter as a progress note.', u'use', u'', u'keywords', u'progress', u'note', u'encounter', u'misuse', u'', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors'] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[]
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{ u'at0000':[_(u'text'),_(u'Encounter'),_(u'description'),_(u'Generic encounter or progress note composition')]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={}
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 12
-        #u'433'
-        #u'openehr::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        defining_code = CodePhrase(TerminologyId('openehr'),'433')
-        DvCodedText(definingCode,value='',mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'category'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Composition(content,context,composer,category,lang,terr,uid,nodeid,name,atdetails,fdraudit,links)

=== removed file 'src/oship/km/openehr/ehr/entry/observation/blood_pressure_v1.py'
--- src/oship/km/openehr/ehr/entry/observation/blood_pressure_v1.py	2010-08-02 02:06:04 +0000
+++ src/oship/km/openehr/ehr/entry/observation/blood_pressure_v1.py	1970-01-01 00:00:00 +0000
@@ -1,532 +0,0 @@
-#This file was created with atbldr module from the OSHIP project.
-#Its quality is not guaranteed and will need hand editing, especially the definition section before use.
-
-import grok
-import datetime
-from zope.i18nmessageid import MessageFactory
-from oship.openehr.archetype import *
-from oship.openehr.demographic import *
-from oship.openehr.extract import *
-from oship.openehr.integration import *
-from oship.openehr.openehrprofile import *
-from oship.openehr.sm import *
-
-_ = MessageFactory('oship')
-
-class BloodPressureV1(Archetype):
-
-    grok.implements(IArchetype)
-
-    def __init__(self):
-        self.adlVersion =u'1.4'
-        self.archetypeId = ArchetypeId(ObjectId(u'openEHR-EHR-OBSERVATION.blood_pressure.v1'))
-        self.concept = u'at0000'
-        self.parentArchetypeId=ArchetypeId(ObjectId(u''))
-
-        # Create the description components.
-        self.originalLanguage=CodePhrase(u'ISO_639-1',u'en')
-        self.translationDetails=None # needs to be completed in atbldr
-        self.description=[u'original_author', u'name', u'Sam Heard', u'organisation', u'Ocean Informatics', u'email', u'sam.heard@xxxxxxxxxxxxxxxxxxxx', u'date', u'22/03/2006', u'details', u'en', u'language', u'_ISO_639-1::en_', u'purpose', u'To record the systemic arterial blood pressure of a person. ', u'use', u'All systemic arterial blood pressure measurements are recorded using this archetype. There is a rich state model, which can be used to support exercise/stress testing and research using tilt tables.', u'keywords', u'observations', u'measurement', u'bp', u'vital signs', u'mean arterial pressure', u'pulse pressure', u'systolic', u'diastolic', u'RR', u'NIBP', u'misuse', u'Not to be used for intravenous pressure.\r\nNot to be used for the recording of the measurement of arterial pressure specific locations such as the radial artery or brachial artery.\r\nUse OBSERVATION.intravascular_pressure and related specialisations in these situations.', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'ja', u'language', u'_ISO_639-1::ja_', u'purpose', u'*To record the systemic blood pressure of a person. The measurement records the systolic and the diastolic pressure by some means suitable for the result to be seen as a surrogate for the general and systemic blood pressure.(en)', u'use', u'*All blood pressure measurements are recorded using this archetype. There is a rich state model for use with exercise ECGs and Tilt Table measurements.(en)', u'keywords', u'*observations(en)', u'*blood pressure(en)', u'*measurement(en)', u'misuse', u'*Not to be used for intravascular pressure.(en)', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'de', u'language', u'_ISO_639-1::de_', u'purpose', u'Dient der Dokumentation des systemischen Blutdrucks einer Person. Die Messung zeichnet den systolischen und diastolischen Blutdruck auf geeignete Art und Weise auf, sodass das Resultat der Messung als charakteristisch f\xfcr den tats\xe4chlichen systemischen Blutdruck angesehen werden kann.', u'use', u'Alle Blutdruckmessungen werden unter Zuhilfenahme dieses Archetypen dokumentiert. Der Archetyp beinhaltet ein umfassendes Status-Modell z.B. bei Durchf\xfchrung von Belastungs-EKGs und Kipptischuntersuchungen.', u'misuse', u'Nicht zu Benutzen zur Dokumentation des intravaskul\xe4ren Drucks.', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'zh-cn', u'language', u'_ISO_639-1::zh-cn_', u'purpose', u'*To record the systemic blood pressure of a person. The measurement records the systolic and the diastolic pressure by some means suitable for the result to be seen as a surrogate for the general and systemic blood pressure.(en)', u'use', u'*All blood pressure measurements are recorded using this archetype. There is a rich state model for use with exercise ECGs and Tilt Table measurements.(en)', u'keywords', u'*observations(en)', u'*blood pressure(en)', u'*measurement(en)', u'misuse', u'*Not to be used for intravascular pressure.(en)', u'copyright', u'copyright (c) 2009 openEHR Foundation', u'lifecycle_state', u'AuthorDraft', u'other_contributors', u'Heather Leslie, Ocean Informatics', u'Sundaresan Jagannathan, NHS Scotland', u'Sebastian Garde, Ocean Informatics', u'Jeroen Meintjens, Medisch Centrum Alkmaar, Netherlands', u'Pieter Hummel, Medisch Centrum Alkmaar, Netherlands', u'Melvin Reynolds, UK', u'Evelyn Hovenga, Australia', u'Ian McNicoll, Ocean Informatics, Scotland', u'Derek Hoy, Scotland', u'Anneke Goossen, Netherlands', u'Tony Shannon, NHS, UK', u'Rong Chen, Sweden', u'Beatriz De Faria Leao, Brazil', u'Knut Bernstein, Denmark', u'Eugene Igras, IRIS Systems, Canada', u'other_details', u'references', u'Cuff sizes:  Circulation (1993;88:2460-2467), by Dorothee Perloff,MD; Carlene Grim, MSN, SpDN; John Flack, MD; Edward D. Frohlich, MD; Martha Hill, PhD, RN; Mary McDonald, MSPH, RN; and Bruce Z. Morgenstern, MD, Writing Group'] # needs to be completed in atbldr
-        self.revisionHistory=None # needs to be completed in atbldr
-        self.isControlled=False # needs to be completed in atbldr
-
-        # Create the ontology.
-
-        # Terminologies Available Section
-        termAvail=[u'SNOMED-CT',u'...',]
-
-        # Term Code Section (note that there is a bug in atbldr that always cutsoff the last description of termCodes)
-        termCodes={u'en':{        u'at0000':[_(u'text'),_(u'Blood pressure'),_(u'description'),_(u'The measurement of arterial blood pressure which is a surrogate for arterial pressure in the systemic circulation.')],\
-        u'at0001':[_(u'text'),_(u'history'),_(u'description'),_(u'history Structural node')],\
-        u'at0003':[_(u'text'),_(u'blood pressure'),_(u'description'),_(u'@ internal @')],\
-        u'at0004':[_(u'text'),_(u'Systolic'),_(u'description'),_(u'Peak systemic arterial blood pressure over one cycle - measured in systolic or contraction phase of the heart cycle')],\
-        u'at0005':[_(u'text'),_(u'Diastolic'),_(u'description'),_(u'Minimum systemic arterial blood pressure over one cycle - measured in the diastolic or relaxation phase')],\
-        u'at0006':[_(u'text'),_(u'any event'),_(u'description'),_(u'Other event in event history')],\
-        u'at0007':[_(u'text'),_(u'state structure'),_(u'description'),_(u'@ internal @')],\
-        u'at0008':[_(u'text'),_(u'Position'),_(u'description'),_(u'The position of the person at the time of measurement')],\
-        u'at0011':[_(u'text'),_(u'list structure'),_(u'description'),_(u'list structure')],\
-        u'at0013':[_(u'text'),_(u'Cuff size'),_(u'description'),_(u'The size of the cuff used for blood pressure measurement')],\
-        u'at0014':[_(u'text'),_(u'Location of measurement'),_(u'description'),_(u'The site of the measurement of the blood pressure')],\
-        u'at0015':[_(u'text'),_(u'Adult'),_(u'description'),_(u'A cuff that is standard for an adult - bladder approx 13cm x 30cm')],\
-        u'at0016':[_(u'text'),_(u'Large Adult'),_(u'description'),_(u'A cuff for adults with larger arms - bladder approx 16cm x 38cm')],\
-        u'at0017':[_(u'text'),_(u'Paediatric/Child'),_(u'description'),_(u'A cuff that is appropriate for a child or thin arm - bladder approx 8cm x 21cm')],\
-        u'at0025':[_(u'text'),_(u'Right arm'),_(u'description'),_(u'The right arm of the person')],\
-        u'at0026':[_(u'text'),_(u'Left arm'),_(u'description'),_(u'The left arm of the person')],\
-        u'at0027':[_(u'text'),_(u'Right thigh'),_(u'description'),_(u'The right thigh of the person')],\
-        u'at0028':[_(u'text'),_(u'Left thigh'),_(u'description'),_(u'The left thigh of the person')],\
-        u'at0031':[_(u'text'),_(u'Postural change'),_(u'description'),_(u'The difference between standing and sitting/lying blood pressure')],\
-        u'at0033':[_(u'text'),_(u'Comment'),_(u'description'),_(u'Comment on blood pressure measurement')],\
-        u'at1000':[_(u'text'),_(u'Standing'),_(u'description'),_(u'Standing at the time of blood pressure measurement')],\
-        u'at1001':[_(u'text'),_(u'Sitting'),_(u'description'),_(u'Sitting (for example on bed or chair) at the time of blood pressure measurement')],\
-        u'at1002':[_(u'text'),_(u'Reclining'),_(u'description'),_(u'Reclining at the time of blood pressure measurement')],\
-        u'at1003':[_(u'text'),_(u'Lying'),_(u'description'),_(u'Lying flat at the time of blood pressure measurement')],\
-        u'at1004':[_(u'text'),_(u'Paradox'),_(u'description'),_(u'Variation in blood pressure with respiration')],\
-        u'at1005':[_(u'text'),_(u'Tilt'),_(u'description'),_(u'The craniocaudal tilt of the surface on which the person is lying at the time of measurement')],\
-        u'at1006':[_(u'text'),_(u'Mean Arterial Pressure'),_(u'description'),_(u'The average arterial pressure that occurs over the entire course of the heart contraction and relaxation cycle.   ')],\
-        u'at1007':[_(u'text'),_(u'Pulse Pressure'),_(u'description'),_(u'The difference between the systolic and diastolic pressure over one contraction cycle.')],\
-        u'at1008':[_(u'text'),_(u'Adult Thigh'),_(u'description'),_(u'A cuff used for an adult thigh - bladder approx 20cm x 42cm')],\
-        u'at1009':[_(u'text'),_(u'Neonatal'),_(u'description'),_(u'A cuff used for a new born - bladder approx 3cm x 6cm')],\
-        u'at1010':[_(u'text'),_(u'Korotkoff sounds'),_(u'description'),_(u'Record which Korotkoff sound is used for determining diastolic pressure')],\
-        u'at1011':[_(u'text'),_(u'Fourth sound'),_(u'description'),_(u'The fourth Korotkoff sound is identified as an abrupt muffling of sounds')],\
-        u'at1012':[_(u'text'),_(u'Fifth sound'),_(u'description'),_(u'The fifth Korotkoff sound is identified by absence of sounds as the cuff pressure drops below the diastolic blood pressure')],\
-        u'at1013':[_(u'text'),_(u'Trendelenburg'),_(u'description'),_(u'Lying flat on the back (supine position) with the feet higher than the head at the time of blood pressure measurement')],\
-        u'at1014':[_(u'text'),_(u'Left Lateral'),_(u'description'),_(u'Lying on the left side at the time of blood pressure measurement')],\
-        u'at1018':[_(u'text'),_(u'Infant'),_(u'description'),_(u'A cuff used for infants - bladder approx 5cm x 15cm')],\
-        u'at1019':[_(u'text'),_(u'Small Adult'),_(u'description'),_(u'A cuff used for a small adult - bladder approx 10cm x 24cm')],\
-        u'at1020':[_(u'text'),_(u'Right wrist'),_(u'description'),_(u'The right wrist of the person')],\
-        u'at1021':[_(u'text'),_(u'Left wrist'),_(u'description'),_(u'The left wrist of the person')],\
-        u'at1025':[_(u'text'),_(u'Device'),_(u'description'),_(u'Details about sphygmomanometer or other device used to measure the blood pressure')],\
-        u'at1026':[_(u'text'),_(u'Finger'),_(u'description'),_(u'A finger of the person')],\
-        u'at1030':[_(u'text'),_(u'Exertion  '),_(u'description'),_(u'Details about physical activity undertaken at the time of blood pressure measurement')],\
-        u'at1031':[_(u'text'),_(u'Right ankle'),_(u'description'),_(u'The right ankle of the person')],\
-        u'at1032':[_(u'text'),_(u'Left ankle'),_(u'description'),_(u'The left ankle of the person')],\
-        u'at1033':[_(u'text'),_(u'Location'),_(u'description'),_(u'Body site of blood pressure location')],\
-        u'at1034':[_(u'text'),_(u'Description of location'),_(u'description'),_(u'Detailed description about the site of the measurement of the blood pressure')],\
-        u'at1035':[_(u'text'),_(u'Method'),_(u'description'),_(u'Method of measurement of blood pressure')],\
-        u'at1036':[_(u'text'),_(u'Auscultation'),_(u'description'),_(u'Method of measuring blood pressure externally, using a stethoscope and Korotkoff sounds')],\
-        u'at1037':[_(u'text'),_(u'Palpation'),_(u'description'),_(u'Method of measuring blood pressure externally, using palpation (usually of the radial artery at the wrist)')],\
-        u'at1038':[_(u'text'),_(u'Mean Arterial Pressure Formula'),_(u'description'),_(u'Formula used to calculate the MAP (if recorded in data)')],\
-        u'at1039':[_(u'text'),_(u'Machine'),_(u'description'),_(u'Method of measuring blood pressure externally, using a blood pressure machine')],\
-        u'at1040':[_(u'text'),_(u'Invasive'),_(u'description'),_(u'Method of measuring blood pressure internally ie involving penetration of the skin and measuring inside blood vessels')],\
-        u'at1041':[_(u'text'),_(u'Anxiety '),_(u'description'),_(u"Details about the subject's level of anxiety at the time of blood pressure measurement")]}}
-
-        # Constraint Code Section
-        constCodes={}
-        # Term Binding Section
-        term_binding={u'SNOMED-CT':[{u'at0000':u'_SNOMED-CT(2003)::163020007_'},{u'at0004':u'_SNOMED-CT(2003)::163030003_'},{u'at0005':u'_SNOMED-CT(2003)::163031004_'},{u'at0013':u'_SNOMED-CT(2003)::246153002_'},]}
-
-        # Constraint Binding Section
-        constraint_binding={}
-        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)
-
-        # Definition Section Begins Here. We build it from the leaf nodes up.
-
-        #Length of DefinList= 399
-        #u'at1012'
-        #u'at1011'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1010'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1038'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'exclude'
-        #u'/openEHR-EHR-CLUSTER\\.device\\.v1/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1025'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'at1040'
-        #u'at1039'
-        #u'at1037'
-        #u'at1036'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1035'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1034'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'at1032'
-        #u'at1031'
-        #u'at1026'
-        #u'at1021'
-        #u'at1020'
-        #u'at0028'
-        #u'at0027'
-        #u'at0026'
-        #u'at0025'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0014'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1033'
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'at1019'
-        #u'at1018'
-        #u'at1009'
-        #u'at1008'
-        #u'at0017'
-        #u'at0016'
-        #u'at0015'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0013'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0011'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'protocol'
-        nodeid=u'at0001_/events_at0006_/state_at0007'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'state'
-        nodeid=u'at0001_/events_at0006_/data_at0003'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'data'
-        #u'149'
-        #u'openehr::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'math_function'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1004'
-        IntervalEvent(width,mfunc,scount)
-        nodeid=u'at0001_/events_at0006_/state_at0007'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'state'
-        nodeid=u'at0001_/events_at0006_/data_at0003'
-        #u'/data'
-        #1
-        #u'..'
-        #1
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'use_node'
-        #u'data'
-        #u'147'
-        #u'openehr::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'math_function'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0031'
-        IntervalEvent(width,mfunc,scount)
-        #0
-        #u'precision'
-        #u'\xb0'
-        #u'units'
-        #0.0
-        #u'magnitude'
-        #u'assumed_value'
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #90.0
-        #u'..'
-        #-90.0
-        #u'|'
-        #u'magnitude'
-        #u'\xb0'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::497_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'exclude'
-        #u'/.*/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1041'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'exclude'
-        #u'/openEHR-EHR-CLUSTER\\.level_of_exertion\\.v1/'
-        #u'archetype_id/value'
-        #u'include'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1030'
-        #u''
-        Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)
-        #u'allow_archetype'
-        #u'at1001'
-        #u'at1014'
-        #u'at1013'
-        #u'at1003'
-        #u'at1002'
-        #u'at1001'
-        #u'at1000'
-        #u'local::'
-        #u'defining_code'
-        #1
-        #u'..'
-        #1
-        DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0008'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0007'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'state'
-        #u'*'
-        #1
-        #u'..'
-        #1
-        DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0033'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1007'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at1006'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0005'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'|'
-        #0
-        #u'|'
-        #u'precision'
-        #u'|'
-        #1000.0
-        #u'<'
-        #u'..'
-        #0.0
-        #u'|'
-        #u'magnitude'
-        #u'mm_Hg_'
-        #u'units'
-        #u'"1"'
-        #u'list'
-        #u'_openehr::125_'
-        #u'property'
-        CDvQuantity(list,property)
-        #u'value'
-        #1
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0004'
-        Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #0
-        #u'cardinality'
-        #u'items'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0003'
-        ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)
-        #u'data'
-        #u'*'
-        #u'..'
-        #0
-        #u'occurrences'
-        nodeid=u'at0006'
-        Event(time,data,state,parent,offset)
-        #u'unordered'
-        #u'*'
-        #u'..'
-        #1
-        #u'cardinality'
-        #u'events'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0001'
-        History(origin,events,period,duration,summary,uid,nodeid,name,atdetails,fdraudit,links)
-        #u'data'
-        #1
-        #u'..'
-        #1
-        nodeid=u'at0000'
-        self.definition=Observation(data,state,nodeid,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)

=== added directory 'src/oship/mlhim'
=== added file 'src/oship/mlhim/__init__.py'
--- src/oship/mlhim/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,1 @@
+# This is a package
\ No newline at end of file

=== added file 'src/oship/mlhim/__init__.pyc'
Binary files src/oship/mlhim/__init__.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/__init__.pyc	2010-08-06 02:59:44 +0000 differ
=== added directory 'src/oship/mlhim/adl'
=== added file 'src/oship/mlhim/adl/openEHR-DEMOGRAPHIC-PARTY_IDENTITY.person_name_iso.v1.adl'
--- src/oship/mlhim/adl/openEHR-DEMOGRAPHIC-PARTY_IDENTITY.person_name_iso.v1.adl	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl/openEHR-DEMOGRAPHIC-PARTY_IDENTITY.person_name_iso.v1.adl	2010-08-06 02:59:44 +0000
@@ -0,0 +1,510 @@
+archetype (adl_version=1.4)
+	openEHR-DEMOGRAPHIC-PARTY_IDENTITY.person_name_iso.v1
+
+concept
+	[at0000]	-- Nome da pessoa
+language
+	original_language = <[ISO_639-1::pt-br]>
+	translations = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			author = <
+				["name"] = <"Sergio Miranda Freire">
+				["organisation"] = <"Universidade do Estado do Rio de Janeiro - UERJ">
+				["email"] = <"sergio@xxxxxxxxxxxxxxx">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Rigoleta Dutra & Sergio Miranda Freire">
+		["organisation"] = <"Universidade do Estado do Rio de Janeiro - UERJ">
+		["email"] = <"sergio@xxxxxxxxxxxxxxx">
+		["date"] = <"20/05/2009">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Representation of a personal name, based on ISO standards.">
+			use = <"Used in demographic services to represent the names by which a person is known.">
+			keywords = <"demographic service", "person name">
+			misuse = <"">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+		["pt-br"] = <
+			language = <[ISO_639-1::pt-br]>
+			purpose = <"Representação do nome de uma pessoa">
+			use = <"Utilizado em serviços de demografia para representar os nomes que uma pessoa pode ter">
+			keywords = <"serviço demográfico", "nome de uma pessoa">
+			misuse = <"">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+	other_details = <
+		["references"] = <"ISO/TS 22220:2008(E) - Identification of Subject of Care - Technical Specification- International Organization for Standardization.">
+	>
+
+definition
+    PARTY_IDENTITY[at0000] matches {  -- Person name
+        details matches {
+            ITEM_TREE[at0001] occurrences matches {0..1} matches {  -- name components
+                items cardinality matches {1..*; ordered} matches {
+                    CLUSTER[at0002] occurrences matches {0..*} matches {  -- Given Name Group
+                        items cardinality matches {2..2; ordered} matches {
+                            ELEMENT[at0010] occurrences matches {1..1} matches {  -- Given Name
+                                value matches {
+                                    DV_TEXT matches {*}  
+                                }
+                            }
+                            ELEMENT[at0011] occurrences matches {1..1} matches {  -- Given Name Sequence Number
+                                value matches {
+                                    DV_COUNT matches {*} 
+                                }
+                            }
+                        }
+                    }
+                    CLUSTER[at0003] occurrences matches {1..*} matches {  -- Family Name Group
+                        items cardinality matches {2..2; ordered} matches {
+                            ELEMENT[at0012] occurrences matches {1..1} matches {  -- Family Name
+                                value matches {
+                                    DV_TEXT matches {*} 
+                                }
+                            }
+                            ELEMENT[at0013] occurrences matches {1..1} matches {  -- Family Name Sequence Number
+                                value matches {
+                                    DV_COUNT matches {*} 
+				}
+                            }
+                        }
+                    }
+                    CLUSTER[at0004] occurrences matches {0..*} matches {  -- Title Group
+                        items cardinality matches {2..2; ordered} matches {
+                            ELEMENT[at0014] occurrences matches {1..1} matches {  -- Name Title
+                                value matches {
+                                    DV_CODED_TEXT matches {  -- 
+                                        defining_code matches {[ac0000]}
+                                    }
+                                }
+                            }
+                            ELEMENT[at0015] occurrences matches {1..1} matches {  -- Title Sequence Number
+                                value matches {
+                                    DV_COUNT matches {*} 
+                                }
+                            }
+                        }
+                    }
+                    CLUSTER[at0005] occurrences matches {0..*} matches {  -- Suffix group
+                        items cardinality matches {2..2; ordered} matches {
+                            ELEMENT[at0016] occurrences matches {1..1} matches {  -- Name Suffix
+                                value matches {
+                                    DV_CODED_TEXT matches {  
+                                        defining_code matches {[ac0001]}
+                                    }
+                                }
+                            }
+                            ELEMENT[at0017] occurrences matches {1..1} matches {  -- Suffix Sequence Number
+                                value matches {
+                                    DV_COUNT matches {*}  -- 
+                                }
+                            }
+                        }
+                    }
+                    CLUSTER[at0006] occurrences matches {1..*} matches {  -- Name Usage Group
+                        items cardinality matches {2..3; ordered} matches {
+                            ELEMENT[at0018] occurrences matches {1..1} matches {  -- Name Usage
+                                value matches {
+                                    DV_CODED_TEXT matches {   
+                                        defining_code matches {
+                                            [local::
+                                            at0023,
+                                            at0024,
+                                            at0025,
+                                            at0026,
+                                            at0027,
+                                            at0028]
+                                        }
+                                    }
+                                }
+                            }
+                            ELEMENT[at0019] occurrences matches {1..1} matches {  -- Usage Interval
+                                value matches {
+                                    DV_INTERVAL<DV_DATE> matches {*}  
+                                }
+                            }
+                            ELEMENT[at0020] occurrences matches {0..1} matches {  -- usage Identifier
+                                value matches {
+                                    DV_TEXT matches {*} 
+                                }
+                            }
+                        }
+                    }
+                    CLUSTER[at0007] occurrences matches {0..1} matches {  -- Alternative Name Representation
+                        items cardinality matches {1..*; ordered} matches {
+                            ELEMENT[at0021] occurrences matches {1..1} matches {  -- Representation usage
+                                value matches {
+                                    DV_CODED_TEXT matches {  
+                                        defining_code matches {[ac0002]}
+                                    }
+                                }
+                            }
+                            ELEMENT[at0022] occurrences matches {1..1} matches {  -- Alternative representation
+                                value matches {
+                                    DV_TEXT matches {*} 
+                                }
+                            }
+                        }
+                    }
+                    ELEMENT[at0008] occurrences matches {1..1} matches {  -- Preferred name
+                        value matches {
+                            DV_BOOLEAN matches {*} 
+                        }
+                    }
+                    ELEMENT[at0009] occurrences matches {0..1} matches {  -- Conditional use
+                        value matches {
+                            DV_CODED_TEXT matches { 
+                                defining_code matches {
+                                    [local::
+                                    at0031,
+                                    at0032,
+                                    at0033,
+                                    at0034,
+                                    at0035,
+                                    at0036]
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
+
+ontology
+	term_definitions = <
+		["pt-br"] = <
+			items = <
+				["at0000"] = <
+					text = <"Nome da pessoa">
+					description = <"Estrutura do nome de uma pessoa">
+				>
+				["at0001"] = <
+					text = <"Componentes do nome">
+					description = <"Componentes do nome da pessoa">
+				>
+				["at0002"] = <
+					text = <"Grupo do nome atribuído">
+					description = <"Grupo que consiste de um nome atribuído e a ordem dele no nome">
+				>
+				["at0003"] = <
+					text = <"Grupo do sobrenome">
+					description = <"Grupo que consiste de um sobrenome e a ordem dele no nome">
+				>
+				["at0004"] = <
+					text = <"Grupo de título do nome">
+					description = <"Grupo que consiste de um título do nome de uma pessoa e a ordem dele no nome">
+				>
+				["at0005"] = <
+					text = <"Grupo de sufixo do nome">
+					description = <"Grupo que consiste de um sufixo do nome de uma pessoa e a ordem dele no nome">
+				>
+				["at0006"] = <
+					text = <"Grupo de utilização do nome">
+					description = <"Grupo que descreve como este nome deve ser usado">
+				>
+				["at0007"] = <
+					text = <"Representação alternativa do nome">
+					description = <"Grupo que descreve uma forma alternativa de representar o nome de uma pessoa">
+				>
+				["at0008"] = <
+					text = <"Nome preferencial">
+					description = <"Indica o nome pelo qual a pessoa prefere ser identificada">
+				>
+				["at0009"] = <
+					text = <"Indicador de uso condicional">
+					description = <"Um indicador das condições específicas ou regras que devem ser aplicadas ao nome de uma pessoa">
+				>
+				["at0010"] = <
+					text = <"Nome atribuído">
+					description = <"O nome que identifica a pessoa no grupo familiar ou pelo qual ela é univocamente identificada socialmente">
+				>
+				["at0011"] = <
+					text = <"Número de seqüência do nome atribuído">
+					description = <"Um indicator da ordem de uso para os nomes atribuídos">
+				>
+				["at0012"] = <
+					text = <"Nome de família">
+					description = <"A parte do nome que uma pessoa possui em comum com outros membros de sua família, distinta do(s) seu(s) nome(s) atribuído(s)">
+				>
+				["at0013"] = <
+					text = <"Número de seqüência do sobrenome">
+					description = <"Um indicator da ordem de uso para os sobrenomes">
+				>
+				["at0014"] = <
+					text = <"Título do nome">
+					description = <"Uma forma honorífica que inicia o nome, usada ao se referir a uma pessoa pelo nome, seja por correspondência ou por telefone, ou, dependendo da situação cultural, pessoalmente">
+				>
+				["at0015"] = <
+					text = <"Número de seqüência do título do nome">
+					description = <"Um indicator da ordem de uso para os títulos do nome">
+				>
+				["at0016"] = <
+					text = <"Sufixo do nome">
+					description = <"Termo adicional usado após o nome da pessoa">
+				>
+				["at0017"] = <
+					text = <"Número de seqüência do sufixo do nome">
+					description = <"Um indicator da ordem de uso para os sufixos do nome">
+				>
+				["at0018"] = <
+					text = <"Uso do nome">
+					description = <"Uma classificação que permite a diferenciação entre os usos do nome de uma pessoa. Um nome de um indivíduo pode ter muitos usos">
+				>
+				["at0019"] = <
+					text = <"Intervalo de utilização">
+					description = <"O período de tempo para o qual este uso do nome se aplica para o nome ao qual ele está associado">
+				>
+				["at0020"] = <
+					text = <"Identificador usado">
+					description = <"A combinação do tipo de identificador, emissor do identificador e nome do identificador que especifica o vínculo entre este nome e o uso do identificador para relatório, ou outros usos">
+				>
+				["at0021"] = <
+					text = <"Uso da representação">
+					description = <"Nome da forma de representação usada">
+				>
+				["at0022"] = <
+					text = <"Representação alternativa do nome">
+					description = <"Representação alternativa do nome desta pessoa usando estilos alternativos de representação, tais como caracteres ou variações do conjunto de caracteres do idioma para exibição local">
+				>
+				["at0023"] = <
+					text = <"Nome para relatório">
+					description = <"o nome do sujeito usado para relatório, quando acompanhado por um identificador específico">
+				>
+				["at0024"] = <
+					text = <"Nome de recém-nascido">
+					description = <"tipo reservado para identificação de recém-nascidos sem nome">
+				>
+				["at0025"] = <
+					text = <"Nome profissional ou comercial">
+					description = <"o nome usado pela pessoa para propósitos profissionais ou de negócios">
+				>
+				["at0026"] = <
+					text = <"Nome de solteiro(a)">
+					description = <"o nome usado pela pessoa antes de se casar">
+				>
+				["at0027"] = <
+					text = <"Nome legal">
+					description = <"Nome registrado (legal) para a pessoa">
+				>
+				["at0028"] = <
+					text = <"Outro nome">
+					description = <"qualquer outro nome pelo qual o sujeito é conhecido, ou foi conhecido no passado">
+				>
+				["at0031"] = <
+					text = <"Nome não confiável">
+					description = <"indica que o nome registrado é um nome fictício ou parcial">
+				>
+				["at0032"] = <
+					text = <"Escrito de forma errada">
+					description = <"Este indicador permite ao usuário indicar que há um erro de digitação, mas que deve ser retido para um uso potencial na vinculação de registros">
+				>
+				["at0033"] = <
+					text = <"Nome para não ser usado">
+					description = <"Indica que este nome não deve ser usado ao se referir à pessoa">
+				>
+				["at0034"] = <
+					text = <"Vínculo do nome proibido por lei">
+					description = <"indica que este nome e todos os nomes antes dele na seqüência de nomes não devem ser exibidos ou indicados de nenhum modo ao procurar por ou lidar com informações e eventos associados com um nome que segue a este na seqüência de nomes">
+				>
+				["at0035"] = <
+					text = <"Requisito especial seguranca/privacidade">
+					description = <"indica um nome para o qual episódios são vinculados e devem somente ser acessados por pessoas autorizadas">
+				>
+				["at0036"] = <
+					text = <"Nome temporário">
+					description = <"Indica que o nome da pessoa não foi determinado">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					text = <"Person name">
+					description = <"Person name details.">
+				>
+				["at0001"] = <
+					text = <"Name">
+					description = <"Components of a person name.">
+				>
+				["at0002"] = <
+					text = <"Given names">
+					description = <"Details of given names.">
+				>
+				["at0003"] = <
+					text = <"Family names">
+					description = <"Details of family names.">
+				>
+				["at0004"] = <
+					text = <"Titles">
+					description = <"Details of person titles.">
+				>
+				["at0005"] = <
+					text = <"Suffixes">
+					description = <"Details of person suffixes.">
+				>
+				["at0006"] = <
+					text = <"Name usages">
+					description = <"Details of person name usages.">
+				>
+				["at0007"] = <
+					text = <"Alternative name repesentations">
+					description = <"Details of alternative representations such as local codesets or language variations.">
+				>
+				["at0008"] = <
+					text = <"Preferred name">
+					description = <"Indicates that this is the name by which a person chooses to be identified.">
+				>
+				["at0009"] = <
+					text = <"Specific issues">
+					description = <"Specific issues that apply to use of the person name.">
+				>
+				["at0010"] = <
+					text = <"Given name">
+					description = <"The person's identifying name(s) within the family group or by which he/she is uniquely socially identified.">
+				>
+				["at0011"] = <
+					text = <"Given name sequence number">
+					description = <"The order of use for a Given name">
+				>
+				["at0012"] = <
+					text = <"Family name">
+					description = <"The part of a name a person usually has in common with some other members of his/her family, as distinguished from his/her given names.">
+				>
+				["at0013"] = <
+					text = <"Family name sequence number">
+					description = <"An indicator of the order of use for a Family name.">
+				>
+				["at0014"] = <
+					text = <"Title">
+					description = <"An honorific form of address commencing a name, used when addressing a person by name, whether by mail, by phone, or depending upon cultural situation in person.">
+				>
+				["at0015"] = <
+					text = <"Title sequence number">
+					description = <"An indicator of the order of use for the name Title.">
+				>
+				["at0016"] = <
+					text = <"Suffix">
+					description = <"Additional term used following a person name.">
+				>
+				["at0017"] = <
+					text = <"Suffix sequence number">
+					description = <"An indicator of the order of use for the name Suffix">
+				>
+				["at0018"] = <
+					text = <"Name usage">
+					description = <"A classification that enables differentiation between the usage of names for a person. An individual name may have many name uses">
+				>
+				["at0019"] = <
+					text = <"Usage interval">
+					description = <"The period of time for which this name usage applies.">
+				>
+				["at0020"] = <
+					text = <"Usage identifier">
+					description = <"The combination of identifier type, identifier issuer and identifier name that specify the link between this name and reporting or other unique identifier usage.">
+				>
+				["at0021"] = <
+					text = <"Representation usage">
+					description = <"Name of the representational form used.">
+				>
+				["at0022"] = <
+					text = <"Alternative representation">
+					description = <"Alternative Representation of this subject of care name using alternative styles of representation such as characters or language character set variations for local display.">
+				>
+				["at0023"] = <
+					text = <"Reporting name">
+					description = <"The subject’s name as it is to be used for reporting, when used with a specific identifier.">
+				>
+				["at0024"] = <
+					text = <"Newborn name">
+					description = <"A type reserved for the identification of unnamed newborn babies.">
+				>
+				["at0025"] = <
+					text = <"Professional or business name">
+					description = <"The name used by the subject for business or professional purposes.">
+				>
+				["at0026"] = <
+					text = <"Maiden name">
+					description = <"The name used by the subject of care prior to marriage.">
+				>
+				["at0027"] = <
+					text = <"Legal name">
+					description = <"Registered name (Legal name).">
+				>
+				["at0028"] = <
+					text = <"Other name">
+					description = <"Any other name by which the subject is known, or has been known by in the past.">
+				>
+				["at0031"] = <
+					text = <"Unreliable information">
+					description = <"The name recorded is a fictitious or partial name.">
+				>
+				["at0032"] = <
+					text = <"Known misspelling">
+					description = <"This is a misspelling, but should be retained for potential future matching.">
+				>
+				["at0033"] = <
+					text = <"Name not to be used">
+					description = <"This name should not be used when referring to this subject.">
+				>
+				["at0034"] = <
+					text = <"Name linkage forbidden by law">
+					description = <"By Law, this name and all names prior to it in the name sequence are not to be displayed or indicated in any way when searching for or dealing with information and events associated with a name that is subsequent to this one in the name sequence.">
+				>
+				["at0035"] = <
+					text = <"Special privacy/security requirements">
+					description = <"A name for which episodes are attached that should only be accessible to specified authorised persons.">
+				>
+				["at0036"] = <
+					text = <"Temporary name">
+					description = <"A temporary name issued where the subject's name has not been determined.">
+				>
+			>
+		>
+	>
+	constraint_definitions = <
+		["pt-br"] = <
+			items = <
+				["ac0000"] = <
+					text = <"Títulos">
+					description = <"Termos como Doutor, Mestre, ....">
+				>
+				["ac0001"] = <
+					text = <"Sufixos">
+					description = <"Sufixos do nome – neto, neta, junior, ...">
+				>
+				["ac0002"] = <
+					text = <"Códigos para o idioma de representação">
+					description = <"idiomas para a representação alternativa do nome">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["ac0000"] = <
+					text = <"Titles">
+					description = <"Terms like Dr, Prof, Rev etc used as an honorific form of addressing a person.">
+				>
+				["ac0001"] = <
+					text = <"Suffixes">
+					description = <"Terms like Jr, PhD used after the name.">
+				>
+				["ac0002"] = <
+					text = <"Language code">
+					description = <"Set of languages used for an alternative name representation.">
+				>
+			>
+		>
+	>

=== added file 'src/oship/mlhim/adl/openEHR-EHR-CLUSTER.device.v1.adl'
--- src/oship/mlhim/adl/openEHR-EHR-CLUSTER.device.v1.adl	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl/openEHR-EHR-CLUSTER.device.v1.adl	2010-08-06 02:59:44 +0000
@@ -0,0 +1,156 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.device.v1
+
+concept
+	[at0000]	-- Device details
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["email"] = <"sam.heard@xxxxxxxxxxxxxxxxxxxx">
+		["date"] = <"19/03/2008">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Record details of devices use in clinical care">
+			use = <"Use to record the details pertaining to the device that is used to record clinical details.  This is likely to be as a nested archetype as part of a Protocol.">
+			keywords = <"Device", "Machine", "Tool">
+			misuse = <"">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+	other_details = <
+		["references"] = <"">
+	>
+
+definition
+	CLUSTER[at0000] matches {	-- Device details
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0001] occurrences matches {0..1} matches {	-- Name
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Manufacturer details
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0003] occurrences matches {0..1} matches {	-- Manufacturer
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0005] occurrences matches {0..1} matches {	-- Model
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0006] occurrences matches {0..1} matches {	-- Serial number
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			CLUSTER[at0007] occurrences matches {0..1} matches {	-- Components
+				items cardinality matches {0..*; unordered} matches {
+					allow_archetype CLUSTER[at0012] occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/openEHR-EHR-CLUSTER\.device\.v1/}
+					}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Servicing
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0009] occurrences matches {0..1} matches {	-- Date last serviced
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+					ELEMENT[at0010] occurrences matches {0..1} matches {	-- Date last calibration
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+					ELEMENT[at0011] occurrences matches {0..1} matches {	-- Serviced by
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					text = <"Device details">
+					description = <"The details of the device used">
+				>
+				["at0001"] = <
+					text = <"Name">
+					description = <"The name of the device">
+				>
+				["at0002"] = <
+					text = <"Description">
+					description = <"Description of the device">
+				>
+				["at0003"] = <
+					text = <"Manufacturer">
+					description = <"The name of the manufacturer">
+				>
+				["at0004"] = <
+					text = <"Manufacturer details">
+					description = <"Information about the manufacture of the device">
+				>
+				["at0005"] = <
+					text = <"Model">
+					description = <"The model of the device">
+				>
+				["at0006"] = <
+					text = <"Serial number">
+					description = <"The serial number of the device">
+				>
+				["at0007"] = <
+					text = <"Components">
+					description = <"Information about the device components">
+				>
+				["at0008"] = <
+					text = <"Servicing">
+					description = <"Details of servicing">
+				>
+				["at0009"] = <
+					text = <"Date last serviced">
+					description = <"The date the device was last serviced">
+				>
+				["at0010"] = <
+					text = <"Date last calibration">
+					description = <"Date the device was last calibrated">
+				>
+				["at0011"] = <
+					text = <"Serviced by">
+					description = <"Agent performed the servicing">
+				>
+				["at0012"] = <
+					text = <"Components">
+					description = <"Information about the device components">
+				>
+			>
+		>
+	>

=== added file 'src/oship/mlhim/adl/openEHR-EHR-CLUSTER.level_of_exertion.v1.adl'
--- src/oship/mlhim/adl/openEHR-EHR-CLUSTER.level_of_exertion.v1.adl	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl/openEHR-EHR-CLUSTER.level_of_exertion.v1.adl	2010-08-06 02:59:44 +0000
@@ -0,0 +1,143 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.level_of_exertion.v1
+
+concept
+	[at0000]	-- Level of Exertion
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Heather Leslie">
+		["organisation"] = <"Ocean Informatics">
+		["email"] = <"heather.leslie@xxxxxxxxxxxxxxxxxxxx">
+		["date"] = <"27/10/2008">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Record information about the amount of energy expenditure that has been, or is being, experienced by the patient">
+			use = <"Record information about phase and levels of exertion - to provide state/context information within OBSERVATIONS such as Blood Pressure.">
+			keywords = <"exercise", "work", "exertion", "activity", "energy">
+			misuse = <"Not to be used to record actual exercise activities and measurements which should be recorded as OBSERVATIONS in their own right.">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+	other_details = <
+		["references"] = <"">
+	>
+
+definition
+	CLUSTER[at0000] matches {	-- Level of Exertion
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0010] occurrences matches {0..1} matches {	-- Exercise intensity
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0016] occurrences matches {0..1} matches {	-- Description
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0011] occurrences matches {0..1} matches {	-- Intensity
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0012, 	-- Low Intensity
+									at0013, 	-- Medium Intensity 
+									at0014, 	-- High Intensity 
+									at0015]	-- Flat Out 
+								}
+							}
+						}
+					}
+					ELEMENT[at0005] occurrences matches {0..1} matches {	-- Measured
+						value matches {
+							C_DV_QUANTITY <
+								property = <[openehr::130]>
+								list = <
+									["1"] = <
+										units = <"J/min">
+										magnitude = <|0.0..1000.0|>
+									>
+								>
+							>
+						}
+					}
+				}
+			}
+			ELEMENT[at0009] occurrences matches {0..1} matches {	-- Phase
+				value matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {
+							[local::
+							at0006, 	-- At rest
+							at0007, 	-- During exertion
+							at0008]	-- Post-exertion
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					text = <"Level of Exertion">
+					description = <"Record information about level of exertion">
+				>
+				["at0005"] = <
+					text = <"Measured">
+					description = <"The measured level of exertion">
+				>
+				["at0006"] = <
+					text = <"At rest">
+					description = <"The person is at rest, prior to undertaking exercise">
+				>
+				["at0007"] = <
+					text = <"During exertion">
+					description = <"The person is exerting themselves at the time">
+				>
+				["at0008"] = <
+					text = <"Post-exertion">
+					description = <"Measurement is taken after exertion has ceased">
+				>
+				["at0009"] = <
+					text = <"Phase">
+					description = <"The phase or context of exercise">
+				>
+				["at0010"] = <
+					text = <"Exercise intensity">
+					description = <"Amount of work being done during exercise">
+				>
+				["at0011"] = <
+					text = <"Intensity">
+					description = <"Semiquantitative description of the intensity of exercise undertaken">
+				>
+				["at0012"] = <
+					text = <"Low Intensity">
+					description = <"Up to 80% Maximal Heart Rate">
+				>
+				["at0013"] = <
+					text = <"Medium Intensity ">
+					description = <"80-85% of Maximal Heart Rate">
+				>
+				["at0014"] = <
+					text = <"High Intensity ">
+					description = <"85-90% Maximal Heart Rate">
+				>
+				["at0015"] = <
+					text = <"Flat Out ">
+					description = <"90-100% Maximal Heart Rate">
+				>
+				["at0016"] = <
+					text = <"Description">
+					description = <"Description of the exertion">
+				>
+			>
+		>
+	>

=== added file 'src/oship/mlhim/adl/openEHR-EHR-COMPOSITION.encounter.v1.adl'
--- src/oship/mlhim/adl/openEHR-EHR-COMPOSITION.encounter.v1.adl	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl/openEHR-EHR-COMPOSITION.encounter.v1.adl	2010-08-06 02:59:44 +0000
@@ -0,0 +1,46 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-COMPOSITION.encounter.v1
+
+concept
+	[at0000]	-- Encounter
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Thomas Beale">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"2005-10-10">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Record of encounter as a progress note.">
+			use = <"">
+			keywords = <"progress", "note", "encounter">
+			misuse = <"">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	COMPOSITION[at0000] matches {	-- Encounter
+		category matches {
+			DV_CODED_TEXT matches {
+				defining_code matches {[openehr::433]}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					text = <"Encounter">
+					description = <"Generic encounter or progress note composition">
+				>
+			>
+		>
+	>

=== added file 'src/oship/mlhim/adl/openEHR-EHR-OBSERVATION.blood_pressure.v1.adl'
--- src/oship/mlhim/adl/openEHR-EHR-OBSERVATION.blood_pressure.v1.adl	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl/openEHR-EHR-OBSERVATION.blood_pressure.v1.adl	2010-08-06 02:59:44 +0000
@@ -0,0 +1,1192 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-OBSERVATION.blood_pressure.v1
+
+concept
+	[at0000]	-- Blood pressure
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Sebastian Garde, Jasmin Buck">
+				["organisation"] = <"Central Queensland University, University of Heidelberg">
+			>
+		>
+		["zh-cn"] = <
+			language = <[ISO_639-1::zh-cn]>
+			author = <
+				["name"] = <"Chunlan Ma">
+				["organisation"] = <"Ocean Informatics">
+			>
+		>
+		["ja"] = <
+			language = <[ISO_639-1::ja]>
+			author = <
+				["name"] = <"Shinji Kobayashi">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["email"] = <"sam.heard@xxxxxxxxxxxxxxxxxxxx">
+		["date"] = <"22/03/2006">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To record the systemic arterial blood pressure of a person. ">
+			use = <"All systemic arterial blood pressure measurements are recorded using this archetype. There is a rich state model, which can be used to support exercise/stress testing and research using tilt tables.">
+			keywords = <"observations", "measurement", "bp", "vital signs", "mean arterial pressure", "pulse pressure", "systolic", "diastolic", "RR", "NIBP">
+			misuse = <"Not to be used for intravenous pressure.
+Not to be used for the recording of the measurement of arterial pressure specific locations such as the radial artery or brachial artery.
+Use OBSERVATION.intravascular_pressure and related specialisations in these situations.">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+		["ja"] = <
+			language = <[ISO_639-1::ja]>
+			purpose = <"*To record the systemic blood pressure of a person. The measurement records the systolic and the diastolic pressure by some means suitable for the result to be seen as a surrogate for the general and systemic blood pressure.(en)">
+			use = <"*All blood pressure measurements are recorded using this archetype. There is a rich state model for use with exercise ECGs and Tilt Table measurements.(en)">
+			keywords = <"*observations(en)", "*blood pressure(en)", "*measurement(en)">
+			misuse = <"*Not to be used for intravascular pressure.(en)">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Dient der Dokumentation des systemischen Blutdrucks einer Person. Die Messung zeichnet den systolischen und diastolischen Blutdruck auf geeignete Art und Weise auf, sodass das Resultat der Messung als charakteristisch für den tatsächlichen systemischen Blutdruck angesehen werden kann.">
+			use = <"Alle Blutdruckmessungen werden unter Zuhilfenahme dieses Archetypen dokumentiert. Der Archetyp beinhaltet ein umfassendes Status-Modell z.B. bei Durchführung von Belastungs-EKGs und Kipptischuntersuchungen.">
+			misuse = <"Nicht zu Benutzen zur Dokumentation des intravaskulären Drucks.">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+		["zh-cn"] = <
+			language = <[ISO_639-1::zh-cn]>
+			purpose = <"*To record the systemic blood pressure of a person. The measurement records the systolic and the diastolic pressure by some means suitable for the result to be seen as a surrogate for the general and systemic blood pressure.(en)">
+			use = <"*All blood pressure measurements are recorded using this archetype. There is a rich state model for use with exercise ECGs and Tilt Table measurements.(en)">
+			keywords = <"*observations(en)", "*blood pressure(en)", "*measurement(en)">
+			misuse = <"*Not to be used for intravascular pressure.(en)">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <"Heather Leslie, Ocean Informatics", "Sundaresan Jagannathan, NHS Scotland", "Sebastian Garde, Ocean Informatics", "Jeroen Meintjens, Medisch Centrum Alkmaar, Netherlands", "Pieter Hummel, Medisch Centrum Alkmaar, Netherlands", "Melvin Reynolds, UK", "Evelyn Hovenga, Australia", "Ian McNicoll, Ocean Informatics, Scotland", "Derek Hoy, Scotland", "Anneke Goossen, Netherlands", "Tony Shannon, NHS, UK", "Rong Chen, Sweden", "Beatriz De Faria Leao, Brazil", "Knut Bernstein, Denmark", "Eugene Igras, IRIS Systems, Canada">
+	other_details = <
+		["references"] = <"Cuff sizes:  Circulation (1993;88:2460-2467), by Dorothee Perloff,MD; Carlene Grim, MSN, SpDN; John Flack, MD; Edward D. Frohlich, MD; Martha Hill, PhD, RN; Mary McDonald, MSPH, RN; and Bruce Z. Morgenstern, MD, Writing Group">
+	>
+
+definition
+	OBSERVATION[at0000] matches {	-- Blood pressure
+		data matches {
+			HISTORY[at0001] matches {	-- history
+				events cardinality matches {1..*; unordered} matches {
+					EVENT[at0006] occurrences matches {0..*} matches {	-- any event
+						data matches {
+							ITEM_TREE[at0003] matches {	-- blood pressure
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0004] occurrences matches {0..1} matches {	-- Systolic
+										value matches {
+											C_DV_QUANTITY <
+												property = <[openehr::125]>
+												list = <
+													["1"] = <
+														units = <"mm[Hg]">
+														magnitude = <|0.0..<1000.0|>
+														precision = <|0|>
+													>
+												>
+											>
+										}
+									}
+									ELEMENT[at0005] occurrences matches {0..1} matches {	-- Diastolic
+										value matches {
+											C_DV_QUANTITY <
+												property = <[openehr::125]>
+												list = <
+													["1"] = <
+														units = <"mm[Hg]">
+														magnitude = <|0.0..<1000.0|>
+														precision = <|0|>
+													>
+												>
+											>
+										}
+									}
+									ELEMENT[at1006] occurrences matches {0..1} matches {	-- Mean Arterial Pressure
+										value matches {
+											C_DV_QUANTITY <
+												property = <[openehr::125]>
+												list = <
+													["1"] = <
+														units = <"mm[Hg]">
+														magnitude = <|0.0..<1000.0|>
+														precision = <|0|>
+													>
+												>
+											>
+										}
+									}
+									ELEMENT[at1007] occurrences matches {0..1} matches {	-- Pulse Pressure
+										value matches {
+											C_DV_QUANTITY <
+												property = <[openehr::125]>
+												list = <
+													["1"] = <
+														units = <"mm[Hg]">
+														magnitude = <|0.0..<1000.0|>
+														precision = <|0|>
+													>
+												>
+											>
+										}
+									}
+									ELEMENT[at0033] occurrences matches {0..1} matches {	-- Comment
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+								}
+							}
+						}
+						state matches {
+							ITEM_TREE[at0007] matches {	-- state structure
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0008] occurrences matches {0..1} matches {	-- Position
+										value matches {
+											DV_CODED_TEXT matches {
+												defining_code matches {
+													[local::
+													at1000, 	-- Standing
+													at1001, 	-- Sitting
+													at1002, 	-- Reclining
+													at1003, 	-- Lying
+													at1013, 	-- Trendelenburg
+													at1014; 	-- Left Lateral
+													at1001]	-- assumed value
+												}
+											}
+										}
+									}
+									allow_archetype CLUSTER[at1030] occurrences matches {0..*} matches {	-- Exertion  
+										include
+											archetype_id/value matches {/openEHR-EHR-CLUSTER\.level_of_exertion\.v1/}
+									}
+									allow_archetype CLUSTER[at1041] occurrences matches {0..*} matches {	-- Anxiety 
+										include
+											archetype_id/value matches {/.*/}
+									}
+									ELEMENT[at1005] occurrences matches {0..1} matches {	-- Tilt
+										value matches {
+											C_DV_QUANTITY <
+												property = <[openehr::497]>
+												list = <
+													["1"] = <
+														units = <"°">
+														magnitude = <|-90.0..90.0|>
+														precision = <|0|>
+													>
+												>
+												assumed_value = <
+													magnitude = <0.0>
+													units = <"°">
+													precision = <0>
+												>
+											>
+										}
+									}
+								}
+							}
+						}
+					}
+					INTERVAL_EVENT[at0031] occurrences matches {0..*} matches {	-- Postural change
+						math_function matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[openehr::147]}
+							}
+						}
+						data matches {
+							use_node ITEM_TREE /data[at0001]/events[at0006]/data[at0003]	-- /data[history]/events[any event]/data[blood pressure]
+						}
+						state matches {
+							use_node ITEM_TREE /data[at0001]/events[at0006]/state[at0007]	-- /data[history]/events[any event]/state[state structure]
+						}
+					}
+					INTERVAL_EVENT[at1004] occurrences matches {0..*} matches {	-- Paradox
+						math_function matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[openehr::149]}
+							}
+						}
+						data matches {
+							use_node ITEM_TREE /data[at0001]/events[at0006]/data[at0003]	-- /data[history]/events[any event]/data[blood pressure]
+						}
+						state matches {
+							use_node ITEM_TREE /data[at0001]/events[at0006]/state[at0007]	-- /data[history]/events[any event]/state[state structure]
+						}
+					}
+				}
+			}
+		}
+		protocol matches {
+			ITEM_TREE[at0011] matches {	-- list structure
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0013] occurrences matches {0..1} matches {	-- Cuff size
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0015, 	-- Adult
+									at0016, 	-- Large Adult
+									at0017, 	-- Paediatric/Child
+									at1008, 	-- Adult Thigh
+									at1009, 	-- Neonatal
+									at1018, 	-- Infant
+									at1019]	-- Small Adult
+								}
+							}
+						}
+					}
+					CLUSTER[at1033] occurrences matches {0..1} matches {	-- Location
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0014] occurrences matches {0..1} matches {	-- Location of measurement
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0025, 	-- Right arm
+											at0026, 	-- Left arm
+											at0027, 	-- Right thigh
+											at0028, 	-- Left thigh
+											at1020, 	-- Right wrist
+											at1021, 	-- Left wrist
+											at1026, 	-- Finger
+											at1031, 	-- Right ankle
+											at1032]	-- Left ankle
+										}
+									}
+								}
+							}
+							ELEMENT[at1034] occurrences matches {0..1} matches {	-- Description of location
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+						}
+					}
+					ELEMENT[at1035] occurrences matches {0..1} matches {	-- Method
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at1036, 	-- Auscultation
+									at1037, 	-- Palpation
+									at1039, 	-- Machine
+									at1040]	-- Invasive
+								}
+							}
+						}
+					}
+					allow_archetype CLUSTER[at1025] occurrences matches {0..*} matches {	-- Device
+						include
+							archetype_id/value matches {/openEHR-EHR-CLUSTER\.device\.v1/}
+					}
+					ELEMENT[at1038] occurrences matches {0..1} matches {	-- Mean Arterial Pressure Formula
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at1010] occurrences matches {0..1} matches {	-- Korotkoff sounds
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at1011, 	-- Fourth sound
+									at1012]	-- Fifth sound
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+ontology
+	terminologies_available = <"SNOMED-CT", ...>
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					text = <"Blood pressure">
+					description = <"The measurement of arterial blood pressure which is a surrogate for arterial pressure in the systemic circulation.">
+				>
+				["at0001"] = <
+					text = <"history">
+					description = <"history Structural node">
+				>
+				["at0003"] = <
+					text = <"blood pressure">
+					description = <"@ internal @">
+				>
+				["at0004"] = <
+					text = <"Systolic">
+					description = <"Peak systemic arterial blood pressure over one cycle - measured in systolic or contraction phase of the heart cycle">
+				>
+				["at0005"] = <
+					text = <"Diastolic">
+					description = <"Minimum systemic arterial blood pressure over one cycle - measured in the diastolic or relaxation phase">
+				>
+				["at0006"] = <
+					text = <"any event">
+					description = <"Other event in event history">
+				>
+				["at0007"] = <
+					text = <"state structure">
+					description = <"@ internal @">
+				>
+				["at0008"] = <
+					text = <"Position">
+					description = <"The position of the person at the time of measurement">
+				>
+				["at0011"] = <
+					text = <"list structure">
+					description = <"list structure">
+				>
+				["at0013"] = <
+					text = <"Cuff size">
+					description = <"The size of the cuff used for blood pressure measurement">
+				>
+				["at0014"] = <
+					text = <"Location of measurement">
+					description = <"The site of the measurement of the blood pressure">
+				>
+				["at0015"] = <
+					text = <"Adult">
+					description = <"A cuff that is standard for an adult - bladder approx 13cm x 30cm">
+				>
+				["at0016"] = <
+					text = <"Large Adult">
+					description = <"A cuff for adults with larger arms - bladder approx 16cm x 38cm">
+				>
+				["at0017"] = <
+					text = <"Paediatric/Child">
+					description = <"A cuff that is appropriate for a child or thin arm - bladder approx 8cm x 21cm">
+				>
+				["at0025"] = <
+					text = <"Right arm">
+					description = <"The right arm of the person">
+				>
+				["at0026"] = <
+					text = <"Left arm">
+					description = <"The left arm of the person">
+				>
+				["at0027"] = <
+					text = <"Right thigh">
+					description = <"The right thigh of the person">
+				>
+				["at0028"] = <
+					text = <"Left thigh">
+					description = <"The left thigh of the person">
+				>
+				["at0031"] = <
+					text = <"Postural change">
+					description = <"The difference between standing and sitting/lying blood pressure">
+				>
+				["at0033"] = <
+					text = <"Comment">
+					description = <"Comment on blood pressure measurement">
+				>
+				["at1000"] = <
+					text = <"Standing">
+					description = <"Standing at the time of blood pressure measurement">
+				>
+				["at1001"] = <
+					text = <"Sitting">
+					description = <"Sitting (for example on bed or chair) at the time of blood pressure measurement">
+				>
+				["at1002"] = <
+					text = <"Reclining">
+					description = <"Reclining at the time of blood pressure measurement">
+				>
+				["at1003"] = <
+					text = <"Lying">
+					description = <"Lying flat at the time of blood pressure measurement">
+				>
+				["at1004"] = <
+					text = <"Paradox">
+					description = <"Variation in blood pressure with respiration">
+				>
+				["at1005"] = <
+					text = <"Tilt">
+					description = <"The craniocaudal tilt of the surface on which the person is lying at the time of measurement">
+				>
+				["at1006"] = <
+					text = <"Mean Arterial Pressure">
+					description = <"The average arterial pressure that occurs over the entire course of the heart contraction and relaxation cycle.   ">
+				>
+				["at1007"] = <
+					text = <"Pulse Pressure">
+					description = <"The difference between the systolic and diastolic pressure over one contraction cycle.">
+				>
+				["at1008"] = <
+					text = <"Adult Thigh">
+					description = <"A cuff used for an adult thigh - bladder approx 20cm x 42cm">
+				>
+				["at1009"] = <
+					text = <"Neonatal">
+					description = <"A cuff used for a new born - bladder approx 3cm x 6cm">
+				>
+				["at1010"] = <
+					text = <"Korotkoff sounds">
+					description = <"Record which Korotkoff sound is used for determining diastolic pressure">
+				>
+				["at1011"] = <
+					text = <"Fourth sound">
+					description = <"The fourth Korotkoff sound is identified as an abrupt muffling of sounds">
+				>
+				["at1012"] = <
+					text = <"Fifth sound">
+					description = <"The fifth Korotkoff sound is identified by absence of sounds as the cuff pressure drops below the diastolic blood pressure">
+				>
+				["at1013"] = <
+					text = <"Trendelenburg">
+					description = <"Lying flat on the back (supine position) with the feet higher than the head at the time of blood pressure measurement">
+				>
+				["at1014"] = <
+					text = <"Left Lateral">
+					description = <"Lying on the left side at the time of blood pressure measurement">
+				>
+				["at1018"] = <
+					text = <"Infant">
+					description = <"A cuff used for infants - bladder approx 5cm x 15cm">
+				>
+				["at1019"] = <
+					text = <"Small Adult">
+					description = <"A cuff used for a small adult - bladder approx 10cm x 24cm">
+				>
+				["at1020"] = <
+					text = <"Right wrist">
+					description = <"The right wrist of the person">
+				>
+				["at1021"] = <
+					text = <"Left wrist">
+					description = <"The left wrist of the person">
+				>
+				["at1025"] = <
+					text = <"Device">
+					description = <"Details about sphygmomanometer or other device used to measure the blood pressure">
+				>
+				["at1026"] = <
+					text = <"Finger">
+					description = <"A finger of the person">
+				>
+				["at1030"] = <
+					text = <"Exertion  ">
+					description = <"Details about physical activity undertaken at the time of blood pressure measurement">
+				>
+				["at1031"] = <
+					text = <"Right ankle">
+					description = <"The right ankle of the person">
+				>
+				["at1032"] = <
+					text = <"Left ankle">
+					description = <"The left ankle of the person">
+				>
+				["at1033"] = <
+					text = <"Location">
+					description = <"Body site of blood pressure location">
+				>
+				["at1034"] = <
+					text = <"Description of location">
+					description = <"Detailed description about the site of the measurement of the blood pressure">
+				>
+				["at1035"] = <
+					text = <"Method">
+					description = <"Method of measurement of blood pressure">
+				>
+				["at1036"] = <
+					text = <"Auscultation">
+					description = <"Method of measuring blood pressure externally, using a stethoscope and Korotkoff sounds">
+				>
+				["at1037"] = <
+					text = <"Palpation">
+					description = <"Method of measuring blood pressure externally, using palpation (usually of the radial artery at the wrist)">
+				>
+				["at1038"] = <
+					text = <"Mean Arterial Pressure Formula">
+					description = <"Formula used to calculate the MAP (if recorded in data)">
+				>
+				["at1039"] = <
+					text = <"Machine">
+					description = <"Method of measuring blood pressure externally, using a blood pressure machine">
+				>
+				["at1040"] = <
+					text = <"Invasive">
+					description = <"Method of measuring blood pressure internally ie involving penetration of the skin and measuring inside blood vessels">
+				>
+				["at1041"] = <
+					text = <"Anxiety ">
+					description = <"Details about the subject's level of anxiety at the time of blood pressure measurement">
+				>
+			>
+		>
+		["ja"] = <
+			items = <
+				["at0000"] = <
+					text = <"血圧">
+					description = <"測定され、あらゆる手段(侵襲的または非侵襲的な)の全身動脈血圧の変化を表すものでは、実際の全身の血液の圧力">
+				>
+				["at0001"] = <
+					text = <"*history(en)">
+					description = <"*history Structural node(en)">
+				>
+				["at0003"] = <
+					text = <"血圧">
+					description = <"*@ internal @(en)">
+				>
+				["at0004"] = <
+					text = <"収縮期">
+					description = <"1つ以上の脈の間で最高値を示す全身の動脈圧 - 心機図の収縮期で測定される">
+				>
+				["at0005"] = <
+					text = <"拡張期">
+					description = <"1つ以上の脈の間で最低値を示す全身の動脈圧 - 心機図の拡張期で測定される">
+				>
+				["at0006"] = <
+					text = <"任意イベント">
+					description = <" イベントの履歴における他のイベント">
+				>
+				["at0007"] = <
+					text = <"*state structure(en)">
+					description = <"*@ internal @(en)">
+				>
+				["at0008"] = <
+					text = <"*Position(en)">
+					description = <"*The position of the person at the time of measurement(en)">
+				>
+				["at0011"] = <
+					text = <"*list structure(en)">
+					description = <"*list structure(en)">
+				>
+				["at0013"] = <
+					text = <"カフサイズ">
+					description = <"血圧計が使用するカフのサイズ">
+				>
+				["at0014"] = <
+					text = <"測定部位">
+					description = <"血圧を測定する部位">
+				>
+				["at0015"] = <
+					text = <"*Adult(en)">
+					description = <"*A cuff that is standard for an adult - bladder approx 13cm x 30cm(en)">
+				>
+				["at0016"] = <
+					text = <"*Large Adult(en)">
+					description = <"*A cuff for adults with larger arms - bladder approx 16cm x 38cm(en)">
+				>
+				["at0017"] = <
+					text = <"*Paediatric/Child(en)">
+					description = <"*A cuff that is appropriate for a child or thin arm - bladder approx 8cm x 21cm(en)">
+				>
+				["at0025"] = <
+					text = <"右腕">
+					description = <"*The right arm of the person(en)">
+				>
+				["at0026"] = <
+					text = <"左腕">
+					description = <"*The left arm of the person(en)">
+				>
+				["at0027"] = <
+					text = <"*Right leg(en)">
+					description = <"*The right leg of the person(en)">
+				>
+				["at0028"] = <
+					text = <"左脚">
+					description = <"*The left leg of the person(en)">
+				>
+				["at0031"] = <
+					text = <"姿勢変化">
+					description = <"座位と立位での血圧変化">
+				>
+				["at0033"] = <
+					text = <"コメント">
+					description = <"血圧測定のコメント">
+				>
+				["at1000"] = <
+					text = <"立位">
+					description = <"*Standing at the time of blood pressure measurement(en)">
+				>
+				["at1001"] = <
+					text = <"座位">
+					description = <"*Sitting on bed or chair at the time of blood pressure measurement(en)">
+				>
+				["at1002"] = <
+					text = <"斜位">
+					description = <"*Person reclining at 45 degrees at the time of blood pressure measurement(en)">
+				>
+				["at1003"] = <
+					text = <"臥位">
+					description = <"*Patient lying flat at the time of blood pressure measurement(en)">
+				>
+				["at1004"] = <
+					text = <"奇脈">
+					description = <"呼吸による血圧変動">
+				>
+				["at1005"] = <
+					text = <"*Tilt(en)">
+					description = <"*The craniocaudal tilt of the surface on which the person is lying at the time of measurement(en)">
+				>
+				["at1006"] = <
+					text = <"*Mean Arterial Pressure(en)">
+					description = <"*The average arterial pressure that occurs over the entire course of the heart contraction and relaxation cycle.   (en)">
+				>
+				["at1007"] = <
+					text = <"脈圧">
+					description = <"1回の収縮サイクルでの血圧の変動">
+				>
+				["at1008"] = <
+					text = <"*Adult Thigh(en)">
+					description = <"*A cuff used for an adult thigh - bladder approx 20cm x 42cm(en)">
+				>
+				["at1009"] = <
+					text = <"*Neonatal(en)">
+					description = <"*A cuff used for a new born - bladder approx 3cm x 6cm(en)">
+				>
+				["at1010"] = <
+					text = <"コロトコフ音">
+					description = <"拡張期を決定するときに使用されたコロトコフ音の記録">
+				>
+				["at1011"] = <
+					text = <"*Fourth sound(en)">
+					description = <"*The fifth Korotkoff sound is silence as the cuff pressure drops below the diastolic blood pressure(en)">
+				>
+				["at1012"] = <
+					text = <"*Fifth sound(en)">
+					description = <"*The fifth Korotkoff sound is silence as the cuff pressure drops below the diastolic blood pressure(en)">
+				>
+				["at1013"] = <
+					text = <"*Trendelenburg(en)">
+					description = <"*Person is lying flat on the back (supine position) with the feet higher than the head at the time of blood pressure measurement(en)">
+				>
+				["at1014"] = <
+					text = <"*Left Lateral(en)">
+					description = <"*Person is lying on their left side at the time of blood pressure measurement(en)">
+				>
+				["at1018"] = <
+					text = <"*Infant(en)">
+					description = <"*A cuff used for infants - bladder approx 5cm x 15cm(en)">
+				>
+				["at1019"] = <
+					text = <"*Small Adult(en)">
+					description = <"*A cuff used for a small adult - bladder approx 10cm x 24cm(en)">
+				>
+				["at1020"] = <
+					text = <"*Right wrist(en)">
+					description = <"*The right wrist of the person(en)">
+				>
+				["at1021"] = <
+					text = <"*Left wrist(en)">
+					description = <"*The left wrist of the person(en)">
+				>
+				["at1025"] = <
+					text = <"*Device(en)">
+					description = <"*Details about sphygmomanometer or other device used to measure the blood pressure(en)">
+				>
+				["at1026"] = <
+					text = <"Finger">
+					description = <"*A finger of the person(en)">
+				>
+				["at1030"] = <
+					text = <"*Exertion  (en)">
+					description = <"*Details about physical activity undertaken at the time of blood pressure measurement(en)">
+				>
+				["at1031"] = <
+					text = <"*Left ankle(en)">
+					description = <"**(en)">
+				>
+				["at1032"] = <
+					text = <"*Right ankle(en)">
+					description = <"*The right ankle of the person(en)">
+				>
+				["at1033"] = <
+					text = <"*New cluster(en)">
+					description = <"**(en)">
+				>
+				["at1034"] = <
+					text = <"*New element(en)">
+					description = <"**(en)">
+				>
+				["at1035"] = <
+					text = <"*New element(en)">
+					description = <"**(en)">
+				>
+				["at1036"] = <
+					text = <"*Auscultation(en)">
+					description = <"*Method of measuring blood pressure externally, using a stethoscope and Korotkoff sounds(en)">
+				>
+				["at1037"] = <
+					text = <"*Palpation(en)">
+					description = <"*Method of measuring blood pressure externally, using palpation (usually of the radial artery at the wrist)(en)">
+				>
+				["at1038"] = <
+					text = <"*Mean Arterial Pressure Formula(en)">
+					description = <"*Formula used to calculate the MAP (if recorded in data)(en)">
+				>
+				["at1039"] = <
+					text = <"*Machine(en)">
+					description = <"*Method of measuring blood pressure externally, using a blood pressure machine(en)">
+				>
+				["at1040"] = <
+					text = <"*Invasive(en)">
+					description = <"*Method of measuring blood pressure internally ie involving penetration of the skin and measuring inside blood vessels(en)">
+				>
+				["at1041"] = <
+					text = <"*Anxiety (en)">
+					description = <"*Details about the subject's level of anxiety at the time of blood pressure measurement(en)">
+				>
+			>
+		>
+		["de"] = <
+			items = <
+				["at0000"] = <
+					text = <"Blutdruckmessung">
+					description = <"Die Messung des systemischen arteriellen Blutdrucks, die als geeignet angesehen wird, den tatsächlichen systemischen Blutdruck zu repräsentieren.">
+				>
+				["at0001"] = <
+					text = <"Historie">
+					description = <"Historie">
+				>
+				["at0003"] = <
+					text = <"Blutdruck">
+					description = <"*@ internal @(en)">
+				>
+				["at0004"] = <
+					text = <"Systolisch">
+					description = <"Der höchste arterielle Blutdruck eines Zyklus - gemessen in der systolischen oder Kontraktionsphase des Herzens.">
+				>
+				["at0005"] = <
+					text = <"Diastolisch">
+					description = <"Der minimale systemische arterielle Blutdruck eines Zyklus - gemessen in der diastolischen oder Entspannungsphase des Herzens.">
+				>
+				["at0006"] = <
+					text = <"Unbestimmtes Ereignis">
+					description = <"anderes unbestimmtes Ereignis">
+				>
+				["at0007"] = <
+					text = <"*state structure(en)">
+					description = <"*@ internal @(en)">
+				>
+				["at0008"] = <
+					text = <"*Position(en)">
+					description = <"*The position of the person at the time of measurement(en)">
+				>
+				["at0011"] = <
+					text = <"Listenstruktur">
+					description = <"Listenstruktur">
+				>
+				["at0013"] = <
+					text = <"Manschettengröße">
+					description = <"Die Größe der Manschette des benutzten Sphygmomanometers">
+				>
+				["at0014"] = <
+					text = <"Ort der Messung">
+					description = <"Ort der Blutdruckmessung">
+				>
+				["at0015"] = <
+					text = <"*Adult(en)">
+					description = <"*A cuff that is standard for an adult - bladder approx 13cm x 30cm(en)">
+				>
+				["at0016"] = <
+					text = <"*Large Adult(en)">
+					description = <"*A cuff for adults with larger arms - bladder approx 16cm x 38cm(en)">
+				>
+				["at0017"] = <
+					text = <"*Paediatric/Child(en)">
+					description = <"*A cuff that is appropriate for a child or thin arm - bladder approx 8cm x 21cm(en)">
+				>
+				["at0025"] = <
+					text = <"Rechter Arm">
+					description = <"Der rechte Arm der Person">
+				>
+				["at0026"] = <
+					text = <"Linker Arm">
+					description = <"Der linke Arm der Person">
+				>
+				["at0027"] = <
+					text = <"*Right leg(en)">
+					description = <"*The right leg of the person(en)">
+				>
+				["at0028"] = <
+					text = <"Linkes Bein">
+					description = <"Linkes Bein des Patienten">
+				>
+				["at0031"] = <
+					text = <"Posturale Änderung">
+					description = <"Die Differenz zwischen stehendem und sitzendem/liegendem Blutdruck">
+				>
+				["at0033"] = <
+					text = <"Kommentar">
+					description = <"Kommentar zur Blutdruckmessung">
+				>
+				["at1000"] = <
+					text = <"Stehend">
+					description = <"Stehend zum Zeitpunkt der Blutdruckmessung">
+				>
+				["at1001"] = <
+					text = <"Sitzend">
+					description = <"Sitzend zum Zeitpunkt der Blutdruckmessung">
+				>
+				["at1002"] = <
+					text = <"Zurückgelehnt">
+					description = <"Patient 45 Grad zurückgelehnt zum Zeitpunkt der Blutdruckmessung">
+				>
+				["at1003"] = <
+					text = <"Liegend">
+					description = <"Patient flach liegend zum Zeitpunkt der Blutdruckmessung">
+				>
+				["at1004"] = <
+					text = <"Paradox">
+					description = <"Variation des Blutdrucks bei Atmung">
+				>
+				["at1005"] = <
+					text = <"*Tilt(en)">
+					description = <"*The craniocaudal tilt of the surface on which the person is lying at the time of measurement(en)">
+				>
+				["at1006"] = <
+					text = <"*Mean Arterial Pressure(en)">
+					description = <"*The average arterial pressure that occurs over the entire course of the heart contraction and relaxation cycle.   (en)">
+				>
+				["at1007"] = <
+					text = <"Pulsdruck">
+					description = <"Der Abstand zwischen dem systolischen und dem diastolischen Blutdruckwert. Beschreibt die Druckwelle, die mit jedem Herzschlag durch das Blutgefäßsystem läuft.">
+				>
+				["at1008"] = <
+					text = <"*Adult Thigh(en)">
+					description = <"*A cuff used for an adult thigh - bladder approx 20cm x 42cm(en)">
+				>
+				["at1009"] = <
+					text = <"*Neonatal(en)">
+					description = <"*A cuff used for a new born - bladder approx 3cm x 6cm(en)">
+				>
+				["at1010"] = <
+					text = <"Korotkoff Geräusche">
+					description = <"Korotkoff Geräusch, das zur Betimmung des diastolischen Blutdrucks benuzt wurde">
+				>
+				["at1011"] = <
+					text = <"*Fourth sound(en)">
+					description = <"*The fifth Korotkoff sound is silence as the cuff pressure drops below the diastolic blood pressure(en)">
+				>
+				["at1012"] = <
+					text = <"*Fifth sound(en)">
+					description = <"*The fifth Korotkoff sound is silence as the cuff pressure drops below the diastolic blood pressure(en)">
+				>
+				["at1013"] = <
+					text = <"*Trendelenburg(en)">
+					description = <"*Person is lying flat on the back (supine position) with the feet higher than the head at the time of blood pressure measurement(en)">
+				>
+				["at1014"] = <
+					text = <"*Left Lateral(en)">
+					description = <"*Person is lying on their left side at the time of blood pressure measurement(en)">
+				>
+				["at1018"] = <
+					text = <"*Infant(en)">
+					description = <"*A cuff used for infants - bladder approx 5cm x 15cm(en)">
+				>
+				["at1019"] = <
+					text = <"*Small Adult(en)">
+					description = <"*A cuff used for a small adult - bladder approx 10cm x 24cm(en)">
+				>
+				["at1020"] = <
+					text = <"*Right wrist(en)">
+					description = <"*The right wrist of the person(en)">
+				>
+				["at1021"] = <
+					text = <"*Left wrist(en)">
+					description = <"*The left wrist of the person(en)">
+				>
+				["at1025"] = <
+					text = <"*Device(en)">
+					description = <"*Details about sphygmomanometer or other device used to measure the blood pressure(en)">
+				>
+				["at1026"] = <
+					text = <"*Finger(en)">
+					description = <"**(en)">
+				>
+				["at1030"] = <
+					text = <"*Exertion  (en)">
+					description = <"*Details about physical activity undertaken at the time of blood pressure measurement(en)">
+				>
+				["at1031"] = <
+					text = <"*Left ankle(en)">
+					description = <"**(en)">
+				>
+				["at1032"] = <
+					text = <"*Right ankle(en)">
+					description = <"*The right ankle of the person(en)">
+				>
+				["at1033"] = <
+					text = <"*New cluster(en)">
+					description = <"**(en)">
+				>
+				["at1034"] = <
+					text = <"*New element(en)">
+					description = <"**(en)">
+				>
+				["at1035"] = <
+					text = <"*New element(en)">
+					description = <"**(en)">
+				>
+				["at1036"] = <
+					text = <"*Auscultation(en)">
+					description = <"*Method of measuring blood pressure externally, using a stethoscope and Korotkoff sounds(en)">
+				>
+				["at1037"] = <
+					text = <"*Palpation(en)">
+					description = <"*Method of measuring blood pressure externally, using palpation (usually of the radial artery at the wrist)(en)">
+				>
+				["at1038"] = <
+					text = <"*Mean Arterial Pressure Formula(en)">
+					description = <"*Formula used to calculate the MAP (if recorded in data)(en)">
+				>
+				["at1039"] = <
+					text = <"*Machine(en)">
+					description = <"*Method of measuring blood pressure externally, using a blood pressure machine(en)">
+				>
+				["at1040"] = <
+					text = <"*Invasive(en)">
+					description = <"*Method of measuring blood pressure internally ie involving penetration of the skin and measuring inside blood vessels(en)">
+				>
+				["at1041"] = <
+					text = <"*Anxiety (en)">
+					description = <"*Details about the subject's level of anxiety at the time of blood pressure measurement(en)">
+				>
+			>
+		>
+		["zh-cn"] = <
+			items = <
+				["at0000"] = <
+					text = <"血压">
+					description = <"以任何方式测量的系统性动脉血压的压力, 被认为是代表实际的系统性血压">
+				>
+				["at0001"] = <
+					text = <"*history(en)">
+					description = <"*history Structural node(en)">
+				>
+				["at0003"] = <
+					text = <"血压">
+					description = <"*@ internal @(en)">
+				>
+				["at0004"] = <
+					text = <"收缩压">
+					description = <"一个血液循环周期中,系统性动脉血压高峰值。 收缩期血压">
+				>
+				["at0005"] = <
+					text = <"舒张压">
+					description = <"一个血液循环周期中,系统性动脉血压最低值。 舒张期血压">
+				>
+				["at0006"] = <
+					text = <"*any event(en)">
+					description = <"*other event in event history(en)">
+				>
+				["at0007"] = <
+					text = <"*state structure(en)">
+					description = <"*@ internal @(en)">
+				>
+				["at0008"] = <
+					text = <"*Position(en)">
+					description = <"*The position of the person at the time of measurement(en)">
+				>
+				["at0011"] = <
+					text = <"*list structure(en)">
+					description = <"*list structure(en)">
+				>
+				["at0013"] = <
+					text = <"袖带尺度">
+					description = <"血压计袖带尺度">
+				>
+				["at0014"] = <
+					text = <"测量部位">
+					description = <"测量血压的部位">
+				>
+				["at0015"] = <
+					text = <"*Adult(en)">
+					description = <"*A cuff that is standard for an adult - bladder approx 13cm x 30cm(en)">
+				>
+				["at0016"] = <
+					text = <"*Large Adult(en)">
+					description = <"*A cuff for adults with larger arms - bladder approx 16cm x 38cm(en)">
+				>
+				["at0017"] = <
+					text = <"*Paediatric/Child(en)">
+					description = <"*A cuff that is appropriate for a child or thin arm - bladder approx 8cm x 21cm(en)">
+				>
+				["at0025"] = <
+					text = <"右臂">
+					description = <"被测试者右臂">
+				>
+				["at0026"] = <
+					text = <"左臂">
+					description = <"被测试者左臂">
+				>
+				["at0027"] = <
+					text = <"*Right leg(en)">
+					description = <"*The right leg of the person(en)">
+				>
+				["at0028"] = <
+					text = <"左腿">
+					description = <"被测试者左下肢">
+				>
+				["at0031"] = <
+					text = <"姿势变化">
+					description = <"由体位变动引起的血压值变化">
+				>
+				["at0033"] = <
+					text = <"注释">
+					description = <"有关血压值的注释">
+				>
+				["at1000"] = <
+					text = <"立位">
+					description = <"测量血压时身体处于站立体位">
+				>
+				["at1001"] = <
+					text = <"坐位">
+					description = <"测量血压时身体处于坐位">
+				>
+				["at1002"] = <
+					text = <"侧卧位">
+					description = <"测量血压时身体处于45度角侧卧位">
+				>
+				["at1003"] = <
+					text = <"卧位">
+					description = <"测量血压时身体处于平卧位">
+				>
+				["at1004"] = <
+					text = <"奇脉">
+					description = <"奇脉时引起血压变化">
+				>
+				["at1005"] = <
+					text = <"*Tilt(en)">
+					description = <"*The craniocaudal tilt of the surface on which the person is lying at the time of measurement(en)">
+				>
+				["at1006"] = <
+					text = <"*Mean Arterial Pressure(en)">
+					description = <"*The average arterial pressure that occurs over the entire course of the heart contraction and relaxation cycle.   (en)">
+				>
+				["at1007"] = <
+					text = <"脉压">
+					description = <"*The variation in pressure over one contraction cycle(en)">
+				>
+				["at1008"] = <
+					text = <"*Adult Thigh(en)">
+					description = <"*A cuff used for an adult thigh - bladder approx 20cm x 42cm(en)">
+				>
+				["at1009"] = <
+					text = <"*Neonatal(en)">
+					description = <"*A cuff used for a new born - bladder approx 3cm x 6cm(en)">
+				>
+				["at1010"] = <
+					text = <"克夫音效">
+					description = <"*Record which Korotkoff sound is used for determining Diastolic pressure(en)">
+				>
+				["at1011"] = <
+					text = <"*Fourth sound(en)">
+					description = <"*The fifth Korotkoff sound is silence as the cuff pressure drops below the diastolic blood pressure(en)">
+				>
+				["at1012"] = <
+					text = <"*Fifth sound(en)">
+					description = <"*The fifth Korotkoff sound is silence as the cuff pressure drops below the diastolic blood pressure(en)">
+				>
+				["at1013"] = <
+					text = <"*Trendelenburg(en)">
+					description = <"*Person is lying flat on the back (supine position) with the feet higher than the head at the time of blood pressure measurement(en)">
+				>
+				["at1014"] = <
+					text = <"*Left Lateral(en)">
+					description = <"*Person is lying on their left side at the time of blood pressure measurement(en)">
+				>
+				["at1018"] = <
+					text = <"*Infant(en)">
+					description = <"*A cuff used for infants - bladder approx 5cm x 15cm(en)">
+				>
+				["at1019"] = <
+					text = <"*Small Adult(en)">
+					description = <"*A cuff used for a small adult - bladder approx 10cm x 24cm(en)">
+				>
+				["at1020"] = <
+					text = <"*Right wrist(en)">
+					description = <"*The right wrist of the person(en)">
+				>
+				["at1021"] = <
+					text = <"*Left wrist(en)">
+					description = <"*The left wrist of the person(en)">
+				>
+				["at1025"] = <
+					text = <"*Device(en)">
+					description = <"*Details about sphygmomanometer or other device used to measure the blood pressure(en)">
+				>
+				["at1026"] = <
+					text = <"*Finger(en)">
+					description = <"*A finger of the person(en)">
+				>
+				["at1030"] = <
+					text = <"*Exertion  (en)">
+					description = <"*Details about physical activity undertaken at the time of blood pressure measurement(en)">
+				>
+				["at1031"] = <
+					text = <"*Left ankle(en)">
+					description = <"**(en)">
+				>
+				["at1032"] = <
+					text = <"*Right ankle(en)">
+					description = <"*The right ankle of the person(en)">
+				>
+				["at1033"] = <
+					text = <"*New cluster(en)">
+					description = <"**(en)">
+				>
+				["at1034"] = <
+					text = <"*New element(en)">
+					description = <"**(en)">
+				>
+				["at1035"] = <
+					text = <"*New element(en)">
+					description = <"**(en)">
+				>
+				["at1036"] = <
+					text = <"*Auscultation(en)">
+					description = <"*Method of measuring blood pressure externally, using a stethoscope and Korotkoff sounds(en)">
+				>
+				["at1037"] = <
+					text = <"*Palpation(en)">
+					description = <"*Method of measuring blood pressure externally, using palpation (usually of the radial artery at the wrist)(en)">
+				>
+				["at1038"] = <
+					text = <"*Mean Arterial Pressure Formula(en)">
+					description = <"*Formula used to calculate the MAP (if recorded in data)(en)">
+				>
+				["at1039"] = <
+					text = <"*Machine(en)">
+					description = <"*Method of measuring blood pressure externally, using a blood pressure machine(en)">
+				>
+				["at1040"] = <
+					text = <"*Invasive(en)">
+					description = <"*Method of measuring blood pressure internally ie involving penetration of the skin and measuring inside blood vessels(en)">
+				>
+				["at1041"] = <
+					text = <"*Anxiety (en)">
+					description = <"*Details about the subject's level of anxiety at the time of blood pressure measurement(en)">
+				>
+			>
+		>
+	>
+	term_binding = <
+		["SNOMED-CT"] = <
+			items = <
+				["at0000"] = <[SNOMED-CT(2003)::163020007]>
+				["at0004"] = <[SNOMED-CT(2003)::163030003]>
+				["at0005"] = <[SNOMED-CT(2003)::163031004]>
+				["at0013"] = <[SNOMED-CT(2003)::246153002]>
+			>
+		>
+	>

=== added file 'src/oship/mlhim/adl2xsd.py'
--- src/oship/mlhim/adl2xsd.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl2xsd.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,549 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the license in OSHIP-LICENSE.txt
+# The OSHIP License is MPL 1.1
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+
+"""
+   Creates XMLSchema files from ADL files.
+        Parsing is performed in adl_1_4.py using Pyparsing.
+        You will need to easy_install pyparsing and mglob in your 'oshipenv'
+
+"""
+
+
+__author__  = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'<name> <email address>'
+
+
+import codecs
+
+import os
+import traceback
+import sys
+from oship.utils import mglob
+import logging
+
+from pyparsing import *
+
+
+
+# in this section are required imports for (almost?) all archetypes
+import grok
+import datetime
+import time
+from classmap import getClassName
+
+from archetype import ArchetypeOntology
+from oship.mlhim.rm.support import *
+from oship.mlhim.rm.datatypes import *
+from demographic import *
+import adl_1_4
+from utils import Languages
+
+
+"""
+edit the path below (no trailing '/') to point to your archetypes in ADL 1.4 format
+if you choose not use use the standard import directory under oship/openehr/adl.
+"""
+
+adlDir=os.getcwd()+'/src/oship/openehr/adl'
+xsd_filesDir=os.getcwd()+'/src/oship/openehr/xsd/'
+
+
+def CreateXSD():
+    """
+    Create parse results to send to the builder.
+    """
+
+    fnames = mglob.expand("rec:"+adlDir+"=*.adl")
+    n=0
+    e=0
+    errCount=0
+    count=len(fnames)
+    #startTime=time.clock()
+
+    fnames.sort()
+    print "ADL File count: ",count," in ",adlDir
+    print "\n Placing XML Schema files in ", xsd_filesDir
+
+    for fname in fnames:
+        n+=1
+        print "\n\nProcessing # ",n,' of ',count,' --->',fname
+        adlSource = file(fname).read()
+
+        try:
+            # parsed_adl is the returned ParseResults object
+            parsed_adl = adl_1_4.archetypeDefinition.parseString(adlSource)
+        except ParseException:
+            e+=1
+            logging.error("Error # "+str(e)+" Occured Parsing "+fname+':\n')
+            print "Parsing Failed -- Error Logged!\n"
+            errCount+=1
+        else:
+            logging.info("Processing: "+fname)
+            bldArchetype(fname,parsed_adl)
+
+
+    #print "\n\nParsed ",count," files in",time.clock()-startTime," seconds."
+    print "\n\nParsed ",count," files."
+    print "There were ",errCount," parse errors. "
+    logging.info("There were "+repr(errCount)+" parse errors. ")
+    if errCount > 0:
+        print "Please see the error log file for errors & warnings."
+
+
+    logging.info("*******END OF LOG FILE FOR THIS RUN*******")
+
+    return
+
+
+def bldArchetype(fname,parsed_adl):
+    """
+    Build the archetype source xsd file.
+    """
+
+    #get the class name from the archetypeID
+    class_name=(parsed_adl.archetype[1]).partition('.')[2]
+    class_name=class_name.replace('.','_')
+    class_name=class_name.replace('-','_')
+
+    #get the filename from the class_name
+    class_file=class_name+'.xsd'
+
+    #now lets turn the class_name into a normal Python CamelCase name
+    class_list=class_name.split('_')
+    class_name=''
+    for n in class_list:
+        class_name=class_name+n.capitalize()
+
+    print '\n Creating Class : ',class_name+'\n\n'
+    logging.info("The XSD name is: "+class_name+' in file: '+class_file+'\n')
+    f=open(xsd_filesDir+class_file,'w') # create the file for writing
+
+
+    f.write("<!-- Copyright Timothy W. Cook  -   http://www.oship.org \n")
+    f.write("This file was created with adl2xsd module from the OSHIP project.\n")
+    f.write("Its quality is not guaranteed and may need hand editing.\n")
+    f.write("adl2xsd.py maybe distributed under the terms of the cc by-sa license-->\n\n")
+    f.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+    f.write("<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema/\"\n \
+            targetNamespace=\"http://www.mlhim.org/schemas/openehr/v1/\"\n \
+            xmlns:moe=\"http://www.mlhim.org/schemas/openehr/v1/\"\n \
+            elementFormDefault=\"qualified\">\n")
+
+    f.write("<xs:schema targetNamespace=\"http://www.mlhim.org/schemas/openehr/v1/\"\n \
+            xmlns:moe=\"http://www.mlhim.org/schemas/openehr/v1/\";>\n\n")
+    
+    f.write("<xs:complexType name=\"CCD\">\n")
+    f.write("   <xs:complexType name=\"CCD_MD\">\n")
+    f.write("      <xs:element name=\"parent_uuid\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"author_name\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"purpose\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"misuse\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"original_language\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"rm_version\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"copyright\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"contributors\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"translation_language\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"invariants\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"ccd_type\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"ccd_status\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"rm_name\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("   </xs:complexType>\n\n")
+    f.write("   <xs:complexType name=\"CCD_SYS\">\n")
+    f.write("      <xs:element name=\"ccd_version\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"ccd_uuid\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("      <xs:element name=\"nodeids\" type=\"xs:string\" minOccurs=\"1\">\n")
+    f.write("      </xs:element>\n")
+    f.write("   </xs:complexType>\n\n")
+    f.write("   <xs:complexType name=\"CCD_DEF\">\n")
+    f.write("      <xs:element name=\" \" type=\" \" minOccurs=\"1\" maxOccurs=\" \">\n")
+    f.write("      </xs:element>\n")
+    f.write("   </xs:complexType>\n")
+    f.write("</xs:complexType\n")
+    
+    #f.write("from oship.mlhim.datatypes import *\n")
+    #f.write("from oship.mlhim.demographic import *\n")
+    #f.write("from oship.mlhim.ehr import *\n")
+    #f.write("from oship.mlhim.extract import *\n")
+    #f.write("from oship.mlhim.integration import *\n")
+    #f.write("from oship.mlhim.openehrprofile import *\n")
+    #f.write("from oship.mlhim.sm import *\n")
+    #f.write("from oship.mlhim.support import *\n\n")
+    #f.write("_ = MessageFactory('oship')\n\n")
+
+    #f.write("class "+ class_name+"(Archetype):\n\n")
+    #f.write("    grok.implements(IArchetype)\n\n" )
+    #f.write("    def __init__(self):\n" )
+    #f.write("        self.adlVersion =u'"+unicode(parsed_adl.archetype[0][1])+"'\n")
+    #f.write("        self.archetypeId = ArchetypeId(ObjectId(u'"+unicode(parsed_adl.archetype[1])+"'))\n")
+    #f.write("        self.concept = u'"+unicode(parsed_adl.concept.strip('[]')+"'\n"))
+
+    #if parsed_adl.specialize:
+        #f.write("        self.parentArchetypeId = ArchetypeId(ObjectId(u'"+unicode(parsed_adl.specialize)+"'))\n")
+    #else:
+        #f.write("        self.parentArchetypeId=ArchetypeId(ObjectId(u''))\n")
+
+
+
+    # we need to build a description section
+
+    #original_author=flatten(parsed_adl.description[0])
+    #details=flatten(parsed_adl.description[1])
+    #lifecycle_state=flatten(parsed_adl.description[2])
+    #other_contributors=flatten(parsed_adl.description[3])
+    #if len(parsed_adl.description)>=5:
+        #other_details=flatten(parsed_adl.description[4])
+    #else:
+        #other_details=None
+
+    #print "\nOriginal Author  = ",original_author
+    #print "\nDetails = ",details
+    #print "\nLifecycle State = ",lifecycle_state
+    #print "\nOther Contributors = ",other_contributors
+    #print "\nOther Details = ", other_details
+
+    #f.write('\n        # Create the description components.\n')
+    #ol=details[3].split("::")
+    #f.write("        self.originalLanguage=CodePhrase(u'"+ol[0][1:]+"',u'"+ol[1].strip('_')+"')\n")
+    #f.write("        self.translationDetails=None # needs to be completed in atbldr\n")
+    #f.write("        self.description="+repr(flatten(parsed_adl.description))+" # needs to be completed in atbldr\n")
+    #f.write("        self.revisionHistory=None # needs to be completed in atbldr\n")
+    #f.write("        self.isControlled=False # needs to be completed in atbldr\n")
+
+    # next we build the ontology
+
+    #f.write('\n        # Create the ontology.\n')
+    ## pre-assign all attributes
+    #termAvail=[]
+    #specDepth=0
+    #termCodes={}
+    #constCodes={}
+    #termAN=[]
+
+
+    ##cleanup the list
+    #ontlist=flatten(parsed_adl.ontology)
+
+    ## build some reference lists
+    #key_list=[u'terminologies_available',u'term_definitions',u'constraint_definitions',u'term_binding',u'constraint_binding']
+    #lang_list=Languages() # see utils.py
+
+    #itemlist=[]
+    ## now go through ontlist and map all the words.
+
+    #ontmap={}
+    #for index, item in enumerate(ontlist):
+        #ontmap[index]=item
+
+
+    #a = ontmap.items()
+    #keywords=[]
+    #for x in a:
+        #for v in key_list:
+            #if v in x:
+                #keywords.append(x)
+
+    #"""
+    #keywords now contains tuples of all the possible section names and their index:
+    #i.e. [(0, u'terminologies_available'), (3, u'term_definitions'), (346, u'term_binding')]
+    #This is so we know where each one starts. Below, we also want to know where each one ends.
+    #"""
+
+
+    #numkeys=len(keywords)
+    #ends=[]
+    #endsection=[]
+    #for x in keywords:
+        #ends.append([x][0][0])
+
+    #ends=ends[1:]
+    #for x in ends:
+        #y=x-1
+        #endsection.append(y)
+
+    #endsection.append(len(a)) # final word in the ontology.
+
+    #sections={}
+    #n=0
+    #for x in keywords:
+        #t=(x[0],endsection[n])
+        #sections[x[1]]=t
+        #n+=1
+
+    #"""
+    #Now the sections dictionary contains a tuple of the postions of the starting word and the ending word.
+    #i.e.  {u'term_binding': (203, 213), u'term_definitions': (3, 107), u'constraint_definitions': (108, 202), u'terminologies_available': (0, 2), u'constraint_binding': (214, 233)}
+
+    #We need to process the sections in the order that they are expected to appear so that they will work correctly.
+    #"""
+
+    ##print "Sections: ",sections
+    #f.write('\n        # Terminologies Available Section \n')
+
+    ## process terminologies available
+    #if sections.has_key(u'terminologies_available'):
+        #begin=sections[u'terminologies_available'][0]+1 # first location past the keyword
+        #end=sections[u'terminologies_available'][1]+1
+        #f.write("        termAvail=[")
+        #for v in range(begin,end):
+            #f.write("u'"+ontlist[v]+"',")
+            #termAvail.append(ontlist[v])
+        #f.write("]\n")
+    #else:
+        #f.write("        termAvail=[]")
+
+    ## process termCodes as .po files. Initially all languages will be in one file.
+    ## will split them out for easier management later.
+    #po_file = open(xsd_filesDir+class_name+'.po','w')
+    #x = sections['term_definitions'][0]
+    #attxt = ''
+    #for n in range(sections['term_definitions'][0],sections['term_definitions'][1]):
+        #extstr = ''
+        #pstr = ''
+        #if ontlist[n] in lang_list:
+            #print "\n **** New Language = " + ontlist[n]
+            #po_file.write("\n **** New Language = " + ontlist[n]+'\n')
+
+        #elif ontlist[n] == 'description':
+            #extstr = '_description'
+            #pstr = ontlist[x+1]
+        #elif ontlist[n] == 'text':
+            #extstr = '_text'
+            #pstr = ontlist[x+1]
+        #elif ontlist[n][0:2]=='at':
+            #attxt = ontlist[n]
+
+        #if extstr.startswith("_text") or extstr.startswith("_description"):
+            ##print class_name + '_' + attxt + pstr
+            #print "msgid " + '"'+class_name + '_' + attxt + extstr +'"'+'\n'
+            #print "msgstr " + '"'+pstr+'"'+'\n\n'
+            #pstr = pstr.encode('utf-8')
+            #po_file.write("msgid " + '"'+class_name + '_' + attxt + extstr +'"'+'\n')
+            #try:
+                #po_file.write("msgstr " + '"'+pstr+'"'+'\n\n')
+            #except:
+                #po_file.write("msgstr -- couldn't encode to utf-8.\n\n")
+
+        #x += 1
+
+    #po_file.close()
+
+    #f.write('\n        # Term Code Section \n')
+    #if sections.has_key(u'term_definitions'):
+        #begin=sections[u'term_definitions'][0]+1 # first location past the keyword
+        #end=sections[u'term_definitions'][1]
+        ## now locate the begininng of each language section
+        #lang_point=[]
+        #for v in range(begin,end):
+            #if ontlist[v] in lang_list:
+                #lang_point.append(v)
+
+        #f.write("        termCodes={")
+        #for v in range(begin,end): # the range of the termcode section in ontlist
+            #if v in lang_point:
+                #f.write(repr(ontlist[v])+':{')
+            #else:
+                #try:
+                    #if ontlist[v+1] in lang_list: #is the next entry a new language?
+                        #if ontlist[v+1] == u'en':
+                            #f.write(repr(ontlist[v])+')]}}\n\n')
+                        #else:
+                            #f.write(repr(ontlist[v])+']},\n #REMOVE THIS LANGUAGE - This is where the PO file utility needs to be called. \n        {')
+                    #else:
+                        #if ontlist[v] != u'items':
+                            #if ontlist[v][0:2]=='at':
+                                #f.write('        '+repr(ontlist[v])+':[')
+                            #elif ontlist[v+1][0:2]=='at':
+                                #f.write(repr(ontlist[v])+'],\\\n')
+
+                            #else:
+                                #f.write(repr(ontlist[v])+',')
+                #except IndexError:
+                    #break # we're at the end
+
+        #f.write(")]}}\n")
+    #else:
+        #f.write("        termCodes={}")
+
+    ##process constraint codes
+    #f.write('\n        # Constraint Code Section \n')
+    #if sections.has_key(u'constraint_definitions'):
+        #begin=sections[u'constraint_definitions'][0]+1 # first location past the keyword
+        #end=sections[u'constraint_definitions'][1]
+        ## now locate the begininng of each language section
+        #lang_point=[]
+        #for v in range(begin,end):
+            #if ontlist[v] in lang_list:
+                #lang_point.append(v)
+
+        #f.write("        constCodes={")
+        #for v in range(begin,end): # the range of the constraint code section in ontlist
+            #if v in lang_point:
+                #f.write(repr(ontlist[v])+':{')
+            #else:
+                #try:
+                    #if ontlist[v+1] in lang_list: #is the next entry a new language?
+                        ##print "lang code: ",ontlist[v+1]
+
+                        #f.write(repr(ontlist[v])+']}},\\\n        {')
+                    #else:
+                        #if ontlist[v] != u'items':
+                            #if ontlist[v][0:2]=='at':
+                                #f.write('        '+repr(ontlist[v])+':[')
+                            #elif ontlist[v+1][0:2]=='ac':
+                                #f.write(repr(ontlist[v])+'],\\\n')
+
+                            #else:
+                                #f.write(repr(ontlist[v])+',')
+                #except IndexError:
+                    #break # we're at the end
+
+        #f.write("]}}\n")
+    #else:
+        #f.write("        constCodes={}")
+
+    ##process term bindings
+
+    #f.write('\n        # Term Binding Section \n')
+    #if sections.has_key(u'term_binding'):
+        #begin=sections[u'term_binding'][0]+1 # first location past the keyword
+        #end=sections[u'term_binding'][1]+1
+        #f.write("        term_binding={")
+        #try:
+            #for v in range(begin,end,2):
+                #if ontlist[v] in termAvail:
+                    #f.write("u'"+ontlist[v]+"':[")
+                #else:
+                    #if ontlist[v] != u'items':
+                        #f.write("{u'"+ontlist[v]+"':u'"+ontlist[v+1]+"'},")
+        #except IndexError:
+            #pass # we're at the end
+
+        #f.write("]}\n")
+    #else:
+        #f.write("        term_binding={}")
+
+
+
+
+    ##process constraint bindings
+
+    #f.write('\n        # Constraint Binding Section \n')
+    #if sections.has_key(u'constraint_binding'):
+        #begin=sections[u'constraint_binding'][0]+1 # first location past the keyword
+        #end=sections[u'constraint_binding'][1]+1
+        #f.write("        constraint_binding={")
+        #try:
+            #for v in range(begin,end,2):
+                #if ontlist[v] in termAvail:
+                    #f.write("u'"+ontlist[v]+"':[")
+                #else:
+                    #if ontlist[v] != u'items':
+                        #f.write("{u'"+ontlist[v]+"':u'"+ontlist[v+1]+"'},")
+        #except IndexError:
+            #pass # we're at the end
+
+        #f.write("]}\n")
+    #else:
+        #f.write("        constraint_binding={}")
+
+
+    #f.write("\n        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)")
+
+    ## Now build the definition section
+    #f.write("\n\n        # Definition Section Begins Here. We build it from the leaf nodes up.\n\n")
+
+
+    #definList=flatten(parsed_adl.definition)
+    #definList.reverse()
+
+    #n=len(definList)
+    #f.write("        #Length of DefinList= "+repr(n)+'\n')
+    #m=0
+    #for x in definList:
+        #nodeid=""
+        ##strip off the nodeid if there is one
+        #if isinstance(x,basestring) and x.find('_at')!=-1:
+            #nodeid=x[x.find('_at'):]
+            #f.write("        nodeid=u'"+nodeid.strip('_')+"'\n")
+            #x = x[:x.find('_at')]
+
+        #className=getClassName(x)
+        #if className is None:
+            #f.write("        #"+repr(x)+'\n')
+        #else:
+            #if m == n-1: # If at the last class name then assign it to the archetype definition.
+                #f.write("        self.definition="+className+'\n')
+            #else:
+                #f.write("        "+className+'\n')
+
+        #m+=1 # counting which item of the list we are at.
+
+
+    #Finished building the Archetype class
+    f.close()
+    return
+
+
+def flatten(x):
+    """flatten(sequence) -> list
+
+    Returns a single, flat list which contains all elements retrieved
+    from the sequence and all recursively contained sub-sequences
+    (iterables). All strings are converted to unicode.
+
+    """
+    result = []
+    for el in x:
+        #if isinstance(el, (list, tuple)):
+        if hasattr(el, "__iter__") and not isinstance(el, basestring):
+            result.extend(flatten(el))
+        else:
+            result.append(el)
+
+
+    # all strings must be unicode
+    rtnlist=[]
+    for x in result:
+        if isinstance(x,str):
+            # replace any brackets so Python doesn't think it's a list and we still havea seperator.
+            x=x.replace('[','_')
+            x=x.replace(']','_')
+            try:
+                x=unicode(x, "utf8")  # need more decode types here
+            except UnicodeDecodeError:
+                x=unicode(x, "latin1")
+            except UnicodeDecodeError:
+                x=unicode(x,"iso-8859-1")
+            except UnicodeDecodeError:
+                x=unicode(x,"eucJP")
+
+        rtnlist.append(x)
+
+    return rtnlist
+
+
+#if __name__ == "__main__":
+        #CreateAT()

=== added file 'src/oship/mlhim/adl2xsd.pyc'
Binary files src/oship/mlhim/adl2xsd.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/adl2xsd.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/adl_1_4.py'
--- src/oship/mlhim/adl_1_4.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/adl_1_4.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,333 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the Mozilla Public License Version 1.1 - see docs/OSHIP-LICENSE.txt
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+
+__author__  = 'Paul McGuire <paul@xxxxxxxxxxxxxxxxxxxxxxx>'
+__docformat__ = 'plaintext'
+__version__ = '1.1'
+__contributors__ = 'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+
+from pyparsing import *
+ParserElement.enablePackrat()
+
+__all__ = "archetypeDefinition"
+
+try:
+    import psyco
+    psyco.full()
+except ImportError:
+    pass
+
+# set this to True to do low-level testing of individual parser expressions
+inline_validating = False
+
+LT,GT,EQ,LPAR,RPAR,LBRK,RBRK,BAR,QUOT,SEMI,LBRC,RBRC,STAR,COLON,COMMA = \
+    map(Suppress,"<>=()[]|';{}*:,")
+uppers = srange("[A-Z]")
+lowers = uppers.lower()
+idchars = alphanums+"_"
+v_type_identifier = Word(uppers, idchars)
+v_generic_type_identifier = Regex(r"[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>")
+type_identifier = Regex(r"[A-Z][a-zA-Z0-9_]*(<[a-zA-Z0-9,_<>]+>)?")
+attr_identifier = Word(lowers, idchars)
+any_identifier = type_identifier | attr_identifier
+local_term_code_ref = Regex(r"\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]")
+local_code = Regex(r"a[ct][0-9.]+")
+
+ELLIPSIS = Literal("...")
+quotedString = QuotedString('"',unquoteResults=True,multiline=True) | QuotedString("[",endQuoteChar="]",unquoteResults=False)
+fileref = delimitedList(Word(alphanums+"-_"),".",combine=True)
+regex = QuotedString("/",escQuote='\\',unquoteResults=False)
+assert "/.*/" == regex
+string_ = QuotedString('"',escQuote='\\') | regex
+
+path_segment = attr_identifier + Optional(local_term_code_ref)
+relative_path = delimitedList(path_segment,'/',combine=True)
+absolute_path = Combine('/' + Optional(relative_path))
+
+key = attr_identifier | (LBRK+quotedString+RBRK)
+real = Combine(Word("+-"+nums,nums)+"."+Optional(Word(nums)))
+sign = oneOf("+ -")
+integer = Combine( Optional(sign) + (Combine(Word(nums,max=3)+OneOrMore(','+Word(nums,exact=3))
+                 ).setParseAction(lambda t:t[0].replace(',','')) | Word(nums) ) )
+integer.setParseAction(lambda t:int(t[0]))
+if inline_validating:
+    assert '1,000' == integer
+    assert '1,3' != integer
+    assert '123,456' == integer
+
+realLead = ( (Word(nums,max=3)+OneOrMore('_'+Word(nums,exact=3))
+                 ).setParseAction(lambda t:t[0].replace('_','')) | Word(nums) ) +\
+            FollowedBy('.') + ~FollowedBy('..')
+real = Combine(Optional(sign) +
+                ( realLead + '.' + Optional(Word(nums)) + Optional(Regex('[eE][+-]?[0-9]+')) |
+                  '.' + Word(nums) + Optional(Regex('[eE][+-]?[0-9]+')) ) )
+real.setParseAction(lambda t:float(t[0]))
+if inline_validating:
+    assert '.1' == real
+    assert '0.' == real
+    assert '1.E2' == real
+    assert '.1E2' == real
+    assert '.E2' != real
+    assert '.' != real
+    assert '1_000.' == real
+    assert '123_4.' != real
+    assert '123_456.' == real
+    assert '1..' != (real + '.')
+    number = real | integer
+    assert '1..3' == (number + '..' + number)
+    assert '1.2..3.4' == (number + '..' + number)
+
+uri = Combine(Word(alphas) + '://' + CharsNotIn(" >"))
+val = real | integer | attr_identifier
+valueDef = Forward()
+valueDef << Group( key + EQ + LT +
+        Optional( Dict(OneOrMore( valueDef )) |
+          (quotedString + ~Literal(",")) |
+          Group(delimitedList(quotedString | ELLIPSIS) ) |
+          QuotedString("|", unquoteResults=False) |
+          real | integer | uri
+        ) + GT )
+
+# expressions specific to the Definition section (uses cADL)
+MATCHES, IS_IN, OCCURRENCES, EXISTENCE, CARDINALITY, ORDERED, UNORDERED, UNIQUE, INFINITY = \
+    map(CaselessKeyword,
+        "matches is_in occurrences existence cardinality ordered unordered unique infinity".split())
+MATCHES = MATCHES.suppress()
+IS_IN = IS_IN.suppress()
+USE_NODE, USE_ARCHETYPE, ALLOW_ARCHETYPE = \
+    map(CaselessKeyword, "use_node use_archetype allow_archetype".split())
+THEN, ELSE, AND, OR, XOR, NOT, IMPLIES, EXISTS, TRUE, FALSE, FORALL = \
+    map(CaselessKeyword, "then else and or xor not implies exists true false forall".split())
+INCLUDE, EXCLUDE = \
+    map(CaselessKeyword, "include exclude".split())
+
+str_ = dblQuotedString
+character = Combine("'" + ( Word(printables.replace("\\"," "),exact=1) |
+                            Word('\\',r"\ntrf'",exact=2) |
+                            Word('\\',nums,min=2) |
+                            Word('&',alphanums+"_") + ";" |
+                            "&#x" + Word(nums,exact=4) ) + "'")
+arithOperand = real | integer | str_ | character | absolute_path | attr_identifier
+arithExpr = operatorPrecedence(arithOperand,
+    [
+    ("-", 1, opAssoc.RIGHT),
+    (oneOf("+ - / * ^"), 2, opAssoc.LEFT),
+    ])
+if inline_validating:
+    assert '-100' == arithExpr
+    assert 'mx+b' == arithExpr
+
+comparisonOperator = oneOf("= != < > <= >=")
+arithComparison = arithExpr + comparisonOperator + arithExpr
+if inline_validating:
+    assert 'y = mx + b' == arithComparison
+
+c_primitive = Forward()
+boolOperand = (EXISTS + absolute_path  |
+    Group(relative_path + (MATCHES | IS_IN) + Group(LBRC + c_primitive + RBRC)) |
+    TRUE | FALSE | arithComparison )
+boolExpr = operatorPrecedence(boolOperand,
+    [
+    (NOT, 1, opAssoc.RIGHT),
+    ((AND | OR | XOR | IMPLIES), 2, opAssoc.LEFT),
+    ] )
+
+c_object = Forward()
+complex_object_id = Combine(type_identifier + Optional(local_term_code_ref))
+occurrence_spec = (integer("min") + '..' + (integer|"*")("max"))("range") | integer("exact") | Literal("*")("any")
+defaultOccurrences = ParseResults([1, '..', 1])
+defaultOccurrences["min"] = 1
+defaultOccurrences["max"] = 1
+defaultOccurrences["exact"] = 1
+c_occurrences = Optional(Group(OCCURRENCES + (MATCHES|IS_IN) + Group(LBRC + occurrence_spec + RBRC)), default=defaultOccurrences)("occurrences")
+complex_object_head = complex_object_id("id") + c_occurrences
+existence_spec = Group(integer("min") + '..' + integer("max"))("range") | integer("exact")
+c_existence = EXISTENCE + (MATCHES | IS_IN) + Group(LBRC + existence_spec + RBRC)
+cardinality_spec = Group(occurrence_spec)("occurs") + ( Optional(SEMI + (ORDERED|UNORDERED)("order")) & Optional(SEMI + UNIQUE("unique")) )
+c_cardinality = CARDINALITY + (MATCHES | IS_IN) + Group(LBRC + cardinality_spec + RBRC)
+c_attribute_head = attr_identifier + Optional(c_existence)("existence") + Optional(c_cardinality)("cardinality")
+c_attribute = c_attribute_head + (MATCHES | IS_IN) + Group(LBRC + OneOrMore(c_object) + RBRC)
+complex_object_body = Literal("*")("any") | Dict(OneOrMore(Group(c_attribute)))("attributes")
+c_complex_object = \
+    Group(complex_object_head + (MATCHES | IS_IN) + Group( LBRC + complex_object_body + RBRC )("body"))
+archetype_internal_ref = USE_NODE + type_identifier + c_occurrences + absolute_path
+
+assertion = ( any_identifier("id") + COLON + Group(boolExpr) | Group(boolExpr) )
+c_includes = Group(INCLUDE + OneOrMore(assertion))
+c_excludes = Group(EXCLUDE + OneOrMore(assertion))
+archetype_slot = (ALLOW_ARCHETYPE + type_identifier + Optional(local_term_code_ref) + c_occurrences + \
+    MATCHES + Group( LBRC + (Optional(c_includes, default=["include",[]]) & Optional(c_excludes, default=["exclude",[]])) + RBRC ))
+constraint_ref = local_term_code_ref
+code = Regex(r"[a-zA-Z0-9._\-]+")
+c_term_code_constraint = Group(LBRK + Regex(r"[a-zA-Z0-9()._\-]+::")("terminologyId") +
+    Optional(delimitedList(code)("term_codes") +
+             Optional(SEMI + code("assumedValue"))) +
+    RBRK)
+qualified_term_code_ref = Regex(r"[[a-zA-Z0-9._\-()]+::[a-zA-Z0-9._\-]+\]")
+c_code_phrase = c_term_code_constraint | qualified_term_code_ref
+ordinal = Group( integer + "|" + qualified_term_code_ref )
+c_ordinal = delimitedList(ordinal) + Optional(SEMI + integer)
+make_interval = lambda expr : \
+    Group("|" + ( expr("min") + ".." + expr("max") |
+        ">" + expr("min") + ".." + expr("max") |
+        expr("min") + ".." + "<" + expr("max") |
+        ">" + expr("min") + ".." + "<" + expr("max") |
+        "<=" + expr |
+        "<" + expr |
+        ">=" + expr |
+        ">" + expr |
+        expr ) + "|" )
+c_real_interval = make_interval(real)
+c_real = (real + "," + "..." | delimitedList(real) | c_real_interval) + Optional(SEMI + real("assumedValue"))
+date_constraint_pattern = Regex(r"[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]")
+date_value = Regex(r"[0-9]{4}-[0-1][0-9](-[0-3][0-9])?")
+date_interval = make_interval(date_value)
+c_date_constraint = date_constraint_pattern | date_value | date_interval
+c_date = c_date_constraint + Optional(SEMI + date_value("assumedValue"))
+time_constraint_pattern = Regex(r"[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]")
+time_value = Regex(r"[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?")
+time_interval = make_interval(time_value)
+c_time_constraint = time_constraint_pattern | time_value | time_interval
+c_time = c_time_constraint + Optional(SEMI + time_value("assumedValue"))
+date_time_constraint_pattern = Regex(r"[yY][yY][yY][yY]-[mM?][mM?]-[dD?X][dD?X][T ][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]")
+datetime_value = Regex(r"[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|"
+    r"[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|"
+    r"[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?")
+datetime_interval = make_interval(datetime_value)
+c_datetime_constraint = date_time_constraint_pattern | datetime_value | datetime_interval
+c_datetime = c_datetime_constraint + Optional(SEMI + datetime_value("assumedValue"))
+duration_constraint_pattern = Regex(r"P[yY]?[mM]?[Ww]?[dD]?T[hH]?[mM]?[sS]?|P[yY]?[mM]?[Ww]?[dD]?")
+duration_value = Regex(r"P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?[T ]([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|"
+    r"P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?")
+duration_interval = make_interval(duration_value)
+c_duration_constraint = duration_constraint_pattern | duration_value | duration_interval
+c_duration = c_duration_constraint + Optional(SEMI + duration_value("assumedValue"))
+c_integer_interval = make_interval(integer)
+c_integer = (integer + "," + "..." | delimitedList(integer) | c_integer_interval) + Optional(SEMI + integer("assumedValue"))
+c_string = (string_ + "," + "..." | delimitedList(string_)) + Optional(SEMI + string_("assumedValue"))
+c_boolean = (TRUE + "," + FALSE | FALSE + "," + TRUE | TRUE | FALSE) + Optional(SEMI + (TRUE | FALSE)("assumedValue"))
+c_primitive << (c_real | c_datetime | c_date | c_time | c_duration | c_integer | c_string | c_boolean)
+
+domain_value = Forward()
+array_ref = LBRK + dblQuotedString + RBRK
+domain_value << ( LT + Optional( Dict(OneOrMore( Group((attr_identifier|array_ref) + EQ + domain_value) ) ) |
+                        QuotedString('"',escQuote='\\',multiline=True) | qualified_term_code_ref | c_primitive
+                                    ) + GT )
+domain_type = (type_identifier + domain_value)
+
+assert """
+"Collection of archetypes used to support clinical management
+"
+""" == QuotedString('"',escQuote='\\',multiline=True)
+
+c_object << Group( (c_complex_object | archetype_internal_ref | archetype_slot | constraint_ref |
+                c_code_phrase | c_ordinal | domain_type ) | c_primitive )
+
+# section names
+ARCHETYPE, CONCEPT, LANGUAGE, DESCRIPTION, DEFINITION, INVARIANT, ONTOLOGY, REVISION_HISTORY = \
+    map(CaselessKeyword,
+        "archetype concept language description "
+        "definition invariant ontology revision_history".split())
+SPECIALIZE = CaselessKeyword("specialize") | CaselessKeyword("specialise")
+
+# ADL file sections:
+versionNum = delimitedList(Word(nums),'.',combine=True)
+archetypeSection = ARCHETYPE + LPAR + \
+                    Dict(delimitedList(Group(key + EQ + (versionNum | val) |
+                                             "controlled" | "uncontrolled"),";")) + \
+                    RPAR + fileref("name_version")
+specializeSection = SPECIALIZE + fileref("name_version")
+conceptSection = CONCEPT + quotedString
+languageSection = LANGUAGE + Dict(OneOrMore(valueDef))
+descriptionSection = DESCRIPTION + Dict(OneOrMore(valueDef))
+definitionSection = DEFINITION + c_object
+invariantSection = INVARIANT + Dict(ZeroOrMore(attr_identifier + COLON + boolExpr) )
+ontologySection = ONTOLOGY + Dict(OneOrMore(valueDef))
+revisionHistorySection = REVISION_HISTORY + Dict(OneOrMore(valueDef))
+archetypeDefinition = SkipTo(archetypeSection)("headerBytes") + Dict(
+    Group(archetypeSection) + \
+    Optional(Group(specializeSection), default=["specialize",[]]) + \
+    Optional(Group(conceptSection), default=["concept",[]]) + \
+    Group(languageSection) + \
+    Group(descriptionSection) + \
+    Group(definitionSection) + \
+    Optional(invariantSection, default=["invariant",[]]) + \
+    Group(ontologySection) + \
+    Optional(Group(revisionHistorySection), default=["revision_history",[]])) + \
+    StringEnd()
+
+comment = "--" + restOfLine
+archetypeDefinition.ignore(comment)
+
+
+if __name__ == "__main__":
+    from glob import glob
+    from pprint import pprint
+    import time
+
+    def secondsToStr(t):
+        rediv = lambda ll,b : list(divmod(ll[0],b)) + ll[1:]
+        return "%d:%02d:%02d.%03d" % \
+                    tuple(reduce(rediv,[[t*1000,],1000,60,60]))
+
+    #~ fnams = glob("examples/*.adl")
+    fnams = sum( [ glob(subdir+"/*.adl") for subdir in glob("samples/*") ], [] )
+    #~ fnams.remove("samples\cluster\openEHR-EHR-CLUSTER.coordination.v1.adl")
+
+    #~ fnams = [r"samples/section\openEHR-EHR-SECTION.management.v1draft.adl"]
+    #~ fnams = [r"samples\cluster\openEHR-EHR-CLUSTER.checklist_item-addition.v2.adl"]
+    #~ fnams = [r"samples\cluster\openEHR-EHR-CLUSTER.cranial_nerves.v1.adl"]
+    #~ fnams = [r"samples\cluster\openEHR-EHR-CLUSTER.exam-fetus.v4.adl"]
+    #~ fnams = r"""samples\structure\openEHR-EHR-ITEM_TREE.follow_up-immunisation.v1.adl
+                #~ samples\structure\openEHR-EHR-ITEM_TREE.follow_up-laboratory.v1.adl""".split()
+
+
+    stats = [0,0]
+    failedFiles = []
+    start = time.time()
+    for fnam in fnams:
+        adlSource = file(fnam).read()
+
+        passed = False
+        try:
+            archetypeObj = archetypeDefinition.parseString(adlSource)
+            passed = True
+        except ParseException, pe:
+            failedFiles.append(fnam)
+
+
+        if passed:
+            #~ print archetypeObj.dump()
+            #~ if archetypeObj.ontology.terminologies_available:
+                #~ print archetypeObj.ontology.terminologies_available
+            if archetypeObj.revision_section:
+                print archetypeObj.revision_section.dump()
+
+            #~ print "Definition:"
+
+            #~ for defn in archetypeObj.definition:
+                #~ print defn.dump()
+
+            #~ if "original_author" in archetypeObj.description:
+                #~ print archetypeObj.description.original_author.email
+            #~ print archetypeObj.language.original_language
+            #~ print
+
+        stats[passed] += 1
+
+        if sum(stats) % 10 == 0:
+            print "%d/%d %d passed, %d failed" % (sum(stats), len(fnams), stats[True], stats[False])
+
+    end = time.time()
+    print "Elapsed time to parse %d files: %s" % (sum(stats), secondsToStr(end-start))
+    print "Succeeded: %d  Failed: %d" % (stats[True],stats[False])
+    if stats[0]:
+        print "Failed files:"
+        print "\n".join(failedFiles)

=== added file 'src/oship/mlhim/adl_1_4.pyc'
Binary files src/oship/mlhim/adl_1_4.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/adl_1_4.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/archetype.png'
Binary files src/oship/mlhim/archetype.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/archetype.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/archetype.py'
--- src/oship/mlhim/archetype.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/archetype.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,1847 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2009, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the MPL license.
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+# This is a version of archetype.py that uses Grok fully except where it would effect openEHR data interchange.
+# In other words everything to do with internal processing uses Grok
+# These classes are used by the Python source versions of OSHIP vs. the ones in the 'ar'
+
+
+__author__  = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'<name> <email address>'
+
+
+import grok
+
+from zope.interface import Interface
+from zope.schema import (TextLine,Object,Set,Field,Int,List,Bool,Date,
+                         Datetime,Float,Time,Field,Dict)
+from zope.schema.interfaces import IField
+from zope.i18nmessageid import MessageFactory
+
+from oship.mlhim.rm.support.interfaces import IArchetypeId,IUidBasedId,IObjectRef
+from oship.mlhim.rm.common.resource import AuthoredResource
+from oship.mlhim.rm.datatypes.quantity.interfaces import IDvInterval
+
+
+_ = MessageFactory('oship')
+
+
+class IArchetypeTerm(Interface):
+    """ontology term codes schema"""
+
+    language=TextLine(
+        title=_(u"Language"),
+        description=_(u"The language of the term.")
+    )
+
+    items=List(
+        title=_(u"Items"),
+        description=_(u"The list the code id, language, followed by a dictionay of items for each at/ac node id."),
+    )
+
+
+    def keys(self):
+        """
+        List of all keys used in this term.
+        """
+
+
+class ArchetypeTerm(grok.Model):
+    """build an archetype term"""
+
+    grok.implements(IArchetypeTerm)
+    def __init__(self):
+        # some defaults
+        self.language=u"en"
+        self.code=u"at0000"
+        self.items={}
+
+    def keys(self):
+        """
+        List of all keys used in this term.
+        """
+
+        return self.items.keys()
+
+class ICAttribute(Interface):
+    """
+    Abstract model of constraint on any kind of attribute code.
+    """
+
+    rmAttributeName=TextLine(
+        title=_(u"RM Attribute Name"),
+        description=_(u"Reference model attribute within the enclosed type representedby a CObject."),
+        required = True,
+    )
+
+    existence=Object(
+        schema = IDvInterval,
+        title=_(u"Existence"),
+        description=_(u"Indicates whether the target object exists or not. It is an Integer Interval"),
+        required = True,
+    )
+
+    children=List(
+        title=_(u"Children"),
+        description=_(u"Child constraint nodes."),
+        required=False,
+    )
+
+
+class ICComplexObject(Interface):
+    """
+    Constraint on complex objects.
+    """
+
+    attributes=Set(
+        title=_(u"Attributes"),
+        description=_(u"List of constraints on attributes of the reference model."),
+        required=False,
+        value_type=Object(schema=ICAttribute),
+    )
+
+    anyAllowed=Bool(
+        title=_(u"Any Allowed"),
+        description=_(u"True if any value of the reference model is allowed."),
+
+    )
+
+    def anyAllowed():
+        """True if any value of the reference model is allowed.
+        """
+
+class IArchetypeOntology(Interface):
+    """
+    Local ontology of an archetype.
+    """
+
+    specialisationDepth=Int(
+        title=_(u"Specialisation Depth"),
+        description=_(u"Specialisation depth of this archetype."),
+
+    )
+
+    parentArchetype=Object(
+        schema=IObjectRef,
+        title=_(u"Parent"),
+        description=_(u"Archetype which owns this ontology."),
+        required=False,
+    )
+
+    def hasLanguage(aLang):
+        """
+        True if aLang is present in ontology.
+        """
+
+    def hasTerminology(aTermId):
+        """
+        True if ontology has aTermId, terminology Id.
+        """
+
+    def hasTermCode(tcode):
+        """
+        True if tcode is in termCodes.
+        """
+
+    def hasConstraintCode(ccode):
+        """
+        True if ccode is in constraintCodes.
+        """
+
+    def constraintDefinition(aLang,aCode):
+        """
+        Constraint definition for aCode expressed in aLang.
+        """
+
+    def termBinding(aTermId,aCode):
+        """
+        Return a CodePhrase for aCode in aTermId.
+        """
+
+    def constraintBinding(aTermId,aCode):
+        """
+        Return a string that describes the constraint aCode in aTermId usually in the form of a query expression.
+        """
+
+
+class IExprItem(Interface):
+    """
+    Abstract parent of allexpression tree items.
+    """
+
+    type_=TextLine(
+        title=_(u"Type"),
+        description=_(u"Mathematical type name of this expression."),
+
+    )
+
+class IAssertionVariable(Interface):
+    """
+    Definition of named variable.
+    """
+
+    name=TextLine(
+        title=_(u"Name"),
+        description=_(u"Name of variable."),
+
+    )
+
+    definition=TextLine(
+        title=_(u"Definition"),
+        description=_(u"Formal definition of variable."),
+
+    )
+
+
+
+class IAssertion(Interface):
+    """
+    Structural model of a typed first order predicate logic assertion
+    in the forma of an expression tree including optional variable definitions.
+    """
+
+    tag=TextLine(
+        title=_(u"Tag"),
+        description=_(u"Used for differentiating multiple assertions."),
+        required=False,
+    )
+
+    expression=Object(
+        schema=IExprItem,
+        title=_(u"Expression"),
+        description=_(u"Root of expression tree."),
+
+    )
+
+    stringExpression=TextLine(
+        title=_(u"String Expression"),
+        description=_(u"String form of expression."),
+        required=False,
+    )
+
+    variables=List(
+        title=_(u"Variables"),
+        description=_(u"Variable definitions used in the assertion."),
+        required=False,
+        value_type=Object(schema=IAssertionVariable),
+    )
+
+class IArchetype(Interface):
+    """
+    Archetype equivalent to ARCHETYPED class in Common reference model.
+    Defines semantics of identification, lifecycle, versioning, composition
+    and specialisation.
+    """
+
+    adlVersion = TextLine(
+        title = _(u"adlVersion"),
+        description = _(u"""ADL version if archteype was read in from an ADL sharable archetype."""),
+        required = False,
+        readonly = True,
+    )
+
+    archetypeId=Object(
+        schema=IArchetypeId,
+        title=_(u"Archetype Id"),
+        description=_(u"Multi-axial identifier of this archetype."),
+
+    )
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"UID"),
+        description=_(u"OID of this archetype."),
+        required=False,
+    )
+
+    concept=TextLine(
+        title=_(u"Concept"),
+        description=_(u"The normative meaning of archetype as a whole."),
+
+        readonly = True,
+    )
+
+    parentArchetypeId=Object(
+        schema=IArchetypeId,
+        title=_(u"Parent Archetype Id"),
+        description=_(u"Identifier of the specialisation parent of this archetype."),
+        required=False,
+    )
+
+    definition=Object(
+        schema=ICComplexObject,
+        title=_(u"Definition"),
+        description=_(u"Root node of this archetype."),
+
+    )
+
+    ontology=Object(
+        schema=IArchetypeOntology,
+        title=_(u"Ontology"),
+        description=_(u"The ontology of the archetype"),
+
+    )
+
+    invariants=Set(
+        title=_(u"Invariants"),
+        description=_(u"FOPL invariant statements"),
+        required=False,
+        value_type=Object(schema=IAssertion),
+    )
+
+    def version():
+        """
+        Version string extracted from id.
+        """
+
+    def previousVersion():
+        """
+        Version of predecessor if any.
+        """
+
+    def shortConceptName():
+        """
+        String extracted from id.
+        """
+
+    def conceptName():
+        """
+        Concept string extracted from the ontology.
+        """
+
+    def physicalPaths():
+        """
+        Set of Xpath like statements extracted from
+        CObject.nodeId and CAttribute.rmAttributeName
+        """
+
+    def logicalPaths():
+        """
+        Set of Xpath like statements extracted from
+        CObject.nodeId and CAttribute.rmAttributeName
+        except the nodeIds are replaced by their meanings from the ontology.
+        """
+
+    def isSpecialised():
+        """
+        True if this archetype is a specialisation of another.
+        Otherwise it returns False.
+        """
+
+    def specialisationDepth():
+        """
+        Return ontology.specialisationDepth
+        """
+
+    def nodeIdsValid():
+        """
+        Return True if every CObject.nodeId is found
+        in the ontolgy.termCodes
+        """
+
+    def internalReferencesValid():
+        """
+        True if every ArchetypeInternalRef.targetPath
+        refers to a legitimate node in the archetype definition.
+        """
+
+    def constraintReferencesValid():
+        """
+        True if every ConstraintRef.reference found in CObject nodes
+        definition is found in ontology.constraintCodes
+        """
+
+    def isValid():
+        """
+        Return True if the archetype is overall valid.
+        """
+
+
+class Archetype(AuthoredResource,grok.Model):
+    _(u"""
+    Archetype equivalent to ARCHETYPED class in Common reference model.
+    Defines semantics of identfication, lifecycle, versioning, composition
+    and specialisation.
+    """)
+
+    grok.implements(IArchetype)
+
+    def __init__(self,adlVersion,archetypeId,uid,concept,parentArchetypeId,definition,ontology,invariants,originalLanguage,translations,description,revisionHistory,isControlled):
+        self.adlVersion=adlVersion
+        self.archetypeId=archetypeId
+        self.uid=uid
+        self.concept=concept
+        self.parentArchetypeId=parentArchetypeId
+        self.definition=definition
+        self.ontology=ontology
+        self.invariants=invariants
+        AuthoredResource.__init__(self,originalLanguage,translations,description,revisionHistory,isControlled)
+
+
+    def version(self):
+        """
+        Version string extracted from id.
+        """
+        return u"version id"
+
+    def previousVersion(self):
+        """
+        Version of predecessor if any.
+        """
+        return u"previous version id"
+
+    def shortConceptName(self):
+        """
+        String extracted from id.
+        """
+        return "Short Concept name"
+
+    def conceptName(self, language=None):
+        """
+        Concept string extracted from the ontology.
+        """
+        return u"concept name"
+
+    def physicalPaths(self):
+        """
+        Set of Xpath like statements extracted from
+        CObject.nodeId and CAttribute.rmAttributeName
+        """
+        return u"Some XPath"
+
+    def logicalPaths(self):
+        """
+        Set of Xpath like statements extracted from
+        CObject.nodeId and CAttribute.rmAttributeName
+        except the nodeIds are replaced by their meanings from the ontology.
+        """
+        return u"Some XPath"
+
+    def isSpecialised(self):
+        """
+        True if this archetype is a specialisation of another.
+        Otherwise it returns False.
+        """
+        return False
+
+    def specialisationDepth(self):
+        """
+        Return ontology.specialisationDepth
+        """
+        return self.ontology.specialisationDepth
+
+    def nodeIdsValid():
+        """
+        Return True if every CObject.nodeId is found
+        in the ontolgy.termCodes
+        """
+        return True
+
+    def internalReferencesValid(self):
+        """
+        True if every ArchetypeInternalRef.targetPath
+        refers to a legitimate node in the archetype definition.
+        """
+        return True
+
+    def constraintReferencesValid(self):
+        """
+        True if every ConstraintRef.reference found in CObject nodes
+        definition is found in ontology.constraintCodes
+        """
+        return True
+
+    def isValid(self):
+        """
+        Return True if the archetype is overall valid.
+        """
+        return True
+
+
+class IValidityKind(Interface):
+    """
+    An enumeration of three values which may commonly occur in constrint models.
+    Use to indicate the validity of date/Time fields etc.
+
+
+    #constants
+    mandatory=1001
+    optional=1002
+    disallowed=1003
+    """
+    value = Int(
+        title = _(u"Value"),
+        description = _(u"Actual value."),
+
+    )
+
+    def validValidity():
+        """
+        Test if value is == to one of the constants.
+        """
+
+
+class ValidityKind(grok.Model):
+    _(u"""
+    An enumeration of three values which may commonly occur in constraint models.
+    Use to indicate the validity of date/Time fields etc.
+    """)
+
+    grok.implements(IValidityKind)
+
+    constants = {'mandatory':1001,'optional':1002,'disallowed':1003}
+
+    def __init__(self,value):
+        self.value = value
+
+    def validValidity(self):
+        """
+        Test if value is == to one of the constants.
+        """
+        vals = self.__class__.constants.values()
+        return self.value in vals
+
+
+
+
+
+class Assertion(grok.Container):
+    """
+    Structural model of a typed first order predicate logic assertion
+    in the forma of an expression tree including optional variable definitions.
+    """
+
+    grok.implements(IAssertion)
+
+
+    def __init__(self,tag,expr,sexpr,var):
+        self.tag = tag
+        self.expression = expr
+        self.stringExpression = sexpr
+        self.variables = var
+
+
+class AssertionVariable(grok.Model):
+    """
+    Definition of named variable.
+    """
+
+    grok.implements(IAssertionVariable)
+
+
+    def __init__(self,name,defin):
+        self.name = name
+        self.definition = defin
+
+
+class IOperatorKind(Interface):
+    _(u"""
+    Enumeration of assertion package operator types.
+
+
+    #constants
+    opEq=2001  #= or ==
+    opNe=2002
+    opLe=2003
+    opLt=2004
+    opGe=2005
+    opGt=2006
+    opMatches=2007
+
+    opNot=2010
+    opAnd=2011
+    opOr=2012
+    opXor=2013
+    opImplies=2014
+    opForAll=2015
+    opExists=2016
+
+    opPlus=2020
+    opMinus=2021
+    opMultiply=2022
+    opDivide=2023
+    opExp=2024
+    """)
+
+    value=Int(
+        title=_(u"Value"),
+        description=_(u"Actual value of this instance."),
+    )
+
+    def validOperator(anOp):
+        """
+        Return True if anOp is a valid operator.
+        """
+
+class IExprOperator(Interface):
+    """
+    Abstract parent of operator types.
+    """
+
+    operator=Object(
+        schema=IOperatorKind,
+        title=_(u"Operator"),
+        description=_(u"Code of the operator."),
+
+    )
+
+    precedenceOverridden=Bool(
+        title=_(u"Precedence Overridden"),
+        description=_(u"True if natural precedence of operators is overridden in the expression."),
+
+    )
+
+class ExprOperator(grok.Model):
+    """
+    Abstract parent of operator types.
+    """
+    grok.implements(IExprOperator)
+
+    def __init__(self,operator,precedenceOverridden):
+        self.operator=operator
+        self.precedenceOverridden=precedenceOverridden
+
+
+
+
+class ExprItem(grok.Model):
+    """
+    Abstract parent of allexpression tree items.
+    """
+
+    grok.implements(IExprItem)
+    def __init__(self,type_):
+        self.type_=type_
+
+
+class IExprBinaryOperator(Interface):
+    """
+    Binary expression node.
+    """
+
+    leftOperand=Object(
+        schema=IExprItem,
+        title=_(u"Left"),
+        description=_(u"Left operand node."),
+
+    )
+
+    rightOperand=Object(
+        schema=IExprItem,
+        title=_(u"Right"),
+        description=_(u"Right operand node."),
+
+    )
+
+
+class ExprBinaryOperator(ExprOperator):
+    """
+    Binary expression node.
+    """
+
+    grok.implements(IExprBinaryOperator)
+
+    def __init__(self,leftOperand,rightOperand,operator,precedenceOverridden):
+        self.leftOperand=leftOperand
+        self.rightOperand=rightOperand
+        ExprOperator.__init__(self,operator,precedenceOverridden)
+
+
+class IExprLeaf(Interface):
+    """
+    Expression tree, leaf form.
+    """
+
+    item=Field(
+        title=_(u"Item"),
+        description=_(u"The value refered to. Any type."),
+
+    )
+
+    referenceType=TextLine(
+        title=_(u"Reference Type"),
+        description=_(u"Type of reference: constant, attribute, etc."),
+
+    )
+
+
+class ExprLeaf(ExprItem):
+    """
+    Expression tree, leaf form.
+    """
+
+    grok.implements(IExprLeaf)
+
+    def __init__(self,item,referenceType,type_):
+        self.item=item
+        self.referenceType=referenceType
+        ExprItem.__init__(self,type_)
+
+class IExprUnaryOperator(Interface):
+    """
+    Unary expression node operator.
+    """
+
+    operand=Object(
+        schema=IExprItem,
+        title=_(u"Operand"),
+        description=_(u"Operand node."),
+
+    )
+
+class ExprUnaryOperator(ExprOperator):
+    """
+    Unary expression node operator.
+    """
+
+    grok.implements(IExprUnaryOperator)
+
+    def __init__(self,operand,operator,precedenceOverridden):
+        ExprOperator.__init__(self,operator,precedenceOverridden)
+
+
+class OperatorKind(grok.Model):
+    """
+    Enumeration of assertion package operator types.
+    """
+
+    grok.implements(IOperatorKind)
+
+    constants={'opEq':2001,'opNe':2002,'opLe':2003,'opLt':2004,'opGe':2005,'opGt':2006,'opMatches':2007,\
+               'opNot':2010,'opAnd':2011,'opOr':2012,'opXor':2013,'opImplies':2014,'opForAll':2015,\
+               'opExists':2016,'opPlus':2020,'opMinus':2021,'opMultiply':2022,'opDivide':2023,'opExp':2024}
+
+    def __init__(self):
+        self.constants = self.___class__.constants
+
+
+    def validOperator(self,anOp):
+        """
+        Return True if anOp is a valid operator.
+        """
+        return anOp in self.constants.values()
+
+#Begin Constraint package
+class IArchetypeConstraint(Interface):
+    """
+    Archetype equivalent to Locatable class in the Common package of the reference model.
+    """
+
+    def isSubsetOf(other):
+        u"""True if constraints are narrower than this node."""
+
+    def isValid():
+        u"""True if this node and sub-nodes are valid for its type."""
+
+    def path():
+        """
+        Return a string containt the path of this node relative to the archetype root.
+        """
+
+    def hasPath(aPath):
+        """
+        Return True if the relative path (aPath) exists at this node.
+        """
+
+class ArchetypeConstraint(grok.Container):
+    """
+    Archetype equivalent to Locatable class in the Common package of the reference model.
+    """
+
+    grok.implements(IArchetypeConstraint)
+
+    def isSubsetOf(self,other):
+        u"""True if constraints are narrower than this node."""
+
+    def isValid(self):
+        u"""True if this node and sub-nodes are valid for its type."""
+
+    def path(self):
+        """
+        Return a string containt the path of this node relative to the archetype root.
+        """
+
+    def hasPath(self,aPath):
+        """
+        Return True if the relative path (aPath) exists at this node.
+        """
+
+class ICObject(Interface):
+    """
+    Abstract model of constraint on any kind of object node.
+    """
+
+    rmTypeName=TextLine(
+        title=_(u"RM Type Name"),
+        description=_(u"Reference model type that this node corresponds to."),
+        required = True,
+    )
+
+    occurrences=Int(
+        title=_(u"Occurrences"),
+        description=_(u"Occurrences of this object node in the data."),
+        required = True
+    )
+
+    nodeId=TextLine(
+        title=_(u"Node Id"),
+        description=_(u"Semantic id of this node."),
+        required = True,
+    )
+
+
+    parent=Object(
+        schema=ICAttribute,
+        title=_(u"Parent"),
+        description=_(u"CAttribute that owns the CObject."),
+        required=False,
+    )
+
+
+class CObject(ArchetypeConstraint):
+    """
+    Abstract model of constraint on any kind of object node.
+    """
+
+    grok.implements(ICObject)
+
+    def __init__(self, rmTypeName, occurrences, nodeId, parent):
+        self.rmTypeName = rmTypeName
+        self.occurrences = occurrences
+        self.nodeId = nodeId
+        self.parent = parent
+
+    def rmTypeNameValid(self):
+        if (self.rmTypeName is not None):
+            return self.rmTypeName != ''
+        return self.rmTypeName is None
+
+    def nodeIdValid(self):
+        if (self.nodeId is not None):
+            return self.nodeId != ''
+        return self.rmTypeName is None
+
+    def occurrencesValidity(self):
+        if (self.occurrences is not None and self.parent is not None):
+            return not isinstance(self.parent, CMultipleAttribute) and \
+                   self.occurrences.upper <= 1
+        return True
+
+
+
+class ICReferenceObject(Interface):
+    """
+    Abstract parent of CObject subtypes that are defined by reference.
+    """
+    pass
+
+class CReferenceObject(CObject):
+    """
+    Abstract parent of CObject subtypes that are defined by reference.
+    """
+
+    grok.implements(ICReferenceObject)
+
+    def __init__(self, rmTypeName, occurrences, nodeId, parent):
+        CObject.__init__(self, rmTypeName, occurrences, nodeId, parent)
+
+
+
+class IArchetypeInternalRef(Interface):
+    """
+    See the AOM reference document.
+    """
+
+    targetPath=TextLine(
+        title=_(u"Target Path"),
+        description=_(u"Reference to an object node using archetype path notation."),
+
+    )
+
+
+class ArchetypeInternalRef(CReferenceObject):
+    """
+    See the AOM reference document.
+    """
+
+    grok.implements(IArchetypeInternalRef)
+
+
+    def __init__(self,tgtpath, rmTypeName, occurrences, nodeId, parent):
+        self.tgtpath=tgtpath
+        CReferenceObject.__init__(self, rmTypeName, occurrences, nodeId, parent)
+
+
+class IArchetypeSlot(Interface):
+    """
+    Constraint describing a slot where other archetypes can occur.
+    """
+
+    includes=Set(
+        title=_(u"Includes"),
+        description=_(u"List of constraints defining other archetypes that can be included here."),
+        required=False,
+        value_type=Object(schema=IAssertion),
+    )
+
+    excludes=Set(
+        title=_(u"Excludes"),
+        description=_(u"List of constraints defining archetypes that cannot be include here."),
+        required=False,
+        value_type=Object(schema=IAssertion),
+    )
+
+
+class ArchetypeSlot(CReferenceObject):
+    """
+    Constraint describing a slot where other archetypes can occur.
+    """
+
+    grok.implements(IArchetypeSlot)
+
+
+    def __init__(self,incl,excl):
+        self.includes=incl
+        self.excludes=excl
+
+
+
+class ICardinality(Interface):
+    """
+    Expresses constraints on the cardinality of container classes.
+    """
+
+    isOrdered=Bool(
+        title=_(u"Ordered"),
+        description=_(u"True if members are ordered."),
+        required = True,
+    )
+
+    isUnique=Bool(
+        title=_(u"Unique"),
+        description=_(u"True if members are unique."),
+        required = True,
+    )
+
+    interval=Object(
+        schema=IDvInterval,
+        title=_(u"Interval"),
+        description=_(u"Interval of this cardinality."),
+        required = True,
+    )
+
+    def isBag():
+        """
+        Return True if this cardinality represents an unordered set.
+        """
+
+    def isList():
+        """
+        Return True if this cardinality represents an ordered, non-unique membership.
+        """
+
+    def isSet():
+        """
+        Return True if this cardinality represents an unordered, non-unique membership.
+        """
+
+class ICMultipleAttribute(Interface):
+    """
+    Abstract model of constraint on any kind of attribute node.
+    """
+
+    cardinality=Object(
+        schema = IField, # this must be checked in the implementation as a Cardinality instance.
+        title=_(u"Cardinality"),
+        description=_(u"Cardinality of this attribute constraint."),
+
+    )
+
+    def members(cobj):
+        """
+        List of constraints representing members of the container value of this attribute.
+        """
+
+
+class CAttribute(ArchetypeConstraint):
+    """
+    Abstract model of constraint on any kind of attribute code.
+    """
+
+    grok.implements(ICAttribute)
+
+    def __init__(self, rmAttributeName, existence, children):
+        self.rmAttributeName = rmAttributeName
+        self.existence = existence
+        self.children = children
+
+    def rmAttributeNameValid(self):
+        if (self.rmAttributeName is not None):
+            return self.rmAttributeName != ''
+        return self.rmAttributeName is None
+
+    def existenceSet(self):
+        if (self.existence is not None):
+            return self.existence.lower >= 0 and self.existence.upper <= 1
+        return self.existence is None
+
+    def childrenValidity(self):
+        return (issubclass(type(self.children), CObject) and self.children is not None)
+
+
+class CMultipleAttribute(CAttribute):
+    """
+    Abstract model of constraint on any kind of attribute node.
+    """
+
+    grok.implements(ICMultipleAttribute)
+
+    def __init__(self, cardinality, rmAttributeName, existence, children):
+        self.cardinality = cardinality
+        CAttribute.__init__(self, rmAttributeName, existence, children)
+
+    def members(self,cobj):
+        """
+        List of constraints representing members of the container value of this attribute.
+        """
+        return cobj.children
+
+    #def cardinalityValidity():
+        #return self.cardinality is not None
+
+    #def membersValid():
+        #if (self.children is not None):
+            #for co in self.children:
+                #if (issubclass(type(co), CObject) and co.occurrences.upper >= 1):
+                    #return False
+            #return True
+
+
+class Cardinality(CMultipleAttribute):
+    """
+    Expresses constraints on the cardinality of container classes.
+    """
+
+    grok.implements(ICardinality)
+
+    def __init__(self, isOrdered, isUnique, interval, cardinality, rmAttributeName, existence, children):
+        self.isOrdered = isOrdered
+        self.isUnique = isUnique
+        self.interval = interval
+        CMultipleAttribute.__init__(self, cardinality, rmAttributeName, existence, children)
+
+    def isBag(self):
+        """
+        Return True if this cardinality represents an unordered set.
+        """
+        return not self.isOrdered and not self.isUnique
+
+    def isList(self):
+        """
+        Return True if this cardinality represents an ordered, non-unique membership.
+        """
+        return (self.isOrdered) and (not self.isUnique)
+
+    def isSet(self):
+        """
+        Return True if this cardinality represents an unordered, non-unique membership.
+        """
+        return (not self.isOrdered) and (self.isUnique)
+
+
+
+
+
+
+class ICDefinedObject(Interface):
+    """
+    Abstract parent of CObject subtypes that are defined by this value.
+    """
+
+    assumedValue=Field(
+        title=_(u"Assumed Value"),
+        description=_(u"Value to be assumed if none sent in data. Any Type."),
+        required=False,
+    )
+
+    def hasAssumedValue():
+        """
+        Return True if assumedValue is not equal to None.
+        """
+
+class CDefinedObject(CObject):
+    """
+    Abstract parent of CObject subtypes that are defined by this value.
+    """
+
+    grok.implements(ICDefinedObject)
+
+    def __init__(self, rmTypeName, occurence, nodeId, parent, assumedValue):
+        CObject.__init__(self, rmTypeName, occurence, nodeId, parent)
+        self.assumedValue = assumedValue
+
+    def hasAssumedValue(self):
+        """
+        Return True if assumedValue is not equal to None.
+        """
+        return self.assumedValue is not None
+
+
+class CComplexObject(CDefinedObject):
+    """
+    Constraint on complex objects.
+    """
+
+    grok.implements(ICComplexObject)
+
+
+    def __init__(self,attributes,assumedValue,rmTypeName,occurrences,nodeId,parent):
+        self.attributes=attributes
+        self.assumedValue=assumedValue
+        self.rmTypeName=rmTypeName
+        self.occurrences=occurrences
+        self.nodeId=nodeId
+        self.parent=parent
+
+
+    def anyAllowed():
+        if not self.attributes is None:
+            return (len(self.attributes) == 0)
+        else:
+            return (False)
+
+
+
+
+class ICDomainType(Interface):
+    """
+    Abstract parent of domain specific constrainer types.
+    """
+
+    standardEquivalent=Object(
+        schema=ICComplexObject,
+        title=_(u"Standard Equivalent"),
+        description=_(u"Standard form of constraint."),
+
+    )
+class CDomainType(CDefinedObject):
+    """
+    Abstract parent of domain specific constrainer types.
+    """
+
+    grok.implements(ICDomainType)
+
+    def __init__(self,assumedValue,rmTypeName,occurrences,nodeId,parent):
+        CDefinedObject.__init__(assumedValue,rmTypeName,occurrences,nodeId,parent)
+
+
+class IConstraintRef(Interface):
+    """
+    Reference to a constraint described in the same archetype.
+    """
+
+    reference=TextLine(
+        title=_(u"Reference"),
+        description=_(u"Reference to a constraint in the archetype ontology."),
+
+    )
+
+
+class ConstraintRef(CReferenceObject):
+    """
+    Reference to a constraint described in the same archetype.
+    """
+
+    grok.implements(IConstraintRef)
+    def __init__(self, reference, rmTypeName, occurrences, nodeId, parent):
+        self.reference = reference
+        CReferenceObject.__init__(self, rmTypeName, occurrences, nodeId, parent)
+
+
+class ICPrimitive(Interface):
+    """
+    Abstract super type of all primitive types.
+    """
+
+    defaultValue=Field(
+        title=_(u"Default Value"),
+        description=_(u"A default value for this constraint object. Any Type"),
+        required = True,
+    )
+
+    hasAssumedValue=Bool(
+        title=_(u"Has Assumed Value"),
+        description=_(u"True if there is an assumed value."),
+        required = True,
+    )
+
+    assumedValue=Field(
+        title=_(u"Assumed Value"),
+        description=_(u"Generate a default value. Any Type."),
+        required = True,
+    )
+
+
+    def validValue(aVal):
+        """
+        True if aValue is valid with respect to the expressed constraint.
+        """
+
+class ICPrimitiveObject(Interface):
+    """
+    Constraint on a primitive object.
+    """
+
+    item=Object(
+       schema=ICPrimitive,
+       title=_(u"Item"),
+       description=_(u"Object actually defining the constraint."),
+       required=False,
+    )
+
+
+class CPrimitiveObject(CDefinedObject):
+    """
+    Constraint on a primitive object.
+    """
+
+    grok.implements(ICPrimitiveObject)
+
+    def __init__(self, item, rmTypeName, occurence, nodeId, parent, assumedValue):
+        CDefinedObject.__init__(self, rmTypeName, occurence, nodeId, parent, assumedValue)
+
+
+class ICSingleAttribute(Interface):
+    """
+    Concrete model of constraint on a single valued attribute.
+    """
+
+    alternatives=List(
+        title=_(u"Alternatives"),
+        description=_(u"A list of alternative constraints for the single child of this attribute."),
+        value_type=Object(schema=ICObject),
+        required=False,
+    )
+
+class CSingleAttribute(CAttribute):
+    """
+    Concrete model of constraint on a single valued attribute.
+    """
+
+    grok.implements(ICSingleAttribute)
+
+    def __init__(self, alternatives, rmAttributeName, existence, children):
+        self.alternatives = alternatives
+        CAttribute.__init__(self, rmAttributeName, existence, children)
+
+
+class CPrimitive(grok.Model):
+    """
+    Abstract super type of all primitive types.
+    """
+
+    grok.implements(ICPrimitive)
+
+    def __init__(self,defaultValue,hasAssumedValue,assumedValue):
+        self.defaultValue = defaultValue
+        self.hasAssumedValue = hasAssumedValue
+        self.assumedValue = assumedValue
+
+
+    def validValue(aVal):
+        """
+        True if aValue is valid with respect to the expressed constraint.
+        """
+        return True # incomplete method
+
+
+class ICBoolean(Interface):
+    """
+    Boolean constraint.
+    """
+
+    trueValid=Bool(
+        title=_(u"True Valid"),
+        description=_(u"True if value True is allowed."),
+        required = True,
+    )
+
+    falseValid=Bool(
+        title=_(u"False Valid"),
+        description=_(u"True if the value False is allowed."),
+        required = True,
+    )
+
+    assumedValue=Bool(
+        title=_(u"Assumed Value"),
+        description=_(u"The value to assume of this item is not included in the data."),
+        required = True,
+    )
+
+
+class CBoolean(CPrimitive):
+    """
+    Boolean constraint.
+    """
+
+    grok.implements(ICBoolean)
+    def __init__(self, trueValid, falseValid, assumedValue, defaultValue, hasAssumedValue):
+        self.trueValid = trueValid
+        self.falseValid = falseValid
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+class ICString(Interface):
+    """
+    Constraints on strings.
+    """
+
+    pattern = TextLine(
+        title = _(u"pattern"),
+        description = _(u"A REGEX pattern."),
+    )
+
+    list_ = List(
+        title = _(u"list"),
+        description = _(u"A set of strings specifying constraints."),
+    )
+
+    listOpen = Bool(
+        title = _(u"listOpen"),
+        description = _(u"True when the list is used but not considered exhaustive of all constraints."),
+    )
+
+    assumedValue = TextLine(
+        title = _(u"assumedValue"),
+        description = _(u"The value to assume if the data is empty."),
+    )
+
+class CString(CPrimitive):
+    """
+    Constraints on strings.
+    """
+
+    grok.implements(ICString)
+
+    def __init__(self, pattern, list_, listOpen, defaultValue, hasAssumedValue, assumedValue):
+        self.pattern = pattern
+        self.list_ = list_
+        self.listOpen = listOpen
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+class ICDate(Interface):
+    """
+    ISO 8601 compatible constraint on instances of Date.
+    """
+
+    monthValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Month Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+
+    dayValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Day Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    timezoneValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Timezone Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    range_= Object(
+        schema=IDvInterval,
+        title=_(u"Range"),
+        description=_(u"Interval of dates."),
+        required=False,
+    )
+
+
+    assumedValue=Date(
+        title=_(u"Assumed Value"),
+        description=_(u" "),
+
+    )
+
+    def validityIsRange():
+        """
+        Returns True if the validity is in the form of a range.
+        """
+
+
+class CDate(CPrimitive):
+    """
+    ISO 8601 compatible constraint on instances of Date.
+    """
+
+    grok.implements(ICDate)
+
+    def __init__(self, monthValidity, dayValidity, timezoneValidty, range_, defaultValue, hasAssumedValue, assumedValue):
+        self.monthValidity = monthValidity
+        self.dayValidity = dayValidity
+        self.timezoneValidty = timezoneValidty
+        self.range_ = range_
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+    def validityIsRange(self):
+        """
+        Returns True if the validity is in the form of a range.
+
+        ***Incomplete method!*****
+        """
+
+        return True
+
+class ICDateTime(Interface):
+    """
+    ISO 8601 compatible constraint on instances of DateTime.
+    """
+
+    monthValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Month Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+
+    dayValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Day Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    timezoneValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Timezone Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    hourValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Hour Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+
+    minuteValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Minute Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+
+    secondValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Second Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    millisecondValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Millisecond Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    timezoneValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Timezone Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    range_ = Object(
+        schema=IDvInterval,
+        title=_(u"Range"),
+        description=_(u"Interval of datetimess."),
+        required=False,
+    )
+
+    assumedValue=Datetime(
+        title=_(u"Assumed Value"),
+        description=_(u" "),
+
+    )
+
+    def validityIsRange():
+        """
+        Returns True if the validity is in the form of a range.
+        """
+
+class CDateTime(CPrimitive):
+    """
+    ISO 8601 compatible constraint on instances of DateTime.
+    """
+
+    grok.implements(ICDateTime)
+    def __init__(self, monthValidity, dayValidity, hourValidity, minuteValidity, \
+                secondValidity, millisecondValidity, timezoneValidty, range_, defaultValue, hasAssumedValue, assumedValue):
+        self.monthValidity = monthValidity
+        self.dayValidity = dayValidity
+        self.timezoneValidty = timezoneValidty
+        self.hourValidity = hourValidity
+        self.minuteValidity = minuteValidity
+        self.secondValidity = secondValidity
+        self.millisecondValidity = millisecondValidity
+        self.range_ = range_
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+    def validityIsRange(self):
+        """
+        Returns True if the validity is in the form of a range.
+
+        ***Incomplete method!*****
+        """
+
+        return True
+
+class ICDuration(Interface):
+    """
+    Constraints on durations.  openEHR allows the 'W' indicator to be mixed in.
+    """
+
+    yearsAllowed=Bool(
+        title=_(u"Years Allowed"),
+        description=_(u"True if years are allowed in the constrained duration."),
+        required=False,
+    )
+
+    monthsAllowed=Bool(
+        title=_(u"Months Allowed"),
+        description=_(u"True if months are allowed in the constrained duration."),
+        required=False,
+    )
+
+    weeksAllowed=Bool(
+        title=_(u"Weeks Allowed"),
+        description=_(u"True if weeks are allowed in the constrained duration."),
+        required=False,
+    )
+
+    daysAllowed=Bool(
+        title=_(u"Days Allowed"),
+        description=_(u"True if days are allowed in the constrained duration."),
+        required=False,
+    )
+
+    hoursAllowed=Bool(
+        title=_(u"Hours Allowed"),
+        description=_(u"True if hours are allowed in the constrained duration."),
+        required=False,
+    )
+
+    minutesAllowed=Bool(
+        title=_(u"Minutes Allowed"),
+        description=_(u"True if minutes are allowed in the constrained duration."),
+        required=False,
+    )
+
+    secondsAllowed=Bool(
+        title=_(u"Seconds Allowed"),
+        description=_(u"True if seconds are allowed in the constrained duration."),
+        required=False,
+    )
+
+    fractionalSecondsAllowed=Bool(
+        title=_(u"Fractional Seconds Allowed"),
+        description=_(u"True if fractional seconds are allowed in the constrained duration."),
+        required=False,
+    )
+
+    range_=Object(
+        schema=IDvInterval,
+        title=_(u"Range"),
+        description=_(u"Interval of duration."),
+        required=False,
+    )
+
+
+class CDuration(CPrimitive):
+    """
+    Constraints on durations.  openEHR allows the 'W' indicator to be mixed in.
+    """
+
+    grok.implements(ICDuration)
+
+    def __init__(self, yearsAllowed, monthsAllowed, weeksAllowed, daysAllowed, \
+                hoursAllowed, minutesAllowed, secondsAllowed, fractionalSecondsAllowed, \
+                range_, defaultValue, hasAssumedValue, assumedValue):
+        self.yearsAllowed = yearsAllowed
+        self.monthsAllowed = monthsAllowed
+        self.weeksAllowed = weeksAllowed
+        self.daysAllowed = daysAllowed
+        self.hoursAllowed = hoursAllowed
+        self.minutesAllowed = minutesAllowed
+        self.secondsAllowed = secondsAllowed
+        self.fractionalSecondsAllowed = fractionalSecondsAllowed
+        self.range_ = range_
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+
+class ICInteger(Interface):
+    """
+    Constraint on integers.
+    """
+
+    list_=Set(
+        title=_(u"List"),
+        description=_(u"Set of integers specifying constraints."),
+        required=False,
+    )
+
+    range_=Object(
+        schema=IDvInterval,
+        title=_(u"Range"),
+        description=_(u"Range of integers specifying constraint."),
+        required=False,
+    )
+
+
+    assumedValue=Int(
+        title=_(u"Assumed Value"),
+        description=_(u"The value to assume if this item is not in the data."),
+
+    )
+
+
+class CInteger(CPrimitive):
+    """
+    Constraint on integers.
+    """
+
+    grok.implements(ICInteger)
+
+    def __init__(self, list_, range_, defaultValue, hasAssumedValue, assumedValue):
+        self.list_ = list_
+        self.range_ = range_
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+class ICReal(Interface):
+    """
+    Constraints on instances of Real
+    """
+
+    list_=Set(
+        title=_(u"List"),
+        description=_(u"Set of Reals specifying constraint"),
+        required=False,
+    )
+
+
+    range_=Object(
+        schema=IDvInterval,
+        title=_(u"Range"),
+        description=_(u" "),
+        required=False,
+    )
+
+
+    assumedValue=Float(
+        title=_(u"Assumed Value"),
+        description=_(u""),
+
+    )
+
+
+class CReal(CPrimitive):
+    """
+    Constraints on instances of Real
+    """
+
+    grok.implements(ICReal)
+
+    def __init__(self, list_, range_, defaultValue, hasAssumedValue, assumedValue):
+        self.list_ = list_
+        self.range_ = range_
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+
+class ICTime(Interface):
+    """
+    ISO 8601 compatible constraint on instances of Time.
+    """
+
+    minuteValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Minute Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+
+    secondValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Second Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    millisecondValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Millisecond Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    timezoneValidity=Object(
+        schema=IValidityKind,
+        title=_(u"Timezone Validity"),
+        description=_(u" "),
+        required=False,
+    )
+
+    range_=Object(
+        schema=IDvInterval,
+        title=_(u"Range"),
+        description=_(u"Interval of times."),
+        required=False,
+    )
+
+    assumedValue=Time(
+        title=_(u"Assumed Value"),
+        description=_(u" "),
+
+    )
+
+    def validityIsRange():
+        """
+        Returns True if the validity is in the form of a range.
+        """
+
+
+
+class CTime(CPrimitive):
+    """
+    ISO 8601 compatible constraint on instances of Time.
+    """
+
+    grok.implements(ICTime)
+
+    def __init__(self, minuteValidity, secondValidity, millisecondValidity, timezoneValidity, range_, defaultValue, hasAssumedValue, assumedValue):
+        self.minuteValidity = minuteValidity
+        self.secondValidity = secondValidity
+        self.millisecondValidity = millisecondValidity
+        self.timezoneValidity = timezoneValidity
+        self.range_ = range_
+        self.assumedValue = assumedValue
+        CPrimitive.__init__(self, defaultValue, hasAssumedValue, assumedValue)
+
+
+    def validityIsRange(self):
+        """
+        Returns True if the validity is in the form of a range.
+        """
+
+        return True # needs to be fixed
+
+
+
+
+class ArchetypeOntology(grok.Model):
+    """
+    Local ontology of an archetype.
+    """
+
+    grok.implements(IArchetypeOntology)
+
+    def __init__(self, terminologiesAvailable, specialisationDepth, termCodes, \
+                 constraintCodes, termAttributeNames, parentArchetype):
+        self.terminologiesAvailable = terminologiesAvailable
+        self.specialisationDepth = specialisationDepth
+        self.termCodes = termCodes
+        self.constraintCodes = constraintCodes
+        self.termAttributeNames = termAttributeNames
+        self.parentArchetype = parentArchetype
+
+
+
+    def hasLanguage(self,aLang):
+        """
+        True if aLang is present in ontology.
+        """
+
+    def hasTerminology(self,aTermId):
+        """
+        True if ontology has aTermId, terminology Id.
+        """
+
+    def hasTermCode(self,tcode):
+        """
+        True if tcode is in termCodes.
+        """
+
+    def hasConstraintCode(self,ccode):
+        """
+        True if ccode is in constraintCodes.
+        """
+
+    def constraintDefinition(self,aLang,aCode):
+        """
+        Constraint definition for aCode expressed in aLang.
+        """
+
+    def termBinding(self,aTermId,aCode):
+        """
+        Return a CodePhrase for aCode in aTermId.
+        """
+
+    def constraintBinding(self,aTermId,aCode):
+        """
+        Return a string that describes the constraint aCode in aTermId usually in the form of a query expression.
+        """
+
+# this class is also defined at line 55.
+#class ArchetypeTerm(grok.Model):
+    #"""
+    #Representation of any coded entity in the archetype ontology.
+    #"""
+
+    #grok.implements(IArchetypeTerm)
+
+    #def __init__(self,code,items):
+        #self.code=code
+        #self.items=items
+
+    #def keys(set):
+        #"""
+        #List of all keys used in this term.
+        #"""
+
+        #return self.items.keys()
+
+
+#Begin Template package (not yet defined in specifications.
+
+

=== added file 'src/oship/mlhim/archetype.pyc'
Binary files src/oship/mlhim/archetype.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/archetype.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/atbldr.py'
--- src/oship/mlhim/atbldr.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/atbldr.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,502 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the license in OSHIP-LICENSE.txt
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+
+"""
+   Creates Python source files from ADL files.
+        Parsing is performed in adl_1_4.py using Pyparsing.
+        You will need to easy_install pyparsing and mglob in your 'oshipenv'
+
+"""
+
+
+__author__  = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'<name> <email address>'
+
+
+
+import codecs
+
+import os
+import traceback
+import sys
+from oship.utils import mglob
+import logging
+
+from pyparsing import *
+
+
+
+# this section are required imports for (almost?) all archetypes
+import grok
+import datetime
+import time
+from classmap import getClassName
+
+from archetype import ArchetypeOntology
+from demographic import *
+import adl_1_4
+from utils import Languages
+
+
+"""
+edit the path below (no trailing '/') to point to your archetypes in ADL 1.4 format
+if you choose not use use the standard import directory under oship/openehr/adl.
+"""
+
+adlDir=os.getcwd()+'/src/oship/openehr/adl'
+py_filesDir=os.getcwd()+'/src/oship/openehr/py_files/'
+
+
+def CreatePy():
+    """
+    Create parse results to send to the builder.
+    """
+
+    fnames = mglob.expand("rec:"+adlDir+"=*.adl")
+    n=0
+    e=0
+    errCount=0
+    count=len(fnames)
+    #startTime=time.clock()
+
+    fnames.sort()
+    print "ADL File count: ",count," in ",adlDir
+    print "\n Placing Python source files in ", py_filesDir
+
+    for fname in fnames:
+        n+=1
+        print "\n\nProcessing # ",n,' of ',count,' --->',fname
+        adlSource = file(fname).read()
+
+        try:
+            # parsed_adl is the returned ParseResults object
+            parsed_adl = adl_1_4.archetypeDefinition.parseString(adlSource)
+        except ParseException:
+            e+=1
+            logging.error("Error # "+str(e)+" Occured Parsing "+fname+':\n')
+            print "Parsing Failed -- Error Logged!\n"
+            errCount+=1
+        else:
+            logging.info("Processing: "+fname)
+            bldArchetype(fname,parsed_adl)
+
+
+    #print "\n\nParsed ",count," files in",time.clock()-startTime," seconds."
+    print "\n\nParsed ",count," files."
+    print "There were ",errCount," parse errors. "
+    logging.info("There were "+repr(errCount)+" parse errors. ")
+    if errCount > 0:
+        print "Please see the error log file for errors & warnings."
+
+
+    logging.info("*******END OF LOG FILE FOR THIS RUN*******")
+
+    return
+
+
+def bldArchetype(fname,parsed_adl):
+    """
+    Build the archetype source file.
+    """
+
+    #get the class name from the archetypeID
+    class_name=(parsed_adl.archetype[1]).partition('.')[2]
+    class_name=class_name.replace('.','_')
+    class_name=class_name.replace('-','_')
+
+    #get the filename from the class_name
+    class_file=class_name+'.py'
+
+    #now lets turn the class_name into a normal Python CamelCase name
+    class_list=class_name.split('_')
+    class_name=''
+    for n in class_list:
+        class_name=class_name+n.capitalize()
+
+    print '\n Creating Class : ',class_name+'\n\n'
+    logging.info("The Python class name is: "+class_name+' in file: '+class_file+'\n')
+    f=open(py_filesDir+class_file,'w') # create the file for writing
+
+
+    f.write("#This file was created with atbldr module from the OSHIP project.\n")
+    f.write("#Its quality is not guaranteed and will need hand editing, especially the definition section before use.\n\n")
+    f.write("import grok\n")
+    f.write("import datetime\n")
+    f.write("from zope.i18nmessageid import MessageFactory\n")
+    f.write("from oship.mlhim.archetype import *\n")
+    f.write("from oship.mlhim.common import *\n")
+    f.write("from oship.mlhim.datastructure import *\n")
+    f.write("from oship.mlhim.datatypes import *\n")
+    f.write("from oship.mlhim.demographic import *\n")
+    f.write("from oship.mlhim.ehr import *\n")
+    f.write("from oship.mlhim.extract import *\n")
+    f.write("from oship.mlhim.integration import *\n")
+    f.write("from oship.mlhim.openehrprofile import *\n")
+    f.write("from oship.mlhim.sm import *\n")
+    f.write("from oship.mlhim.support import *\n\n")
+    f.write("_ = MessageFactory('oship')\n\n")
+
+    f.write("class "+ class_name+"(Archetype):\n\n")
+    f.write("    grok.implements(IArchetype)\n\n" )
+    f.write("    def __init__(self):\n" )
+    f.write("        self.adlVersion =u'"+unicode(parsed_adl.archetype[0][1])+"'\n")
+    f.write("        self.archetypeId = ArchetypeId(ObjectId(u'"+unicode(parsed_adl.archetype[1])+"'))\n")
+    f.write("        self.concept = u'"+unicode(parsed_adl.concept.strip('[]')+"'\n"))
+
+    if parsed_adl.specialize:
+        f.write("        self.parentArchetypeId = ArchetypeId(ObjectId(u'"+unicode(parsed_adl.specialize)+"'))\n")
+    else:
+        f.write("        self.parentArchetypeId=ArchetypeId(ObjectId(u''))\n")
+
+
+
+    # we need to build a description section
+
+    original_author=flatten(parsed_adl.description[0])
+    details=flatten(parsed_adl.description[1])
+    lifecycle_state=flatten(parsed_adl.description[2])
+    other_contributors=flatten(parsed_adl.description[3])
+    if len(parsed_adl.description)>=5:
+        other_details=flatten(parsed_adl.description[4])
+    else:
+        other_details=None
+
+    #print "\nOriginal Author  = ",original_author
+    #print "\nDetails = ",details
+    #print "\nLifecycle State = ",lifecycle_state
+    #print "\nOther Contributors = ",other_contributors
+    #print "\nOther Details = ", other_details
+
+    f.write('\n        # Create the description components.\n')
+    ol=details[3].split("::")
+    f.write("        self.originalLanguage=CodePhrase(u'"+ol[0][1:]+"',u'"+ol[1].strip('_')+"')\n")
+    f.write("        self.translationDetails=None # needs to be completed in atbldr\n")
+    f.write("        self.description="+repr(flatten(parsed_adl.description))+" # needs to be completed in atbldr\n")
+    f.write("        self.revisionHistory=None # needs to be completed in atbldr\n")
+    f.write("        self.isControlled=False # needs to be completed in atbldr\n")
+
+    # next we build the ontology
+
+    f.write('\n        # Create the ontology.\n')
+    # pre-assign all attributes
+    termAvail=[]
+    specDepth=0
+    termCodes={}
+    constCodes={}
+    termAN=[]
+
+
+    #cleanup the list
+    ontlist=flatten(parsed_adl.ontology)
+
+    # build some reference lists
+    key_list=[u'terminologies_available',u'term_definitions',u'constraint_definitions',u'term_binding',u'constraint_binding']
+    lang_list=Languages() # see utils.py
+
+    itemlist=[]
+    # now go through ontlist and map all the words.
+
+    ontmap={}
+    for index, item in enumerate(ontlist):
+        ontmap[index]=item
+
+
+    a = ontmap.items()
+    keywords=[]
+    for x in a:
+        for v in key_list:
+            if v in x:
+                keywords.append(x)
+
+    """
+    keywords now contains tuples of all the possible section names and their index:
+    i.e. [(0, u'terminologies_available'), (3, u'term_definitions'), (346, u'term_binding')]
+    This is so we know where each one starts. Below, we also want to know where each one ends.
+    """
+
+
+    numkeys=len(keywords)
+    ends=[]
+    endsection=[]
+    for x in keywords:
+        ends.append([x][0][0])
+
+    ends=ends[1:]
+    for x in ends:
+        y=x-1
+        endsection.append(y)
+
+    endsection.append(len(a)) # final word in the ontology.
+
+    sections={}
+    n=0
+    for x in keywords:
+        t=(x[0],endsection[n])
+        sections[x[1]]=t
+        n+=1
+
+    """
+    Now the sections dictionary contains a tuple of the postions of the starting word and the ending word.
+    i.e.  {u'term_binding': (203, 213), u'term_definitions': (3, 107), u'constraint_definitions': (108, 202), u'terminologies_available': (0, 2), u'constraint_binding': (214, 233)}
+
+    We need to process the sections in the order that they are expected to appear so that they will work correctly.
+    """
+
+    #print "Sections: ",sections
+    f.write('\n        # Terminologies Available Section \n')
+
+    # process terminologies available
+    if sections.has_key(u'terminologies_available'):
+        begin=sections[u'terminologies_available'][0]+1 # first location past the keyword
+        end=sections[u'terminologies_available'][1]+1
+        f.write("        termAvail=[")
+        for v in range(begin,end):
+            f.write("u'"+ontlist[v]+"',")
+            termAvail.append(ontlist[v])
+        f.write("]\n")
+    else:
+        f.write("        termAvail=[]")
+
+    # process termCodes as .po files. Initially all languages will be in one file.
+    # will split them out for easier management later.
+    po_file = open(py_filesDir+class_name+'.po','w')
+    x = sections['term_definitions'][0]
+    attxt = ''
+    for n in range(sections['term_definitions'][0],sections['term_definitions'][1]):
+        extstr = ''
+        pstr = ''
+        if ontlist[n] in lang_list:
+            print "\n **** New Language = " + ontlist[n]
+            po_file.write("\n **** New Language = " + ontlist[n]+'\n')
+
+        elif ontlist[n] == 'description':
+            extstr = '_description'
+            pstr = ontlist[x+1]
+        elif ontlist[n] == 'text':
+            extstr = '_text'
+            pstr = ontlist[x+1]
+        elif ontlist[n][0:2]=='at':
+            attxt = ontlist[n]
+
+        if extstr.startswith("_text") or extstr.startswith("_description"):
+            #print class_name + '_' + attxt + pstr
+            print "msgid " + '"'+class_name + '_' + attxt + extstr +'"'+'\n'
+            print "msgstr " + '"'+pstr+'"'+'\n\n'
+            pstr = pstr.encode('utf-8')
+            po_file.write("msgid " + '"'+class_name + '_' + attxt + extstr +'"'+'\n')
+            try:
+                po_file.write("msgstr " + '"'+pstr+'"'+'\n\n')
+            except:
+                po_file.write("msgstr -- couldn't encode to utf-8.\n\n")
+
+        x += 1
+
+    po_file.close()
+
+    f.write('\n        # Term Code Section \n')
+    if sections.has_key(u'term_definitions'):
+        begin=sections[u'term_definitions'][0]+1 # first location past the keyword
+        end=sections[u'term_definitions'][1]
+        # now locate the begininng of each language section
+        lang_point=[]
+        for v in range(begin,end):
+            if ontlist[v] in lang_list:
+                lang_point.append(v)
+
+        f.write("        termCodes={")
+        for v in range(begin,end): # the range of the termcode section in ontlist
+            if v in lang_point:
+                f.write(repr(ontlist[v])+':{')
+            else:
+                try:
+                    if ontlist[v+1] in lang_list: #is the next entry a new language?
+                        if ontlist[v+1] == u'en':
+                            f.write(repr(ontlist[v])+')]}}\n\n')
+                        else:
+                            f.write(repr(ontlist[v])+']},\n #REMOVE THIS LANGUAGE - This is where the PO file utility needs to be called. \n        {')
+                    else:
+                        if ontlist[v] != u'items':
+                            if ontlist[v][0:2]=='at':
+                                f.write('        '+repr(ontlist[v])+':[')
+                            elif ontlist[v+1][0:2]=='at':
+                                f.write(repr(ontlist[v])+'],\\\n')
+
+                            else:
+                                f.write(repr(ontlist[v])+',')
+                except IndexError:
+                    break # we're at the end
+
+        f.write(")]}}\n")
+    else:
+        f.write("        termCodes={}")
+
+    #process constraint codes
+    f.write('\n        # Constraint Code Section \n')
+    if sections.has_key(u'constraint_definitions'):
+        begin=sections[u'constraint_definitions'][0]+1 # first location past the keyword
+        end=sections[u'constraint_definitions'][1]
+        # now locate the begininng of each language section
+        lang_point=[]
+        for v in range(begin,end):
+            if ontlist[v] in lang_list:
+                lang_point.append(v)
+
+        f.write("        constCodes={")
+        for v in range(begin,end): # the range of the constraint code section in ontlist
+            if v in lang_point:
+                f.write(repr(ontlist[v])+':{')
+            else:
+                try:
+                    if ontlist[v+1] in lang_list: #is the next entry a new language?
+                        #print "lang code: ",ontlist[v+1]
+
+                        f.write(repr(ontlist[v])+']}},\\\n        {')
+                    else:
+                        if ontlist[v] != u'items':
+                            if ontlist[v][0:2]=='at':
+                                f.write('        '+repr(ontlist[v])+':[')
+                            elif ontlist[v+1][0:2]=='ac':
+                                f.write(repr(ontlist[v])+'],\\\n')
+
+                            else:
+                                f.write(repr(ontlist[v])+',')
+                except IndexError:
+                    break # we're at the end
+
+        f.write("]}}\n")
+    else:
+        f.write("        constCodes={}")
+
+    #process term bindings
+
+    f.write('\n        # Term Binding Section \n')
+    if sections.has_key(u'term_binding'):
+        begin=sections[u'term_binding'][0]+1 # first location past the keyword
+        end=sections[u'term_binding'][1]+1
+        f.write("        term_binding={")
+        try:
+            for v in range(begin,end,2):
+                if ontlist[v] in termAvail:
+                    f.write("u'"+ontlist[v]+"':[")
+                else:
+                    if ontlist[v] != u'items':
+                        f.write("{u'"+ontlist[v]+"':u'"+ontlist[v+1]+"'},")
+        except IndexError:
+            pass # we're at the end
+
+        f.write("]}\n")
+    else:
+        f.write("        term_binding={}")
+
+
+
+
+    #process constraint bindings
+
+    f.write('\n        # Constraint Binding Section \n')
+    if sections.has_key(u'constraint_binding'):
+        begin=sections[u'constraint_binding'][0]+1 # first location past the keyword
+        end=sections[u'constraint_binding'][1]+1
+        f.write("        constraint_binding={")
+        try:
+            for v in range(begin,end,2):
+                if ontlist[v] in termAvail:
+                    f.write("u'"+ontlist[v]+"':[")
+                else:
+                    if ontlist[v] != u'items':
+                        f.write("{u'"+ontlist[v]+"':u'"+ontlist[v+1]+"'},")
+        except IndexError:
+            pass # we're at the end
+
+        f.write("]}\n")
+    else:
+        f.write("        constraint_binding={}")
+
+
+    f.write("\n        self.ontology=ArchetypeOntology(termAvail,specDepth,termCodes,constraintCodes,termAN,self.parentArchetypeId)")
+
+    # Now build the definition section
+    f.write("\n\n        # Definition Section Begins Here. We build it from the leaf nodes up.\n\n")
+
+
+    definList=flatten(parsed_adl.definition)
+    definList.reverse()
+
+    n=len(definList)
+    f.write("        #Length of DefinList= "+repr(n)+'\n')
+    m=0
+    for x in definList:
+        nodeid=""
+        #strip off the nodeid if there is one
+        if isinstance(x,basestring) and x.find('_at')!=-1:
+            nodeid=x[x.find('_at'):]
+            f.write("        nodeid=u'"+nodeid.strip('_')+"'\n")
+            x = x[:x.find('_at')]
+
+        className=getClassName(x)
+        if className is None:
+            f.write("        #"+repr(x)+'\n')
+        else:
+            if m == n-1: # If at the last class name then assign it to the archetype definition.
+                f.write("        self.definition="+className+'\n')
+            else:
+                f.write("        "+className+'\n')
+
+        m+=1 # counting which item of the list we are at.
+
+
+
+
+    #Finished building the Archetype class
+    f.close()
+    return
+
+
+def flatten(x):
+    """flatten(sequence) -> list
+
+    Returns a single, flat list which contains all elements retrieved
+    from the sequence and all recursively contained sub-sequences
+    (iterables). All strings are converted to unicode.
+
+    """
+    result = []
+    for el in x:
+        #if isinstance(el, (list, tuple)):
+        if hasattr(el, "__iter__") and not isinstance(el, basestring):
+            result.extend(flatten(el))
+        else:
+            result.append(el)
+
+
+    # all strings must be unicode
+    rtnlist=[]
+    for x in result:
+        if isinstance(x,str):
+            # replace any brackets so Python doesn't think it's a list and we still havea seperator.
+            x=x.replace('[','_')
+            x=x.replace(']','_')
+            try:
+                x=unicode(x, "utf8")  # need more decode types here
+            except UnicodeDecodeError:
+                x=unicode(x, "latin1")
+            except UnicodeDecodeError:
+                x=unicode(x,"iso-8859-1")
+            except UnicodeDecodeError:
+                x=unicode(x,"eucJP")
+
+        rtnlist.append(x)
+
+    return rtnlist
+
+
+#if __name__ == "__main__":
+        #CreateAT()

=== added file 'src/oship/mlhim/atbldr.pyc'
Binary files src/oship/mlhim/atbldr.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/atbldr.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/classmap.py'
--- src/oship/mlhim/classmap.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/classmap.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the license in OSHIP-LICENSE.txt
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+
+"""
+Returns a string to atbldr for the Python classnames and parameters in the definition section.
+"""
+
+
+__author__  = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'<name> <email address>'
+
+
+def getClassName(keyword):
+    u"""
+    Map all of the ADL class workds to OSHIP classes and parameters.
+    """
+
+    definClassMap={'SECTION':'Section(items,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'COMPOSITION':'Composition(content,context,composer,category,lang,terr,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'OBSERVATION':'Observation(data,state,nodeid,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)',\
+                   'ITEM_SINGLE':'ItemSingle(item)',\
+                   'ITEM_LIST':'ItemList(items)',\
+                   'ITEM_TREE':'ItemTree(uid,nodeid,name, atdetails, fdraudit, links, items)',\
+                   'ADMIN_ENTRY':'AdminEntry(data,lang,encod,subject,provider,opart,wfid,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'ACTION':'Action(time,desc,ism,inst,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'EVALUATION':'Evaluation(data,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'INSTRUCTION':'Instruction(narr,act,exp,wfd,nodeid,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'ELEMENT':'Element(value,nullFlavor,nodeid,uid,name,atdetails,fdraudit,links)',\
+                   'CLUSTER':'Cluster(uid,nodeid,name,archetypeDetails,feederAudit,links,items)',\
+                   'EVENT':'Event(time,data,state,parent,offset)',\
+                   'ADDRESS':'Address()',\
+                   'DV_CODED_TEXT':'DvCodedText(definingCode,value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)',\
+                   'DV_TEXT':'DvText(value,mappings=None,formatting=None,hyperlink=None,language=None,encoding=None)',\
+                   'INTERVAL_EVENT':'IntervalEvent(width,mfunc,scount)',\
+                   'DV_DURATION':'DvDuration(value)',\
+                   'POINT_EVENT':'PointEvent(time,data,state,parent,offset)',\
+                   'C_DV_QUANTITY':'CDvQuantity(list_,property_)',\
+                   'HISTORY':'History(origin,events,period,duration,summary,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'DV_DATE_TIME':'DvDateTime(value)',\
+                   'DV_COUNT':'DvCount(magnitude,accuracy,accuracyIsPercent,magnitudeStatus,normalStatus,normalRange,otherReferenceRanges)',\
+                   'DV_MULTIMEDIA':'DvMultimedia(altTxt,mType,compAlg,intChk,intChkAlg,tnail,uri,data)',\
+                   'DV_BOOLEAN':'DvBoolean(value)',\
+                   'PARTY_RELATED':'PartyRelated(relationship)',\
+                   'DV_INTERVAL':'DvInterval(lower,upper,lower_included,upper_included)',\
+                   'DV_INTERVAL<DV_DATE_TIME>':'DvInterval(lower,upper,lower_included,upper_included)',\
+                   'DV_INTERVAL<DV_QUANTITY>':'DvInterval(lower,upper,lower_included,upper_included)',\
+                   'DV_INTERVAL<QUANTITY>':'DvInterval(lower,upper,lower_included,upper_included)',\
+                   'DV_INTERVAL<DV_COUNT>':'DvInterval(lower,upper,lower_included,upper_included)',\
+                   'DV_INTERVAL<COUNT>':'DvInterval(lower,upper,lower_included,upper_included)',\
+                   'DV_DATE':'DvDate(value)',\
+                   'DV_URI':'DvUri(value)',\
+                   'DV_PROPORTION':'DvProportion(numerator,denominator,type_,precision)',\
+                   'ISM_TRANSITION':'IsmTransition(cstate,trans,cfs)',\
+                   'ACTIVITY':'Activity(descr,tim,atid,nodeid,uid,nodeid,name,atdetails,fdraudit,links)',\
+                   'EVENT_CONTEXT':'EventContext(hcf,start,end,part,loc,sett,other)',\
+                   'PARTICIPATION':'Participation(performer,function,mode,time)',\
+                   'ITEM_TABLE':'ItemTable(rows)',\
+                   }
+
+
+
+    if definClassMap.has_key(keyword):
+        return definClassMap[keyword]
+    else:
+        return None
+

=== added file 'src/oship/mlhim/classmap.pyc'
Binary files src/oship/mlhim/classmap.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/classmap.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/common.png'
Binary files src/oship/mlhim/common.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/common.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/datastructure.png'
Binary files src/oship/mlhim/datastructure.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/datastructure.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/datatypes.png'
Binary files src/oship/mlhim/datatypes.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/datatypes.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/demographic.png'
Binary files src/oship/mlhim/demographic.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/demographic.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/demographic.py'
--- src/oship/mlhim/demographic.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/demographic.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,608 @@
+# -*- coding: utf-8 -*-# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the MPL license.
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+
+u"""
+
+From the demographic package from openEHR
+Demographic Information Model package Rev. 2.0.1
+
+"""
+
+__author__ = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__Contributors__ = u'Roberto Cunha <roliveiracunha@xxxxxxxxxxxx>',
+u'Sergio Miranda Freire <sergio@xxxxxxxxxxxxxxx>',
+u'Eduardo César Pimenta Ribeiro <xcesar at gmail dot com'
+
+from zope.interface import Interface, Attribute
+from zope.schema import Set, List, TextLine, Field, Object
+from zope.i18nmessageid import MessageFactory
+import grok
+from grok import index
+from oship.mlhim.rm.common.archetyped import Locatable, ILocatable
+from oship.mlhim.rm.support.interfaces import IUidBasedId, IPartyRef, ILocatableRef
+from oship.mlhim.rm.datatypes.text.interfaces import IDvText, IDvCodedText, ICodePhrase
+from oship.mlhim.rm.datatypes.quantity.interfaces import IDvInterval
+from oship.mlhim.rm.data_structures.item_structure.interfaces import IItemStructure
+from oship.app import OSHIP
+
+
+
+_ = MessageFactory('oship')
+
+
+
+
+
+class IAddress(Interface):
+    """
+    Address of contact.
+    """
+
+    details=Object(
+        schema=IItemStructure,
+        title=_(u"Details"),
+        description=_(u"The details of the address."),
+    )
+
+    def type():
+        """
+        Return the type of address from 'name'.
+        """
+
+    def asString():
+        """
+        Address in the form of a string.
+        """
+
+
+class IPartyIdentity(Interface):
+    """
+    An identity owned by a party.
+    """
+
+    details=Object(
+        schema=IItemStructure,
+        title=_(u"Details"),
+        description=_(u"The value of the identitiy"),
+    )
+
+    def asString():
+        """
+        Identity in the form of a string.
+        """
+
+    def purpose():
+        """
+        Purpose of Identity.
+        Taken from value of inherited name attribute.
+        """
+
+
+class IContact(Interface):
+    """
+    Description of a means of contacting a party.
+    """
+
+    timeValidity=Object(
+        schema=IDvInterval,
+        title=_(u"Time Validity"),
+        description=_(u"Valid time interval for this contact descriptor."),
+        required=False,
+    )
+
+    addresses=List(
+        value_type = Object(schema = IAddress),
+        title=_(u"Addresses"),
+        description=_(u"A set of addresses for this purpose and time frame."),
+    )
+
+    def purpose():
+        """
+        Purpose for which this contact is used.
+        Taken from the inherited 'name' attribute.
+        """
+        return self.name
+
+
+class IPartyRelationship(Interface):
+    """
+    Generic description of a relationship between parties.
+    """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"UID"),
+        description=_(u"Identifier of this party."),
+
+    )
+
+    details=Object(
+        schema=IItemStructure,
+        title=_(u"Details"),
+        description=(u"Description of the relationship."),
+        required=False,
+    )
+
+    timeValidity=Object(
+        schema=IDvInterval,
+        title=_(u"Time Validity"),
+        description=_(u"Valid time interval for this relationship."),
+        required=False,
+    )
+
+    source=Object(
+        schema=IPartyRef,
+        title=_(u"Source"),
+        description=_(u"Source of relationship."),
+
+    )
+
+    target=Object(
+        schema=IPartyRef,
+        title=_(u"Target"),
+        description=_(u"Target of relationship."),
+
+    )
+
+    def type():
+        """
+        Type of relationship such as employment, authority, etc.
+        """
+
+
+class IParty(Interface):
+    """
+    Ancestor of all party types.
+    """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"UID"),
+        description=_(u"Identifier of this party."),
+    )
+
+    identities=Set(
+        title=_(u"Indentities"),
+        description=_(u"Identities used by the party to identify itself."),
+        value_type = Object(schema = IPartyIdentity))
+
+    contacts=Set(
+        title=_(u"Contacts"),
+        description=_(u"Contacts for this party."),
+        value_type = Object(schema = IContact))
+
+    relationships=Set(
+        title=_(u"Relationships"),
+        description=_(u"Relationships in which this role takes part as"
+                      " source."),
+        required=False,
+        value_type = Object(schema = IPartyRelationship))
+
+    reverseRelationships=Set(
+        title=_(u"Reverse Relationships"),
+        description=_(u"Relationships in which this role takes part as source."),
+        required=False,
+        value_type = Object(schema = ILocatableRef))
+
+    details=Object(
+        schema=IItemStructure,
+        title=_(u"Details"),
+        description=_(u"All other party details."),
+    )
+
+    def type():
+        """
+        Return the type of party from the inherited 'name' attribute.
+        """
+
+
+
+class IActor(Interface):
+    """
+    Ancestor of all real world types.
+    """
+
+    roles=Set(
+        title=_(u"Roles"),
+        description=_(u"Identifiers of the Version container for "
+                      "each Role played by this party."),
+        required=False,
+        value_type = Object(schema = IPartyRef))
+
+    languages=List(
+        title=_(u"Languages"),
+        description=_(u"A list of languages to be used to communice"
+                      " with this actor."),
+        required=False,
+        value_type = Object(schema = IDvText))
+
+    def hasLegalIdentity():
+        """
+        Return True if there is an identity with purpose 'legal identity'
+        """
+
+
+class ISearchableActor(Interface):
+
+    relationships = Attribute("")
+
+    reverse_relationships = Attribute("")
+    legal_identity = Attribute("")
+
+class ActorCatalog(grok.Indexes):
+    grok.site(OSHIP)
+    grok.context(ISearchableActor)
+    grok.name('actor_catalog')
+    
+    relationships = index.Set()
+    reverse_relationships = index.Set()
+    legal_identity = index.Text()
+
+
+
+class SearchableActor(grok.Adapter):
+
+    grok.context(IActor)
+    grok.implements(ISearchableActor)
+
+
+    def __init__(self, context):
+        self.context = context
+        rel_references = []
+        for rel in self.context.relationships:
+            rel_references.append(rel.target.uid.value)
+        self.relationships = rel_references
+        rev_references = []
+        for rev_rel in context.reverseRelationships:
+            rev_references.append(rev_rel.source.uid.value)
+        self.reverse_relationships = rev_references
+        identities  = self.context.identities
+        self.legal_identity = ""
+        for identity in identities:
+            if identity.purpose().value == 'legal identity':
+                self.legal_identity = identity.asString()
+                break
+
+class Party(Locatable):
+    """
+    Ancestor of all party types.
+    """
+
+    grok.implements(IParty,ILocatable)
+
+    def __init__(self,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Locatable.__init__(self,uid,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+
+        if self.isArchetypeRoot() == False:
+            raise(ValueError, u"Not an archetype root")
+        # if relationships != None:
+        #     for r in relationships:
+        #         if r.source.id_ != self.uid:
+        #             raise(ValueError,u"Source in relationship is not current party")
+        self.identities=identities
+        self.contacts=contacts
+        self.relationships=relationships
+        self.reverseRelationships=reverseRelationships
+        self.details=details
+
+
+    def type(self):
+        """
+        Return the type of party from the inherited 'name' attribute.
+        """
+        return self.name;
+
+    def __eq__(self, obj):
+        if self is obj:
+            return True
+        if isinstance(obj, Party):
+            return obj.identities == self.identities and obj.contacts == self.contacts and obj.relationships == self.relationships and obj.reverseRelationships == self.reverseRelationships and obj.details == self.details
+        return False
+
+    def __hash__(self):
+        result = 17
+        result += 31 * result + hash(self.identities)
+        result += 31 * result + hash(self.contacts)
+        result += 31 * result + hash(self.relationships)
+        result += 31 * result + hash(self.reverseRelationships)
+        result += 31 * result + hash(self.details)
+        return result
+
+
+class Actor(Party):
+    """
+    Ancestor of al real world types.
+    """
+
+    grok.implements(IActor)
+
+
+    def __init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Party.__init__(self,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+
+        self.roles=roles
+        self.languages=languages
+
+    def hasLegalIdentity(self):
+        """
+        Return True if there is an identity with purpose 'legal identity'
+        """
+        if 'legal identity' in self.identities:
+            return True
+        else:
+            return False
+
+    def __eq__(self, obj):
+        if self is obj:
+            return True
+        if isinstance(obj, Actor):
+            return obj.roles == self.roles and obj.languages == self.languages and Party.__eq__(self, obj)
+        return False
+
+    def __hash__(self):
+        result = 17
+        result += 31 * result + hash(self.roles)
+        result += 31 * result + hash(self.languages)
+        result += 31 * result + hash(Party.__hash__(self))
+        return result
+       
+class Address(Locatable):
+    """
+    Address of contact as an ItemStructure.
+    """
+
+    grok.implements(IAddress)
+
+    def __init__(self,details,uid,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+
+        self.details=details
+
+
+
+
+    def type(self):
+        """
+        Return the type of address from 'name'.
+        """
+        return self.name
+
+    def asString(self):
+        """
+        Address in the form of a string.
+        """
+        return ""
+
+
+class IAgent(IActor):
+    """
+    Generic concept of of any kind of agent including devices.
+    """
+    pass
+
+class Agent(Actor):
+    """
+    Generic concept of of any kind of agent including devices.
+    """
+
+    grok.implements(IAgent)
+
+    def __init__(self,roles,languages,uid,identities,contacts,category,language,relationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Actor.__init__(self,roles,languages,uid,identities,contacts,category,language,relationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+
+class ICapability(Interface):
+    """
+    Capability of a role such as ehr modifier, healthcare provider, etc.
+    """
+
+    credentials=Object(
+        schema=IItemStructure,
+        title=_(u"Credentials"),
+        description=_(u"Qualifications of the performer of the role."),
+
+    )
+
+    timeValidity=Object(
+        schema=IDvInterval,
+        title=_(u"Time Validity"),
+        description=_(u"Valid time interval for the credentials of this capability."),
+        required=False,
+    )
+
+class Capability(Locatable):
+    """
+    Capability of a role such as ehr modifier, healthcare provider, etc.
+    """
+
+    grok.implements(ICapability)
+
+    def __init__(self,credentials,timeValidity,uid,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.credentials=credentials
+        self.timeValidity=timeValidity
+
+
+
+
+
+class Contact(Locatable):
+    """
+    Description of a means of contacting a party.
+    """
+    grok.implements(IContact)
+
+    def __init__(self,timeValidity,addresses,uid,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+
+
+    def purpose():
+        """
+        Purpose for which this contact is used.
+        Taken from the inherited 'name' attribute.
+        """
+
+
+class IGroup(IActor):
+    """
+    A real world group of parties.
+    """
+    pass
+
+class Group(Actor):
+    """
+    A real world group of parties.
+    """
+
+    grok.implements(IGroup)
+    def __init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Actor.__init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+
+
+class IOrganisation(IActor):
+    """
+    Generic descriptions of organizations.
+    """
+    pass
+
+
+class Organisation(Actor):
+    """
+    Generic descriptions of organizations.
+    """
+
+    grok.implements(IOrganisation)
+
+    def __init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Actor.__init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+
+
+class PartyIdentity(Locatable):
+    """
+    An identity owned by a party.
+    """
+
+    grok.implements(IPartyIdentity)
+
+    def __init__(self,details,uid,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.details = details
+
+    def asString(self):
+        """
+        Identity in the form of a string.
+        """
+        return ""
+
+    def purpose(self):
+        """
+        Return the purpose of party identity from the inherited 'name' attribute.
+        """
+        return self.name
+
+    def __eq__(self, obj):
+        if obj is self:
+            return True
+        if isinstance(obj, PartyIdentity):
+            return Locatable.__eq__(self, obj) and self.details == obj.details
+        return False
+
+    def __hash__(self):
+        return hash(self.details)
+
+class PartyRelationship(Locatable):
+    """
+    Generic description of a relationship between parties.
+    """
+
+    grok.implements(IPartyRelationship)
+
+    def __init__(self,uid,details,timeValidity,source,target,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.details=details
+        self.timeValidity=timeValidity
+        self.source=source
+        self.target=target
+
+
+    def type(self):
+        """
+        Type of relationship such as employment, authority, etc.
+        """
+        return self.name
+
+class IPerson(IActor):
+    """
+    Generic description of of persons.  Provides a dedicated type to whicih Person archetypes can be targeted."),
+    """
+    pass
+
+class Person(Actor):
+    """
+    Generic description of of persons.  Provides a dedicated type to whicih Person archetypes can be targeted."),
+    """
+
+    grok.implements(IPerson)
+
+    def __init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Actor.__init__(self,roles,languages,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+
+class IRole(Interface):
+    """
+    Generic role played by a party.
+    """
+
+    capabilities=List(
+        title=_(u"Capabilities"),
+        description=_(u"Capabilities of this role."),
+        required=False,
+        value_type = Object(schema = ICapability)
+    )
+
+    timeValidity=Object(
+        schema=IDvInterval,
+        title=_(u"Time Validity"),
+        description=_(u"Valid time interval for this role."),
+        required=False,
+    )
+
+    performer=Object(
+        schema=IPartyRef,
+        title=_(u"Performer"),
+        description=_(u"Reference to Version container of Actor playing this role."),
+    )
+
+class Role(Party):
+    """
+    Generic role played by a party.
+    """
+
+    grok.implements(IRole)
+
+    def __init__(self,capabilities,timeValidity,performer,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links):
+        Party.__init__(self,uid,identities,contacts,relationships,reverseRelationships,details,archetypeNodeId,name,archetypeDetails,feederAudit,links)
+        self.capabilities=capabilities
+        self.timeValidity=timeValidity
+        self.performer=performer
+
+    def __eq__(self, obj):
+        if self is obj:
+            return True
+        if isinstance(obj, Role):
+            return obj.capabilities == self.capabilities and obj.timeValidity == self.timeValidity and obj.performer == self.performer and Party.__eq__(self, obj)
+        return False
+
+    def __hash__(self):
+        result = 17
+        result += 31 * result + hash(self.capabilities)
+        result += 31 * result + hash(self.timeValidity)
+        result += 31 * result + hash(self.performer)
+        result += 31 * result + hash(Party.__hash__(self))
+        return result

=== added file 'src/oship/mlhim/demographic.pyc'
Binary files src/oship/mlhim/demographic.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/demographic.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/ehr.png'
Binary files src/oship/mlhim/ehr.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/ehr.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/extract.png'
Binary files src/oship/mlhim/extract.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/extract.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/extract.py'
--- src/oship/mlhim/extract.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/extract.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,1132 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the MPL license.
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+u"""
+From the Extract Information Model
+"""
+__author__ = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'Eduardo César <xcesar at gmail dot com>'
+
+import grok
+
+from zope.i18nmessageid import MessageFactory
+from zope.interface import Interface
+from zope.schema import TextLine, Field, List, Int, Object, Bool, Set, Dict, \
+    Container
+
+from oship.mlhim.rm.common.archetyped import Locatable
+from oship.mlhim.rm.common.archetyped.interfaces import IPartyIdentified, ILocatable
+from oship.mlhim.rm.common.generic.interfaces import IRevisionHistory, IAuditDetails
+from oship.mlhim.rm.common.directory.interfaces import IFolder
+from oship.mlhim.rm.common.change_control.interfaces import IOriginalVersion, IVersion
+from oship.mlhim.rm.support.interfaces import (IArchetypeId, IUidBasedId,
+                                        IObjectRef, ILocatableRef)
+from oship.mlhim.rm.data_structures.item_structure.interfaces import IItemStructure
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import (IDvDuration,
+                                        IDvDateTime,)
+from oship.mlhim.rm.datatypes.uri.interfaces import IDvUri
+from oship.mlhim.rm.composition.interfaces import IComposition, IPartyProxy
+
+_ = MessageFactory('oship')
+
+#Begin common package
+
+class IXVersionedObject(Interface):
+    u"""
+    Variety of Extract content that consists is a sharable data-oriented
+    version of VERSIONED_OBJECT<T>.
+    """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"uid"),
+        description=_(u"Uid of original VERSIONED_OBJECT."),
+        required=True)
+
+    ownerId=Object(
+        schema=ILocatableRef,
+        title=_(u"ownerId"),
+        description=_(u"Owner_id from original VERSIONED_OBJECT, which "
+                      "identifies source EHR."),
+        required=True)
+
+    timeCreated=Object(
+        schema=IDvDateTime,
+        title=_(u"timeCreated"),
+        description=_(u"Creation time of original VERSIONED_OBJECT."),
+        required=True)
+
+    totalVersionCount=Int(
+        title=_(u"totalVersionCount"),
+        description=_(u"Total number of versions in original VERSIONED_OBJECT "
+                "at time of creation of this X_VERSIONED_OBJECT."),
+        required=True)
+
+    extractVersionCount=Int(
+        title=_(u"extractVersionCount"),
+        description=_(u"The number of Versions in this extract for this"
+                      "Versioned object, i.e. the count of items in the"
+                      "versions attribute. May be 0 if only revision history"
+                      "is requested."),
+        required=True)
+
+    revisionHistory=Object(
+        schema=IRevisionHistory,
+        title=_(u"revisionHistory"),
+        description=_(u"Optional revision history of the original "
+                      "VERSIONED_OBJECT. If included, it is the complete "
+                      "revision history."),
+        required=False)
+
+    versions=List(
+        value_type=Object(schema=IOriginalVersion),
+        title=_(u"0 or more Versions from the original VERSIONED_OBJECT, "
+                "according to the Extract specification."),
+        required=False)
+
+
+class IExtractItem(Interface):
+    u"""
+    Wrapper for one content item in Extract, containing various meta-data.
+    Indicates whether it was part of the primary set and what its original path
+    was.
+    """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"uid"),
+        description=_(u"Unique id of this Extract item; used for all"
+                      "referencing from elsewhere in Extract,"
+                      "including from Extract Folders."),
+        required=True)
+
+    isPrimary=Bool(
+        title=_(u"isPrimary"),
+        description=_(u"True if the content item carried in this container "
+                      "was part of the primary set for the Extract , i.e. not "
+                      "added due to link-following."),
+        required=True)
+
+    isChanged=Bool(
+        title=_(u"isChanged"),
+        description=_(u"True if the content item carried in this container "
+                      "is any kind of change since last send, in repeat "
+                      "sending situations."),
+        required=True)
+
+    originalPath=Object(
+        schema=IDvUri,
+        title=_(u"originalPath"),
+        description=_(u"The original path of the item in the source "
+                      "repository, used for matching items in the "
+                      "receiver's repository."),
+        required=False)
+
+    isMasked=Bool(
+        title=_(u"isMasked"),
+        description=_(u"True if the content of this item has not been "
+                      "included due to insufficient access rights of "
+                      "requestor."),
+        required=True)
+
+    item=Object(
+        schema=IXVersionedObject,
+        title=_(u"item"),
+        description=_(u"Information Item"),
+        required=False)
+
+
+class IExtractEntityContent(Interface):
+    u"""
+    Container of extracted and serialised content. Intended to be subtyped into
+    e.g. EHR_EXTRACT_CONTENT etc.
+    """
+    pass
+
+
+class IIExtractFolder(Interface):
+    u"""
+    Folder in local Folder structure in an Extract. Empty Folders are allowed.
+    """
+    pass
+
+
+class IExtractFolder(Interface):
+    u"""
+    Folder in local Folder structure in an Extract. Empty Folders are allowed.
+    """
+
+    folders=List(
+        value_type=Object(schema=IIExtractFolder),
+        title=_(u"folders"),
+        description=_(u"Sub-folders of this folder, including distinct "
+                      "folders: Folder trees, which may be separately "
+                      "archetyped."),
+        required=False)
+
+    items=List(
+        value_type=Object(schema=IObjectRef),
+        title=_(u"items"),
+        description=_(u"List of references to EXTRACT_ITEMs in this Extract."),
+        required=False)
+
+
+class IExtractEntityIdentifier(Interface):
+    u"""
+    Identifier for a single demographic entity or record thereof. Because
+    identification is poorly standardised and also heavily dependent on
+    existing systems, this class provides two possibilities for identification:
+    an id for the record, or an id for the demographic entity. These are not
+    always 1:1 anyway, due to errors that occur in systems causing duplicate
+    records for a given entity.
+    """
+
+    entityId=Object(
+        schema=IPartyIdentified,
+        title=_(u"entityId"),
+        description=_(u"Identifies a demographic entity for which there is"
+                      "a record."),
+        required=False)
+
+    recordId=Object(
+        schema=IUidBasedId,
+        title=_(u"recordId"),
+        description=_(u"Identifies a record for a demographic entity."),
+        required=False)
+
+
+class IExtractChapter(Interface):
+    u"""
+    One content chapter of an Extract; contains information relating to only
+    one Purpose entity.
+    """
+
+    entityIdentifier=Object(
+        schema=IExtractEntityIdentifier,
+        title=_(u"entityIdentifier"),
+        description=_(u"Reference to causing Request, if any."),
+        required=True)
+
+    content=Object(
+        schema=IExtractEntityContent,
+        title=_(u"content"),
+        description=_(u"The information content of this chapter. Void if the "
+                      "requested entity does not exist in the repository."),
+        required=True)
+
+    directory=Object(
+        schema=IExtractFolder,
+        title=_(u"directory"),
+        description=_(u"Optional Folder structure for this Extract."),
+        required=False)
+
+
+class IExtractEntityManifest(Interface):
+    u"""
+    The manifest for one entity, identifying the entity and optionally
+    specifying top-level items to be included in the Extract. The list actually
+    included may be modi- fied by the version_spec part of the specification,
+    and also by the link_depth attribute. In repeat (standing order) Requests,
+    the final inclusion may be modified by the send_changes_only flag of the
+    update_spec.
+    """
+
+    entityIdentifier=Object(
+        schema=IExtractEntityIdentifier,
+        title=_(u"entityIdentifier"),
+        description=_(u"Identifies an entity, such as an EHR or subject(i.e. "
+                      "usually a person or other demographic entity)."),
+        required=True)
+
+    itemList=List(
+        title=_(u"itemList"),
+        description=_(u"List of uids of items included in the Extract; for "
+                      "openEHR data, these are uids identifying the version "
+                      "containers."),
+        required=False)
+
+
+class IExtractManifest(Interface):
+    u"""
+    Specification of the candidate entities and optionally top-level items to
+    be included in the Extract.
+    """
+
+    entities=List(
+        title=_(u"entities"),
+        description=_(u"List of entity manifests uids of items "
+                       "included in the Extract; for openEHR data,"
+                       "these are uids identifying the version "
+                       "containers."),
+        required=True)
+
+
+class IExtractVersionSpec(Interface):
+    u"""
+    Specification of what versions should be included in an Extract. By
+    default, only latest versions are included in the Extract, in which case
+    this part of the Extract specification is not needed at all. The attributes
+    include_all_versions and commit_time_interval are used to modify this; the
+    former forces all versions to be included; the latter limits the versions
+    to be those latest versions committed in the time interval, or if
+    include_all_versions is True, all versions committed in the time interval.
+    """
+
+    includesAllVersions=Bool(
+        title=_(u"includesAllVersions"),
+        description=_(u"True if all versions of each item in the Extract are "
+                      "included."),
+        required=True)
+
+    includesRevisionHistory=Bool(
+        title=_(u"includesRevisionHistory"),
+        description=_(u"True if revision histories of the items in the Extract"
+                      " are included. If included, it is always the full "
+                      "revision history."),
+        required=True)
+
+    includesData=Bool(
+        title=_(u"includesData"),
+        description=_(u"True if the data of items matched by the content spec "
+                      "should be included. This is the default. If False, only"
+                      "revision history is included in serialised versions. "
+                      "Turning this option on in openEHR systems causes"
+                      "X_VERSIONED_OBJECTs to have revision_history set, but "
+                      "versions Void. Useful for interrogating a server "
+                      "without having to look at any content data. In other"
+                      "systems it may or may not have a sensible meaing."),
+        required=True)
+
+
+class IExtractSpec(Interface):
+    u"""
+    Specification of an Extract's contents. Subtypes can be used to add details
+    specific to the type of Extract. The specification consists of attributes
+    specifying the directory, and two further groups of attributes in their own
+    classes, namely a version specfication (which versions of information items
+    are to be included) and a manifest (which entities are to be included in
+    the extract).
+    """
+
+    extractType=TextLine(
+        title=_(u"extractType"),
+        description=_(u"Coded term indicating the type of content required, "
+                      "e.g. 'openehr-ehr', 'openehr-demographic', "
+                      "'generic-emrther'"),
+        required=True)
+
+    includesMultimedia=Bool(
+        title=_(u"includesMultimedia"),
+        description=_(u"Indicates whether inline instances of DV_MULTIMEDIA in"
+                      "the source data are included or not."),
+        required=True)
+
+    linkDepth=Int(
+        title=_(u"linkDepth"),
+        description=_(u"""Degree of links to follow emanating from content
+                      items specified for inclusion. The kind of links to
+                      follow is dependent on the type of Extract. All items at
+                      the target end of followed links at the given depth are
+                      also included in the extract; EXTRACT_ITEM.is_primary is
+                      used to differentiate. - 0 = don’t follow; - 1 = follow
+                      first degree links; - 2 = follow 2nd degree links; - ...
+                      - n =
+                      follow nth degree links"""),
+        required=True)
+
+    criteria=List(
+        title=_(u"criteria"),
+        description=_(u"Queries specifying the contents of this Extract."),
+        required=False)
+
+    manifest=Object(
+        schema=IExtractManifest,
+        title=_(u"manifest"),
+        description=_(u"Specification of entities (e.g. records) to include in"
+                      " the Extract."),
+        required=True)
+
+    versionSpec=Object(
+        schema=IExtractVersionSpec,
+        title=_(u"versionSpec"),
+        description=_(u"Specification of which versions of information items"
+                      "to include in the Extract. If Void, the default is"
+                      "latest versions only (which is reasonable for non-"
+                      "versioning systems as well."),
+        required=False)
+
+    includesDirectory=Bool(
+        title=_(u"includesDirectory"),
+        description=_(u"True if the Extract includes a Folder directory."),
+        required=True)
+
+    directoryArchetype=Object(
+        schema=IArchetypeId,
+        title=_(u"directoryArchetype"),
+        description=_(u"Identifier of archetype to use for local Folder "
+                      "structure; if Void and includes_directory is"
+                      "True, a non-archetyped directory is used."),
+        required=False)
+
+    otherDetails=Object(
+        schema=IItemStructure,
+        title=_(u"otherDetails"),
+        description=_(u"Other specifications items. Archetypable"),
+        required=False)
+
+
+class IExtractUpdateSpec(Interface):
+    u"""
+    Specification of the how Request should be processed by server. The Request
+    can be persisted in the server, meaning that a) it can be re-activated by
+    the requesting system simply by indicating Request id, and b) that a
+    changes-only pattern of Extract updates can be set up. To achieve this, the
+    server has to remember what was send in the previous reponse.
+
+    The update mode may be event-driven and periodic update or a mixture of
+    both. The candidate items to be sent each time are the result of
+    re-evaluating the content and versioning parts of the specification;
+    what is actually sent is determined by the send_changes_only flag.
+    """
+
+    persistInServer=Bool(
+        title=_(u"persistInServer"),
+        description=_(u"If True, this Request is persisted in the server "
+                      "until further notice."),
+        required=True)
+
+    sendChangesOnly=Bool(
+        title=_(u"sendChangesOnly"),
+        description=_(u"If True, send only items that are changed "
+                      "(including logical deletions) or new since "
+                      "last send. For persist_in_server Requests only."),
+        required=True)
+
+    repeatPeriod=Object(
+        schema=IDvDuration,
+        title=_(u"repeatPeriod"),
+        description=_(u"Period for resending update Extracts in response to "
+                      "original Request."),
+        required=False)
+
+    triggerEvents=TextLine(
+        title=_(u"triggerEvents"),
+        description=_(u"Set of event names that will cause sending"
+                        "of update Extracts. Event types include: "
+                        "- 'any_change' - any change in content "
+                        "items matched by content specification, e.g. "
+                        "new versions of persistent compositions. If "
+                        "the content list allows matching of any, or a "
+                        "wide range of archetypes, this event type "
+                        "will match any additions to the record. "
+                        "- 'correction' - match error corrections "
+                        "only, including deletions. "
+                        "- 'update' - match updates (i.e. new ver- "
+                        "sions) of included content items. "),
+        required=False)
+
+
+class IExtractRequest(Interface):
+    u"""
+    Generic model of a Request for an Extract, containing an Extract
+    specification.
+    """
+
+    extractSpec=Object(
+        schema=IExtractSpec,
+        title=_(u"extractSpec"),
+        description=_(u"Specification details of the request."),
+        required=True)
+
+    updateSpec=Object(
+        schema=IExtractUpdateSpec,
+        title=_(u"updateSpec"),
+        description=_(u"Update details of the request"),
+        required=False)
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"uid"),
+        description=_(u"Identifier of this Request, generated by requestor."),
+        required=True)
+
+
+class IExtract(Interface):
+    u"""
+    Generic model of an Extract of some information from a repository; the
+    generic parameters select which kind of specification and content the
+    Extract carries.
+    """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"uid"),
+        description=_(u"Identifier of this Extract"),
+        required=True)
+
+    requestId=Object(
+        schema=IObjectRef,
+        title=_(u"requestId"),
+        description=_(u"Reference to causing Request, if any."),
+        required=False)
+
+    sequenceNr=Int(
+        title=_(u"sequenceNr"),
+        description=_(u"Number of this Extract response in sequence of"
+                      "responses to Extract request identified by request_id. "
+                      "If this is the sole response, or there was no request, "
+                      "value is 1."),
+        required=True)
+
+    specification=Object(
+        schema=IExtractSpec,
+        title=_(u"specification"),
+        description=_(u"The specification that this Extract actually "
+                       "conforms to; might not be identical with the "
+                       "specification of the corresponding request."),
+        required=False)
+
+    participations=Set(
+        title=_(u"participations"),
+        description=_(u"Participations relevant to the creation of this"
+                       "Extract."),
+        required=False)
+
+    chapters=List(
+        value_type=Object(schema=IExtractChapter),
+        title=_(u"chapters"),
+        description=_(u"The content extracted and serialised from "
+                      "the source repository for this Extract."),
+        required=True)
+
+
+class ExtractRequest(Locatable):
+    u"""
+    Generic model of a Request for an Extract, containing an Extract
+    specification.
+    """
+
+    grok.implements(IExtractRequest)
+
+    def __init__(self, extractSpec, updateSpec, uid):
+        self.extractSpec = extractSpec
+        self.updateSpec = updateSpec
+        self.uid = uid
+
+
+class IExtractActionRequest(Interface):
+    u"""
+    Generic model of a Request for an Extract, containing an Extract
+    specification.
+    """
+
+    requestId=Object(
+        schema=IObjectRef,
+        title=_(u"requestId"),
+        description=_(u"Identifier of previous EXTRACT_REQUEST."),
+        required=True)
+
+    action=TextLine(
+        title=_(u"action"),
+        description=_(u"Requested action: cancel, resend, send new"),
+        required=True)
+
+
+class ExtractActionRequest(Locatable):
+    u"""
+    Generic model of a Request for an Extract, containing an Extract
+    specification.
+    """
+
+    grok.implements(IExtractActionRequest)
+
+    def __init__(self, requestId, action):
+        self.requestId = requestId
+        self.action = action
+
+
+class ExtractSpec(object):
+    u"""
+    Specification of an Extract's contents. Subtypes can be used to add details
+    specific to the type of Extract. The specification consists of attributes
+    specifying the directory, and two further groups of attributes in their own
+    classes, namely a version specfication (which versions of information items
+    are to be included) and a manifest (which entities are to be included in
+    the extract).
+    """
+
+    grok.implements(IExtractSpec)
+
+    def __init__(self, extractType, includesMultimedias, linkDepth, criteria, \
+                 manifest, versionSpec, includesDirectory, directoryArchetype,\
+                 otherDetails):
+        self.extractType = extractType
+        self.includesMultimedias = includesMultimedias
+        self.linkDepth = linkDepth
+        self.criteria = criteria
+        self.manifest = manifest
+        self.versionSpec = versionSpec
+        self.includesDirectory = includesDirectory
+        self.directoryArchetype = directoryArchetype
+        self.otherDetails = otherDetails
+
+
+class ExtractManifest(object):
+    u"""
+    Specification of the candidate entities and optionally top-level items to
+    be included in the Extract. """
+
+    grok.implements(IExtractManifest)
+
+    def __init__(self, entities):
+        self.entities = entities
+
+
+class ExtractEntityManifest(object):
+    u"""
+    The manifest for one entity, identifying the entity and optionally
+    specifying top-level items to be included in the Extract. The list actually
+    included may be modi- fied by the version_spec part of the specification,
+    and also by the link_depth attribute. In repeat (standing order) Requests,
+    the final inclusion may be modified by the send_changes_only flag of the
+    update_spec.
+    """
+
+    grok.implements(IExtractEntityManifest)
+
+    def __init__(self, entityIdentifier, itemList):
+        self.entityIdentifier = entityIdentifier
+        self.itemList = itemList
+
+
+class ExtractEntityIdentifier(object):
+    u"""
+    Identifier for a single demographic entity or record thereof. Because
+    identification is poorly standardised and also heavily dependent on
+    existing systems, this class provides two possibilities for identification:
+    an id for the record, or an id for the demographic entity. These are not
+    always 1:1 anyway, due to errors that occur in systems causing duplicate
+    records for a given entity.
+    """
+
+    grok.implements(IExtractEntityIdentifier)
+
+    def __init__(self, entityId, recordId):
+        self.entityId = entityId
+        self.recordId = recordId
+
+
+class ExtractVersionSpec(object):
+    u"""
+    Specification of what versions should be included in an Extract. By
+    default, only latest versions are included in the Extract, in which case
+    this part of the Extract specification is not needed at all. The attributes
+    include_all_versions and commit_time_interval are used to modify this; the
+    former forces all versions to be included; the latter limits the versions
+    to be those latest versions committed in the time interval, or if
+    include_all_versions is True, all versions committed in the time interval.
+    """
+
+    grok.implements(IExtractVersionSpec)
+
+    def __init__(self, commitTimeInterval, includesAllVersions, \
+                 includesRevisionHistory, includesData):
+        self.commitTimeInterval = commitTimeInterval
+        self.includesAllVersions = includesAllVersions
+        self.includesRevisionHistory = includesRevisionHistory
+        self.includesData = includesData
+
+
+class ExtractUpdateSpec(object):
+    u"""
+    Specification of the how Request should be processed by server. The Request
+    can be persisted in the server, meaning that a) it can be re-activated by
+    the requesting system simply by indicating Request id, and b) that a
+    changes-only pattern of Extract updates can be set up. To achieve this, the
+    server has to remember what was send in the previous reponse.
+
+    The update mode may be event-driven and periodic update or a mixture of
+    both. The candidate items to be sent each time are the result of
+    re-evaluating the content and versioning parts of the specification;
+    what is actually sent is determined by the send_changes_only flag.
+    """
+
+    grok.implements(IExtractUpdateSpec)
+
+    def __init__(self, persistInServer, sendChangesOnly, repeatPeriod, \
+                 triggerEvents):
+        self.persistInServer = persistInServer
+        self.sendChangesOnly = sendChangesOnly
+        self.repeatPeriod = repeatPeriod
+        self.triggerEvents = triggerEvents
+
+
+class Extract(Locatable):
+    u"""
+    Generic model of an Extract of some information from a repository; the
+    generic parameters select which kind of specification and content the
+    Extract carries.
+    """
+
+    grok.implements(IExtract)
+
+    def __init__(self, uid, requestId, sequenceNr, specification, \
+                 participations, chapters):
+        self.uid = uid
+        self.requestId = requestId
+        self.sequenceNr = sequenceNr
+        self.specification = specification
+        self.participations = participations
+        self.chapters = chapters
+
+
+class ExtractChapter(Locatable):
+    u"""
+    One content chapter of an Extract; contains information relating to only
+    one Purpose entity.
+    """
+
+    grok.implements(IExtractChapter)
+
+    def __init__(self, entityIdentifier, content, directory):
+        self.entityIdentifier = entityIdentifier
+        self.content = content
+        self.directory = directory
+
+
+class ExtractFolder(Locatable):
+    u"""
+    Folder in local Folder structure in an Extract. Empty Folders are allowed.
+    """
+
+    grok.implements(IExtractFolder)
+
+    def __init__(self, folders, items):
+        self.folders = folders
+        self.items = items
+
+
+class ExtractEntityContent(object):
+    u"""
+    Container of extracted and serialised content. Intended to be subtyped into
+    e.g. EHR_EXTRACT_CONTENT etc.
+    """
+    grok.implements(IExtractEntityContent)
+
+
+class ExtractItem(object):
+    u"""
+    Wrapper for one content item in Extract, containing various meta-data.
+    Indicates whether it was part of the primary set and what its original path
+    was.
+    """
+
+    grok.implements(IExtractItem)
+
+    def __init__(self, uid, isPrimary, isChanged, originalPath, isMasked, \
+                 item):
+        self.uid = uid
+        self.isPrimary = isPrimary
+        self.isChanged = isChanged
+        self.originalPath = originalPath
+        self.isMasked = isMasked
+        self.item = item
+
+
+class XVersionedObject(object):
+    u"""
+    Variety of Extract content that consists is a sharable data-oriented
+    version of VERSIONED_OBJECT<T>. """
+
+    grok.implements(IXVersionedObject)
+
+    def __init__(self, uid, ownerId, timeCreated, totalVersionCount, \
+                 extractVersionCount, revisionHistory, versions):
+        self.uid = uid
+        self.ownerId = ownerId
+        self.timeCreated = timeCreated
+        self.totalVersionCount = totalVersionCount
+        self.extractVersionCount = extractVersionCount
+        self.revisionHistory = revisionHistory
+        self.versions = versions
+
+
+#Begin ehrextract package
+
+class IEhrExtractContent(Interface):
+    u"""
+    Form of EHR Extract content containing openEHR serialised
+    VERSIONED_OBJECTs.
+    """
+
+    directory=Object(
+        schema=IXVersionedObject,
+        #value_type=Object(schema=IFolder),
+        title=_(u"directory"),
+        description=_(u"Folder tree from source EHR."),
+        required=False)
+
+    compositions=Set(
+        value_type=Object(schema=IXVersionedObject),
+        title=_(u"compositions"),
+        description=_(u"Compositions from source EHR."),
+        required=False)
+
+    demographics=Set(
+        value_type=Object(schema=IXVersionedObject),
+        title=_(u"demographics"),
+        description=_(u"Demographic entities from source EHR."),
+        required=False)
+
+    otherItems=Set(
+        value_type=Object(schema=IXVersionedObject),
+        title=_(u"otherItems"),
+        description=_(u"Other items from source EHR."),
+        required=False)
+
+
+class EhrExtractContent(ExtractRequest):
+    u"""
+    Form of EHR Extract content containing openEHR serialised
+    VERSIONED_OBJECTs.
+    """
+
+    grok.implements(IEhrExtractContent)
+
+    def __init__(self, directory, compositions, demographics, otherItems):
+        self.directory = directory
+        self.compositions = compositions
+        self.demographics = demographics
+        self.otherItems = otherItems
+
+
+#Begin generic extract package
+
+class IGenericExtractItem(Interface):
+    u"""
+    Single item in generic extract.
+    """
+
+    item=Object(
+        schema=ILocatable,
+        title=_(u"item"),
+        description=_(u"Content item"),
+        required=True)
+
+    itemType=TextLine(
+        title=_(u"itemType"),
+        description=_(u"Type of item."),
+        required=True)
+
+    versionId=TextLine(
+        title=_(u"versionId"),
+        description=_(u"Version id of this item in original system."),
+        required=False)
+
+    versionSetId=TextLine(
+        title=_(u"versionSetId"),
+        description=_(u"Version set id of this item in original system, "
+                      "where applicable."),
+        required=False)
+
+    otherDetails=Dict(
+        title=_(u"otherDetails"),
+        description=_(u"Other details about the content item."),
+        required=False)
+
+
+class IGenericExtractContent(Interface):
+    u"""
+    Generic form of EHR Extract content capable of carrying any data.
+    """
+
+    iterms=List(
+        value_type=Object(schema=IGenericExtractItem),
+        title=_(u"items"),
+        description=_(u"Items."),
+        required=True)
+
+
+class GenericExtractContent(ExtractRequest):
+    u"""
+    Generic form of EHR Extract content capable of carrying any data.
+    """
+
+    grok.implements(IGenericExtractContent)
+
+    def __init__(self, items):
+        self.items = items
+
+
+class GenericExtractItem(ExtractItem):
+    u"""
+    Single item in generic extract.
+    """
+
+    grok.implements(IGenericExtractItem)
+
+    def __init__(self, item, itemType, versionId, versionSetId, otherDetails):
+        self.item = item
+        self.itemType = itemType
+        self.versionId = versionId
+        self.versionSetId = versionSetId
+        self.otherDetails = otherDetails
+
+
+#Begin message package
+
+class IMessage(Interface):
+    u"""
+    A "message" is an authored, possibly signed, piece of content intended for
+    one or more recipients. Since the recipient may or may not be known
+    directly, recipients are specified in the ADDRESSED_MESSAGE class.
+    """
+
+    audit=Object(
+        schema=IAuditDetails,
+        title=_(u"audit"),
+        description=_(u"Details of who actually created the message and when. "
+                      "This is the person who entered the data or otherwise "
+                      "caused the message to be created, or might be a piece "
+                      "of softare."),
+        required=True)
+
+    author=Object(
+        schema=IPartyProxy,
+        title=_(u"author"),
+        description=_(u"Party responsible for the message content, who may or "
+                      "may not be technically responsible for its creation "
+                      "(e.g. by data entry etc)."),
+        required=True)
+
+    content=Container(
+        title=_(u"content"),
+        description=_(u"Content of the message."),
+        required=True)
+
+    signature=TextLine(
+        title=_(u"signature"),
+        description=_(u"Optional signature by the author of message content "
+                      "in openPGP format. The signature is created as a Hash "
+                      "and optional signing of the serialisation of this "
+                      "message object with this signature field Void."),
+        required=False)
+
+
+class IAddressedMessage(Interface):
+    u"""
+    The concept of a message addressed to nominated recipients.
+    """
+
+    sender=TextLine(
+        title=_(u"sender"),
+        description=_(u"Party sending the message."),
+        required=True)
+
+    senderReference=TextLine(
+        title=_(u"senderReference"),
+        description=_(u"Identification of message used by sender. This will "
+                      "be the same no matter how many times this message is "
+                      "sent to these recipients."),
+        required=True)
+
+    addresses=List(
+        title=_(u"addresses"),
+        description=_(u"Intended recipients, in the form of internet"
+                      "addresses."),
+        required=True)
+
+    urgency=Int(
+        title=_(u"urgency"),
+        description=_(u"Urgency with which destination should deal with"
+                      "message: -1 - low: 0 - normal: 1 - high"),
+        required=False)
+
+    message=Object(
+        schema=IMessage,
+        title=_(u"message"),
+        description=_(u"The content of the message."),
+        required=True)
+
+
+class AddressedMessage(object):
+    u"""
+    The concept of a message addressed to nominated recipients.
+    """
+
+    grok.implements(IAddressedMessage)
+
+    def __init__(self, sender, senderReference, addresses, urgency, message):
+        self.sender = sender
+        self.senderReference = senderReference
+        self.addresses = addresses
+        self.urgency = urgency
+        self.message = message
+
+
+class Message(object):
+    u"""
+    A "message" is an authored, possibly signed, piece of content intended for
+    one or more recipients. Since the recipient may or may not be known
+    directly, recipients are specified in the ADDRESSED_MESSAGE class.
+    """
+
+    grok.implements(IMessage)
+
+    def __init__(self, audit, author, content, sig):
+        self.audit = audit
+        self.author = author
+        self.content = content
+        self.signature = sig
+
+
+#Begin syncextract package
+
+class ISyncExtractSpec(Interface):
+    u"""
+    Details of specification of Extract, used in a request to specify an
+    Extract, or in a response, to describe what is actually in the Extract.
+    """
+
+    includesVersion=Bool(
+        title=_(u"includesVersion"),
+        description=_(u"True if the Versions from the Contribution are "
+                      "included; False if just the Contribution and its Audit "
+                      "are included."),
+        required=True)
+
+    contributionList=List(
+        value_type=Object(schema=IUidBasedId),
+        title=_(u"contributionList"),
+        description=_(u"List of Contributions to include / that are included "
+                      "in the Extract."),
+        required=False)
+
+    contributionsSince=Object(
+        schema=IDvDateTime,
+        title=_(u"contributionsSince"),
+        description=_(u"Specify Contributions included in Extract by "
+                      "contributions_since: threshold date."),
+        required=False)
+
+    allContributions=Bool(
+        title=_(u"allContributions"),
+        description=_(u"True if all Contributions in the record are "
+                      "included."),
+        required=True)
+
+
+class ISyncExtractRequest(Interface):
+    u"""
+    Type of request designed for synchronisation of Contributions between
+    openEHR servers.
+    """
+
+    specification=Object(
+        schema=ISyncExtractSpec,
+        title=_(u"specification"),
+        description=_(u"Details of specification of synchronisation request."),
+        required=True)
+
+
+class SyncExtractRequest(Message):
+    u"""
+    Type of request designed for synchronisation of Contributions between
+    openEHR servers.
+    """
+
+    grok.implements(ISyncExtractRequest)
+
+    def __init__(self, specification):
+        self.specification = specification
+
+
+class IXContribution(Interface):
+    u"""
+    Serialised form of Contribution for an Extract.
+    """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u"uid"),
+        description=_(u"Uid of Contribution in source system."),
+        required=True)
+
+    audit=Object(
+        schema=IAuditDetails,
+        title=_(u"audit"),
+        description=_(u"Audit of Contribution in source system."),
+        required=True)
+
+    versions=List(
+        value_type=Object(schema=IVersion),
+        title=_(u"versions"),
+        description=_(u"Serialised Versions from Contribution in source "
+                      "system."),
+        required=False)
+
+
+class ISyncExtract(Interface):
+    u"""
+    Synchronisation Extract.
+    """
+
+    specification=Object(
+        schema=ISyncExtractSpec,
+        title=_(u"specification"),
+        description=_(u"Details of specification of this Extract."),
+        required=True)
+
+    content=Set(
+        value_type=Object(schema=IXContribution),
+        title=_(u"content"),
+        description=_(u"Content, in the form of a serialised Contributions."),
+        required=True)
+
+
+class SyncExtract(Message):
+    u"""
+    Synchronisation Extract.
+    """
+
+    grok.implements(ISyncExtract)
+
+    def __init__(self, specification, content):
+        self.specification = specification
+        self.content = content
+
+
+class SyncExtractSpec(object):
+    u"""
+    Details of specification of Extract, used in a request to specify an
+    Extract, or in a response, to describe what is actually in the Extract.
+    """
+
+    grok.implements(ISyncExtractSpec)
+
+    def __init__(self, includesVersion, contributionList, contributionsSince, \
+                 allContributions):
+        self.includesVersion = includesVersion
+        self.contributionList = contributionList
+        self.contributionsSince = contributionsSince
+        self.allContributions = allContributions
+
+
+class XContribution(object):
+    u"""
+    Serialised form of Contribution for an Extract.
+    """
+
+    grok.implements(IXContribution)
+
+    def __init__(self, uid, audit, vers):
+        self.uid = uid
+        self.audit = audit
+        self.vers = vers

=== added file 'src/oship/mlhim/extract.pyc'
Binary files src/oship/mlhim/extract.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/extract.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/integration.png'
Binary files src/oship/mlhim/integration.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/integration.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/integration.py'
--- src/oship/mlhim/integration.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/integration.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the MPL license.
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+"""
+
+From the integration package in integration_im.pdf Rev. 0.6
+
+"""
+__author__ = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'Roger Erens <roger.erens@xxxxxxxxx>',
+'Eduardo César Pimenta Ribeiro <xcesar at gmail dot com>',
+'Wagner Francisco Mezaroba <wagnerfrancisco@xxxxxxxxx>'
+
+import grok
+
+from zope.interface import Interface
+from zope.schema import Field, Object
+from zope.i18nmessageid import MessageFactory
+
+from oship.mlhim.rm.data_structures.item_structure.interfaces import IItemTree
+from oship.mlhim.rm.composition.content import ContentItem
+
+_ = MessageFactory('oship')
+
+
+class IGenericEntry(Interface):
+    """
+    This class is used to create intermediate representations of data
+    from sources not otherwise conforming to openEHR classes, such as
+    HL7 messages, relational databases and so on.
+    """
+
+    data = Object(
+        schema=IItemTree,
+       title=_(u"Data"),
+       description=_(u"an ITEM_TREE - The 'data' from the source message"
+                     " or record."),
+       )
+
+
+class GenericEntry(ContentItem):
+    """
+    This class is used to create intermediate representations of data from
+    sources not
+    otherwise conforming to openEHR classes, such as HL7 messages, relational
+    databases and so on.
+    """
+
+    grok.implements(IGenericEntry)
+
+    def __init__(self,data,uid,atnodeid,name,atdetails,fdraudit,links):
+        ContentItem.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.data=data

=== added file 'src/oship/mlhim/integration.pyc'
Binary files src/oship/mlhim/integration.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/integration.pyc	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/openehr_packages.png'
Binary files src/oship/mlhim/openehr_packages.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/openehr_packages.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/openehrprofile.png'
Binary files src/oship/mlhim/openehrprofile.png	1970-01-01 00:00:00 +0000 and src/oship/mlhim/openehrprofile.png	2010-08-06 02:59:44 +0000 differ
=== added file 'src/oship/mlhim/openehrprofile.py'
--- src/oship/mlhim/openehrprofile.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/openehrprofile.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,383 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the MPL license.
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+"""
+
+From the Archetype Profile specifications
+
+"""
+__author__  = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'Roger Erens <roger.erens@xxxxxxxxx>'
+
+
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import TextLine,Field,List,Set,Object
+import grok
+
+from oship.mlhim.archetype import CDomainType
+from oship.mlhim.rm.datatypes.text.interfaces import ICodePhrase
+from oship.mlhim.rm.datatypes.quantity.interfaces import IDvOrdinal,IDvInterval
+
+from oship.mlhim.rm.support import Interval
+from oship.mlhim.rm.support.interfaces import ITerminologyId
+
+_ = MessageFactory('oship')
+
+#Begin Basic Datatypes package
+class IState(Interface):
+    """
+    Abstract definition of one state in a state machine.
+    """
+
+    name = TextLine(
+        title=_(u"Name"),
+        description=_(u"""Name of this State."""),
+        required=False,
+        )
+
+class State(grok.Model):
+    """
+    Abstract definition of one state in a state machine.
+    """
+    grok.implements(IState)
+
+    def __init__(self,name):
+        self.name=name
+
+class IStateMachine(Interface):
+    """
+    Definition of a state machine in terms of states, transition events and outputs, and
+    next states.
+    """
+
+    states = Set(
+        title=_(u"States"),
+        description=_(u"""A Set of State types. """),
+        value_type=Object(schema=IState),
+        )
+
+
+
+class ICDvState(Interface):
+    """
+    Constrainer type for DV_STATE instances. The attribute c_value defines a
+    state/event table which constrains the allowed values of the attribute value in a
+    DV_STATE instance, as well as the order of transitions between values.
+    """
+
+    value = Object(
+        schema=IStateMachine,
+        title=_(u"Value"),
+        description=_(u""" """),
+
+        )
+
+
+class CDvState(CDomainType):
+    u"""
+    Constrainer type for DV_STATE instances. The attribute c_value defines a
+    state/event table which constrains the allowed values of the attribute value in a
+    DV_STATE instance, as well as the order of transitions between values.
+    """
+
+    grok.implements(ICDvState)
+
+
+    def __init__(self,value):
+        self.value=value
+
+class ITransition(Interface):
+    """
+    Definition of a state machine transition.
+    """
+
+    event = TextLine(
+        title=_(u"Event"),
+        description=_(u"""Event which fires this transition."""),
+
+        )
+
+    guard = TextLine(
+        title=_(u"Guard"),
+        description=_(u"""Guard condition which must be true for this transition to fire."""),
+        required=False,
+        )
+
+    action = TextLine(
+        title=_(u"Action"),
+        description=_(u"""Side-effect action to execute during the firing of this transition."""),
+        required=False,
+        )
+
+    nextState = Object(
+        schema=IState,
+        title=_(u"Next State"),
+        description=_(u"""Target state of next transition. """),
+
+        )
+
+class INonTerminalState(Interface):
+    """
+    Definition of a non-terminal state in a state machine, i.e. one that has transitions.
+    """
+
+    transitions = Set(
+        title=_(u"Transitions"),
+        description=_(u"""A Set of Transition types. """),
+        required=False,
+        value_type=Object(schema=ITransition),
+        )
+
+class NonTerminalState(State):
+    """
+    Definition of a non-terminal state in a state machine, i.e. one that has transitions.
+    """
+    grok.implements(INonTerminalState)
+
+    def __init__(self,transitions):
+        self.transitions=transitions
+
+
+
+
+class StateMachine(grok.Model):
+    u"""
+    Definition of a state machine in terms of states, transition events and outputs, and
+    next states.
+    """
+    grok.implements(IStateMachine)
+
+    def __init__(self,states):
+        self.states=states
+
+
+class ITerminalState(Interface):
+    """
+    Definition of a terminal state in a state machine, i.e. a state with no exit transitions.
+    """
+    pass
+
+class TerminalState(State):
+    u"""
+    Definition of a terminal state in a state machine, i.e. a state with no exit transitions.
+    """
+    grok.implements(ITerminalState)
+
+    def __init__(self,name):
+        State.__init__(self,name)
+
+
+
+
+class Transition(grok.Model):
+    """
+    Definition of a state machine transition.
+    """
+    grok.implements(ITransition)
+
+    def __init__(self,event,guard,action,nextstate):
+        self.event=event
+        self.guard=guard
+        self.action=action
+        self.nextState=nextstate
+
+
+#Begin Quantity Datatypes package
+class ICDvOrdinal(Interface):
+    """
+    Class specifying constraints on instances of DV_ORDINAL. Custom constrainer type for instances of DV_ORDINAL.
+    """
+
+    list_ = Set(
+        title=_(u"List"),
+        description=_(u"""Set of allowed DV_ORDINALS."""),
+        value_type=Object(schema=IDvOrdinal),
+        )
+
+class CDvOrdinal(CDomainType):
+    """
+    Class specifying constraints on instances of DV_ORDINAL. Custom constrainer type for instances of DV_ORDINAL.
+    """
+
+    grok.implements(ICDvOrdinal)
+
+
+    def __init__(self,list_):
+        self.list_=list_
+
+class ICQuantityItem(Interface):
+    """
+    Constrains instances of DvQuantity.
+    """
+
+
+    magnitude = Object(
+        schema=IDvInterval,
+        title=_(u"Magnitude"),
+        description=_(u"Interval constraint on magnitude."),
+        required=False,
+        )
+
+    precision = Object(
+        schema=IDvInterval,
+        title=_(u"Precision"),
+        description=_(u"Interval constraint on precision."),
+        required=False,
+        )
+
+
+    units = TextLine(
+        title=_(u"Units"),
+        description=_(u"""Constraint on units."""),
+
+        )
+
+    def precisionUnconstrained():
+        """
+        True if no constraint on precision; True if precision = -1.
+        precision = -1 implies Result
+        """
+
+
+class ICDvQuantity(Interface):
+    """
+    Constrains instances of DvQuantity.
+    """
+
+    list_ = List(
+        title=_(u"List"),
+        description=_(u"""List of value/unit pairs."""),
+        required=False,
+        value_type=Object(schema=ICQuantityItem),
+        )
+
+    property_ = Object(
+        schema=ICodePhrase,
+        title=_(u"Property"),
+        description=_(u"""Optional constraint of units property_."""),
+        required=False
+        )
+
+    def anyAllowed():
+        """True if any DVQuantity instance allowed"""
+
+class CDvQuantity(CDomainType):
+    """
+    Constrains instances of DvQuantity.
+    """
+    grok.implements(ICDvQuantity)
+
+    def __init__(self,list_,property_):
+        self.list_=list_
+        self.property_=property_
+
+
+    def anyAllowed():
+        """True if any DVQuantity instance allowed."""
+        return self.list_ is None and self.property_ is None
+
+    def listValid():
+        return self.list_ is not None and self.list_.__len__() == 0
+
+    def overallValidity():
+        return xor(self.list_ is not None or self.property_ is not None, self.anyAllowed())
+
+
+class ICQuantityItem(Interface):
+    """
+    Constrains instances of DvQuantity.
+    """
+
+
+    magnitude = Object(
+        schema=IDvInterval,
+        title=_(u"Magnitude"),
+        description=_(u"Interval constraint on magnitude."),
+        required=False,
+        )
+
+    precision = Object(
+        schema=IDvInterval,
+        title=_(u"Precision"),
+        description=_(u"Interval constraint on precision."),
+        required=False,
+        )
+
+
+    units = TextLine(
+        title=_(u"Units"),
+        description=_(u"""Constraint on units."""),
+
+        )
+
+    def precisionUnconstrained():
+        """
+        True if no constraint on precision; True if precision = -1.
+        precision = -1 implies Result
+        """
+
+
+class CQuantityItem(grok.Model):
+    """
+    Constrains instances of DvQuantity.
+    """
+    grok.implements(ICQuantityItem)
+
+    def __init__(self,magnitude,precision,units):
+        self.magnitude=magnitude
+        self.precision=precision
+        self.units=units
+
+
+    def precisionUnconstrained():
+        """
+        True if no constraint on precision; True if precision = -1.
+        precision = -1 implies Result
+        """
+        return precision == -1
+
+#Begin Text Datatypes package
+class ICCodePhrase(Interface):
+    u"""
+    Express constraints on instances of CODE_PHRASE. The terminology_id attribute
+    may be specified on its own to indicate any term from a specified terminology;
+    the code_list attribute may be used to limit the codes to a specific list.
+    """
+
+    terminologyId = Object(
+        schema=ITerminologyId,
+        title=_(u"Terminology ID"),
+        description=_(u"""Syntax string expressing constraint on allowed primary terms."""),
+        required=False,
+        )
+
+    codeList = List(
+        title=_(u"Code List"),
+        description=_(u"""List of allowed codes.  If empty it means any code is allowed."""),
+        required=False,
+        value_type=TextLine(),
+    )
+
+
+class CCodePhrase(CDomainType):
+    u"""
+    Express constraints on instances of CODE_PHRASE. The terminology_id attribute
+    may be specified on its own to indicate any term from a specified terminology;
+    the code_list attribute may be used to limit the codes to a specific list.
+    """
+
+    grok.implements(ICCodePhrase)
+
+
+    def __init__(self,termid,codelist):
+        self.terminologyId=termid
+        self.codeList=codelist
+

=== added file 'src/oship/mlhim/openehrprofile.pyc'
Binary files src/oship/mlhim/openehrprofile.pyc	1970-01-01 00:00:00 +0000 and src/oship/mlhim/openehrprofile.pyc	2010-08-06 02:59:44 +0000 differ
=== added directory 'src/oship/mlhim/py_files'
=== added directory 'src/oship/mlhim/rm'
=== added file 'src/oship/mlhim/rm/__init__.py'
--- src/oship/mlhim/rm/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,1 @@
+# This is a package
\ No newline at end of file

=== added directory 'src/oship/mlhim/rm/common'
=== added file 'src/oship/mlhim/rm/common/__init__.py'
--- src/oship/mlhim/rm/common/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,1 @@
+# This file just exists to make it's directory as a module.

=== added directory 'src/oship/mlhim/rm/common/archetyped'
=== added file 'src/oship/mlhim/rm/common/archetyped/__init__.py'
--- src/oship/mlhim/rm/common/archetyped/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/archetyped/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,245 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import grok
+from interfaces import *
+
+
+class Pathable(grok.Model):
+    """
+    Abstract parent of all classes whose instances are reachable by paths, and
+    which know how to locate child object by paths. The parent feature may be
+    implemented as a function or attribute.
+
+    The two attributes required for locatable in Grok is __parent__ and
+    __name__. We inherit those from grok.Model.
+
+    The functionality to get paths and find children is contained in the
+    traversal mechanism. """
+
+    grok.implements(IPathable)
+
+
+
+    def pathOfItem(an_item):
+        """
+        The path to an item relative to the root of this archetyped structure.
+
+        getPath is from the Traversal API.
+        """
+
+    def itemAtPath(a_path):
+        """
+        The item at a path (relative to this item);only valid for unique paths,
+        i.e. paths that resolve to a single item. a_path is a string. Return
+        a_path is not None and pathUnique(a_path)
+
+        If the path is not unique or not found then a TraversalError is raised.
+        """
+
+    def itemsAtPath(a_path):
+        """
+        List of items corresponding to a non-unique path.
+        a_path is a List
+        Return a_path is not None and pathUnique(a_path)
+        """
+
+    def pathExists(a_path):
+        """
+        True if the path exists in the data with respect to the current item.
+        Return a_path is not None and a_path != ''
+        """
+
+    def pathUnique(a_path):
+        """
+        True if the path corresponds to a single item in the data.
+        Return a_path is not None and pathExists(a_path)
+        """
+
+
+class Locatable(Pathable):
+    """
+    Root class of all information model classes that can be archetyped.
+    """
+
+    grok.implements(ILocatable)
+
+    def __init__(self, uid, atnodeid, name, atdetails, fdraudit, links):
+        self.uid=uid
+        self.archetypeNodeId=atnodeid
+        self.name=name
+        self.archetypeDetails=atdetails
+        self.feederAudit=fdraudit
+        self.links=links
+
+    def isArchetypeRoot(self):
+        """True if this node is the root of an archetyped structure. At
+        specification there's a requiment for archetypeDetails in all root
+        points in data """
+        return self.archetypeDetails is not None
+
+    def concept():
+        """
+        Clinical concept of the archetype as a whole (= derived from the
+        'archetype_node_id' of the root node) isArchetypeRoot must be True.
+        """
+        if (self.isArchetypeRoot()):
+            return DvText(self.archetypeDetails.archetypeId.conceptName())
+        raise TypeError('Not root node')
+
+    def nameValid():
+        """ name is not None"""
+        return self.name is not None
+
+    def linksValid():
+        """ links is not None and links != []"""
+        if self.links is not None:
+            return self.links != []
+        return self.links is None
+
+    def archetypedValid():
+        """ isArchetypeRoot xor archetypeDetails = None """
+        return xor(self.isArchetypeRoot(), self.archetypeDetails is None)
+
+    def archetypeNodeIdValid():
+        """ archetypeNodeId is not None and archetypeNodeId != '' """
+        if(self.archetypeNodeId is not None):
+            return self.archetypeNodeId != ''
+        return self.archetypeNodeId is None
+
+    def __eq__(self, obj):
+        if self is obj:
+            return True
+        if isinstance(obj, Locatable):
+            return obj.uid == self.uid and obj.archetypeNodeId == self.archetypeNodeId and obj.name == self.name and obj.archetypeDetails == self.archetypeDetails and obj.feederAudit == self.feederAudit and obj.links == self.links
+        return False
+
+    def __hash__(self):
+        result = 17
+        result += 31 * result + hash(self.uid)
+        result += 31 * result + hash(self.archetypeNodeId)
+        result += 31 * result + hash(self.name)
+        result += 31 * result + hash(self.archetypeDetails)
+        result += 31 * result + hash(self.feederAudit)
+        result += 31 * result + hash(self.links)
+        return result
+
+
+class Archetyped(grok.Model):
+    """
+    Archetypes act as the configuration basis for the particular structures of
+    instances defined by the reference model. To enable archetypes to be used
+    to create valid data, key classes in the reference model act as "root"
+    points for archetyping; accordingly, these classes have the
+    archetype_details attribute set. An instance of the class ARCHETYPED
+    contains the relevant archetype identification information, allowing
+    generating archetypes to be matched up with data instances """
+
+    grok.implements(IArchetyped)
+
+    def __init__(self, atid, tmplid, rmver):
+        self.archetypeId=atid
+        self.templateId=tmplid
+        self.rmVersion=rmver
+
+    def archetypeIdValid():
+        """ archetypeId is not None """
+
+    def rmVersionValid():
+        """ rmVersion is not None and rmVersion != '' """
+
+    def __eq__(self, obj):
+        if obj is self:
+            return True
+        if isinstance(obj, Archetyped):
+            return obj.archetypeId == self.archetypeId and obj.templateId == self.templateId and obj.rmVersion == self.rmVersion 
+        return False
+
+    def __hash__(self):
+        result = 17
+        result = 31 * result + hash(self.archetypeId)
+        result = 31 * result + hash(self.templateId)
+        result = 31 * result + hash(self.rmVersion)
+        return result
+
+
+class FeederAuditDetails(grok.Model):
+    u"""
+    Audit details for any system in a feeder system chain. Audit details here
+    means the general notion of who/where/when the information item to which
+    the audit is attached was created. None of the attributes is defined as
+    mandatory, however, in different scenarios, various combinations of
+    attributes will usually be mandatory. This can be controlled by specifying
+    feeder audit details in legacy archetypes. """
+
+    grok.implements(IFeederAuditDetails)
+
+    def __init__(self, sysid, provider, location, time, subject, verid):
+
+
+        self.systemId=sysid
+        self.provider=provider
+        self.location=location
+        self.time=time
+        self.subject=subject
+        self.versionId=verid
+
+    def systemIdValid():
+        u"""systemId is not None and  systemId != '' """
+
+
+class FeederAudit(Locatable):
+    """
+    Audit and other meta-data for systems in the feeder chain.
+    """
+
+    grok.implements(IFeederAudit)
+
+    def __init__(self, orgsysaudit, orgsysids, fsaudit, fsauditids,
+                 orgcontent):
+
+
+        self.originatingSystemAudit=orgsysaudit
+        self.originatingSystemItemIds=orgsysids
+        self.feederSystemAudit=fsaudit
+        self.feederSystemItemIds=fsauditids
+        self.originalContent=orgcontent
+
+    def originatingSystemAuditValid():
+        """ originatingSystemAudit is not None """
+
+
+class Link(Locatable):
+    """
+    The LINK type defines a logical relationship between two items, such as two
+    ENTRYs or an ENTRY and a COMPOSITION. Links can be used across composi-
+    tions, and across EHRs. Links can potentially be used between interior
+    (i.e. non archetype root) nodes, although this probably should be prevented
+    in archetypes. Multiple LINKs can be attached to the root object of any
+    archetyped structure to give the effect of a 1->N link 1:1 and 1:N
+    relationships between archetyped content elements (e.g. ENTRYs) can be
+    expressed by using one, or more than one, respectively, DV_LINKs. Chains of
+    links can be used to see "problem threads" or other logical groupings of
+    items. Links should be between archetyped structures only, i.e. between
+    objects representing complete domain concepts because relationships between
+    sub-elements of whole concepts are not necessarily meaningful, and may be
+    downright confusing. Sensible links only exist between whole ENTRYs,
+    SECTIONs, COMPOSITIONs and so on. """
+
+    grok.implements(ILink)
+
+    def __init__(self, meaning, type_, target):
+
+        self.meaning=meaning
+        self.type_=type_
+        self.target=target
+
+    def meaningValid():
+        """Return meaning is not None """
+
+    def typeValid():
+        """Return type is not None """
+
+    def targetValid():
+        """Return target is not None """
+        

=== added file 'src/oship/mlhim/rm/common/archetyped/interfaces.py'
--- src/oship/mlhim/rm/common/archetyped/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/archetyped/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,436 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.interface import Interface
+from zope.schema import TextLine, Object, List, Set
+from zope.i18nmessageid import MessageFactory
+import grok
+
+from oship.mlhim.rm.support.interfaces import IArchetypeId, ITemplateId, IUidBasedId
+from oship.mlhim.rm.datatypes.basic import IDvIdentifier
+from oship.mlhim.rm.datatypes.text.interfaces import IDvText
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import IDvDateTime
+from oship.mlhim.rm.datatypes.encapsulated.interfaces import IDvEncapsulated
+from oship.mlhim.rm.datatypes.uri.interfaces import IDvEhrUri
+from oship.mlhim.rm.common.generic.interfaces import IPartyIdentified
+from oship.mlhim.rm.common.generic.interfaces import IPartyProxy
+
+_ = MessageFactory('oship')
+
+
+class ILink(Interface):
+    """
+    The LINK type defines a logical relationship between two items, such as two
+    ENTRYs or an ENTRY and a COMPOSITION. Links can be used across composi-
+    tions, and across EHRs. Links can potentially be used between interior
+    (i.e. non archetype root) nodes, although this probably should be prevented
+    in archetypes. Multiple LINKs can be attached to the root object of any
+    archetyped structure to give the effect of a 1->N link 1:1 and 1:N
+    relationships between archetyped content elements (e.g. ENTRYs) can be
+    expressed by using one, or more than one, respectively, DV_LINKs. Chains of
+    links can be used to see "problem threads" or other logical groupings of
+    items. Links should be between archetyped structures only, i.e. between
+    objects representing complete domain concepts because relationships between
+    sub-elements of whole concepts are not necessarily meaningful, and may be
+    downright confusing. Sensible links only exist between whole ENTRYs,
+    SECTIONs, COMPOSITIONs and so on. """
+
+    meaning = Object(
+        schema=IDvText,
+        title=_(u"Meaning"),
+        description=_(u"""Used to describe the relationship, usually in
+                      clinical terms, such as "in response to"
+                      (the relationship between test results and an order),
+                      "follow-up to" and so on. Such relationships can represent
+                      any clinically meaningful connection between pieces of
+                      information. Values for meaning include those described in
+                      Annex C, ENV 13606 pt 2 [11] under the categories of
+                      "generic", "documenting and
+                      reporting","organisational","clinical",
+                      "circumstancial", and "view management".  """),
+
+    )
+
+    type_ = Object(
+        schema=IDvText,
+        title=_(u"Type"),
+        description=_(u"""The type attribute is used to indicate a clinical or
+                      domain-level meaning for the kind of link, for example "problem" or
+                      "issue". If type values are designed appropriately, they can be used by
+                      the requestor of EHR extracts to categorise links which must be
+                      followed and which can be broken when the extract is created. """),
+
+    )
+
+    target = Object(
+        schema=IDvEhrUri,
+        title=_(u"Target"),
+        description=_(u"""The logical "to" object in the link relation,
+                      as target: per the linguistic sense of the meaning
+                      attribute."""),
+
+    )
+
+    def meaningValid():
+        """Return meaning is not None """
+
+    def typeValid():
+        """Return type is not None """
+
+    def targetValid():
+        """Return target is not None """
+
+
+
+class IFeederAuditDetails(Interface):
+    u"""
+    Audit details for any system in a feeder system chain. Audit details
+    here means the general notion of who/where/when the information item to
+    which the audit is attached was created. None of the attributes is defined
+    as mandatory, however, in different scenarios, various combinations of
+    attributes will usually be mandatory. This can be controlled by specifying
+    feeder audit details in legacy archetypes. """
+
+    systemId = TextLine(
+        title=_(u'System Id'),
+        description=_(u"""Identifier of the system which handled the
+                      information item."""),
+    )
+
+    provider = Object(
+        schema=IPartyIdentified,
+        title=_(u'Provider'),
+        description=_(u"""Optional provider(s) who created, committed,
+                      forwarded or otherwise handled the item. Type ==
+                      PARTY_IDENTIFIED"""),
+        required=False,
+    )
+
+    location = Object(
+        schema=IPartyIdentified,
+        title=_(u'Location'),
+        description=_(u"""Identifier of the particular site/facility within an
+                      organisation which handled the item. For computability, this identifier
+                      needs to be e.g. a PKI identifier which can be included in the
+                      identifier list of the PARTY_IDENTIFIED object."""),
+        required=False,
+    )
+
+    time = Object(
+        schema=IDvDateTime,
+        title=_(u'Time'),
+        description=_(u"""Time of handling the item. For an originating time:
+                      DV_DATE_TIME system, this will be time of creation, for an intermediate
+                      feeder system, this will be a time of accession or other time of
+                      handling, where available."""),
+        required=False,
+    )
+
+    subject = Object(
+        schema=IPartyProxy,
+        title=_(u'Subject'),
+        description=_(u"""Identifiers for subject of the received information
+                      item."""),
+        required=False,
+    )
+
+    versionId = TextLine(
+        title=_(u'Version Id'),
+        description=_(u"""Any identifier used in the system such as "interim",
+                      "final",
+                      or numeric versions if available."""),
+        required=False,
+    )
+
+    def systemIdValid():
+        u"""systemId is not None and  systemId != '' """
+
+
+class IFeederAudit(Interface):
+    """
+    Audit and other meta-data for systems in the feeder chain.
+    """
+
+    originatingSystemAudit = Object(
+        schema=IFeederAuditDetails,
+        title=_(u"Originating System Audit"),
+        description=_(u"""Any audit information for the information item from
+                      the originating system."""),
+
+    )
+
+    originatingSystemItemIds = List(
+        value_type=Object(schema=IDvIdentifier),
+        title=_(u"Originating System Item IDs"),
+        description=_(u"""Identifiers used for the item in the originating
+                      system, e.g. filler and placer ids."""),
+        required=False,
+    )
+
+
+    feederSystemAudit = Object(
+        schema=IFeederAuditDetails,
+        title=_(u"Feeder System Audit"),
+        description=_(u"""Any audit information for the information item from
+                      the feeder system, if different from the originating system."""),
+        required=False,
+    )
+
+    feederSystemItemIds = List(
+        value_type=Object(schema=IDvIdentifier),
+        title=_(u"Feeder System Item IDs"),
+        description=_(u"""Identifiers used for the item in the feeder system,
+                      where the feeder system is distinct from the originating system. The
+                      List contents are restricted to type == DvIdentifiers"""),
+        required=False,
+    )
+
+    originalContent=Object(
+        schema=IDvEncapsulated,
+        title=_(u"Original Content"),
+        description=_(u""" """),
+        required=False,
+    )
+
+    def originatingSystemAuditValid():
+        """ originatingSystemAudit is not None """
+
+
+class IArchetyped(Interface):
+    """
+    Archetypes act as the configuration basis for the particular structures of
+    instances defined by the reference model. To enable archetypes to be used
+    to create valid data, key classes in the reference model act as "root"
+    points for archetyping; accordingly, these classes have the
+    archetype_details attribute set. An instance of the class ARCHETYPED
+    contains the relevant archetype identification information, allowing
+    generating archetypes to be matched up with data instances """
+
+    archetypeId = Object(
+        schema=IArchetypeId,
+        title=_(u"Archetype ID"),
+        description=_(u"Globally unique archetype identifier."),
+    )
+
+    templateId = Object(
+        schema=ITemplateId,
+        title=_(u"Template ID"),
+        description=_(u"""Globally unique template identifier, if a template
+                      was active at this point in the structure. Normally, a template would
+                      only be used at the top of a top-level structure, but the possibility
+                      exists for templates at lower levels."""),
+        required=False,
+    )
+
+    rmVersion = TextLine(
+        title=_(u"RM Version"),
+        description=_(u"""Version of the openEHR reference model used to create
+                      this object. Expressed in terms of the release version string, e.g.
+                      "1.0", "1.2.4". """),
+    )
+
+    def archetypeIdValid():
+        """ archetypeId is not None """
+
+    def rmVersionValid():
+        """ rmVersion is not None and rmVersion != '' """
+
+
+class IPathable(Interface):
+    """
+    Abstract parent of all classes whose instances are reachable by paths, and
+    which know how to locate child object by paths. The parent feature may be
+    implemented as a function or attribute.
+
+    The two attributes required for locatable in Grok is __parent__ and
+    __name__. We inherit those from grok.Model.
+
+    The functionality to get paths and find children is contained in the
+    traversal mechanism. """
+
+    def pathOfItem(an_item):
+        """
+        The path to an item relative to the root of this archetyped structure.
+
+        getPath is from the Traversal API.
+        """
+
+    def itemAtPath(a_path):
+        """
+        The item at a path (relative to this item);only valid for unique paths,
+        i.e. paths that resolve to a single item. a_path is a string. Return
+        a_path is not None and pathUnique(a_path)
+
+        If the path is not unique or not found then a TraversalError is raised.
+        """
+
+    def itemsAtPath(a_path):
+        """
+        List of items corresponding to a non-unique path.
+        a_path is a List
+        Return a_path is not None and pathUnique(a_path)
+        """
+
+    def pathExists(a_path):
+        """
+        True if the path exists in the data with respect to the current item.
+        Return a_path is not None and a_path != ''
+        """
+
+    def pathUnique(a_path):
+        """
+        True if the path corresponds to a single item in the data.
+        Return a_path is not None and pathExists(a_path)
+        """
+
+
+class ILocatable(Interface):
+    u"""
+    Root class of all information model classes that can be archetyped.
+    """
+
+
+    uid = Object(
+        schema=IUidBasedId,
+        title=_(u"UID"),
+        description=_(u"Optional globally unique object identifier for root"
+                      " points of archetyped structures. A UidBasedId "),
+        required=False,
+    )
+
+
+    archetypeNodeId = TextLine(
+        title=_(u"Node ID"),
+        description=_(u"""Design-time archetype id of this node taken from its
+                      generating archetype; used to build archetype paths. Always in the form
+                      of an "at" code, e.g. "at0005". This value enables a "standardised"
+                      name for this node to be generated, by referring to the generating
+                      archetype local ontology. At an archetype root point, the value of this
+                      attribute is always the stringified form of the archetype_id found in
+                      the archetype_details object."""),
+        required=True)
+
+    name = Object(
+        schema=IDvText,
+        title=_(u"Name"),
+        description=_(u"""DvText type - Runtime name of this fragment, used to
+                      build runtime paths. This is the term provided via a clinical
+                      application or batch process to name this EHR construct: its retention
+                      in the EHR faithfully preserves the original label by which this entry
+                      was known to end. """),
+
+    )
+
+
+    archetypeDetails = Object(
+        schema=IArchetyped,
+        title=_(u"Archetype Details"),
+        description=_(u"Details of archetyping used on this node."),
+        required=False,
+    )
+
+    feederAudit = Object(
+        schema=IFeederAudit,
+        title=_(u"Feeder Audit"),
+        description=_(u"""Audit trail from non-openEHR system of original
+                      commit of information forming the content of this node, or
+                      from a conversion gateway which has synthesised this node."""),
+        required=False,
+    )
+
+
+    links = Set(
+        value_type=Object(schema=ILink),
+        title=_(u"Links"),
+        description=_(u"""Audit trail from non-openEHR system of original
+                      commit of information forming the content of this node,
+                      or from a conversion gateway which has synthesised this
+                      node."""),
+        required=False,
+    )
+
+    def isArchetypeRoot():
+        u"""True if this node is the root of an archetyped structure."""
+
+    def concept():
+        u"""
+        Clinical concept of the archetype as a whole (= derived from the
+        'archetype_node_id' of the root node) isArchetypeRoot must be True.
+        """
+
+    def nameValid():
+        u""" name is not None"""
+
+    def linksValid():
+        u""" links is not None and links != []"""
+
+    def archetypedValid():
+        u""" isArchetypeRoot xor archetypeDetails = None """
+
+    def archetypeNodeIdValid():
+        u""" archetypeNodeId is not None and archetypeNodeId != '' """
+
+
+class IFeederAuditDetails(Interface):
+    u"""
+    Audit details for any system in a feeder system chain. Audit details here
+    means the general notion of who/where/when the information item to which
+    the audit is attached was created. None of the attributes is defined as
+    mandatory, however, in different scenarios, various combinations of
+    attributes will usually be mandatory. This can be controlled by specifying
+    feeder audit details in legacy archetypes. """
+
+    systemId = TextLine(
+        title=_(u'System Id'),
+        description=_(u"""Identifier of the system which handled the
+                      information item."""),
+    )
+
+    provider = Object(
+        schema=IPartyIdentified,
+        title=_(u'Provider'),
+        description=_(u"""Optional provider(s) who created, committed,
+                      forwarded or otherwise handled the item. Type ==
+                      PARTY_IDENTIFIED"""),
+        required=False,
+    )
+
+    location = Object(
+        schema=IPartyIdentified,
+        title=_(u'Location'),
+        description=_(u"""Identifier of the particular site/facility within an
+                      organisation which handled the item. For computability, this identifier
+                      needs to be e.g. a PKI identifier which can be included in the
+                      identifier list of the PARTY_IDENTIFIED object."""),
+        required=False,
+    )
+
+    time = Object(
+        schema=IDvDateTime,
+        title=_(u'Time'),
+        description=_(u"""Time of handling the item. For an originating time:
+                      DV_DATE_TIME system, this will be time of creation, for an intermediate
+                      feeder system, this will be a time of accession or other time of
+                      handling, where available."""),
+        required=False,
+    )
+
+    subject = Object(
+        schema=IPartyProxy,
+        title=_(u'Subject'),
+        description=_(u"""Identifiers for subject of the received information
+                      item."""),
+        required=False,
+    )
+
+    versionId = TextLine(
+        title=_(u'Version Id'),
+        description=_(u"""Any identifier used in the system such as "interim",
+                      "final",
+                      or numeric versions if available."""),
+        required=False,
+    )
+
+    def systemIdValid():
+        u"""systemId is not None and  systemId != '' """
+

=== added directory 'src/oship/mlhim/rm/common/archetyped/tests'
=== added file 'src/oship/mlhim/rm/common/archetyped/tests/__init__.py'
=== added directory 'src/oship/mlhim/rm/common/change_control'
=== added file 'src/oship/mlhim/rm/common/change_control/__init__.py'
--- src/oship/mlhim/rm/common/change_control/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/change_control/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,214 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import grok
+
+from oship.mlhim.rm.support.identification import HierObjectId
+from interfaces import *
+
+class Contribution(grok.Container):
+    u"""
+    Documents a contribution of one or more versions added to a
+    change-controlled repository. """
+
+    grok.implements(IContribution)
+
+    def __init__(self, uid, versions, audit):
+        self.uid=uid
+        self.versions=versions
+        self.audit=audit
+
+
+
+class Version(grok.Model):
+    u"""
+    Abstract model of one Version within a Version container, containing
+    data, commit audit trail, and the identifier of its Contribution.
+    """
+
+    grok.implements(IVersion)
+
+    def __init__(self, uid, preVid, data, lcstate, caudit, contr, sig):
+        self.uid=uid
+        self.precedingVersionId=preVid
+        self.data=data
+        self.lifecycleState=lcstate
+        self.commitAudit=caudit
+        self.signature=sig
+
+    def ownerId(self):
+        return HierObjectId(self.uid.objectId().value)
+
+    def isBranch(self):
+        return self.uid.versionTreeId().isBranch()
+
+    def canonicalForm(self):
+        raise NotImplementedError
+
+
+
+class OriginalVersion(Version):
+    u"""
+    A Version containing locally created content and optional attestations.
+    """
+
+    grok.implements(IOriginalVersion)
+
+    def __init__(self, uid, previd,otherInputVersionUids,data,attestations,lifecycleState,caudit,contribution,sig):
+        Version.__init__(self,uid,previd,data,lifecycleState,caudit,contribution,sig)
+        self.otherInputVersionUids=otherInputVersionUids
+        self.attestations=attestations
+
+    def isMerged(self):
+        """
+        True if this Version was created from more than
+        just the preceding (checked out) version.
+        """
+
+
+
+class ImportedVersion(Version):
+    u"""
+    A Version containing locally created content and optional attestations.
+    """
+    grok.implements(IImportedVersion)
+
+    def __init__(self, item):
+        self.item = item
+
+
+
+class VersionedObject(grok.Container):
+    u"""
+    Version control abstraction, defining semantics for versioning one
+    complex object.
+    """
+
+    grok.implements(IVersionedObject)
+
+    def __init__(self, uid, ownerId, timeCreated):
+        super(VersionedObject, self).__init__()
+        self.uid=uid
+        self.ownerId=ownerId
+        self.timeCreated=timeCreated
+
+    def allVersions():
+        u"""Return a list of all versionsin this object. List <VERSION<T>>"""
+
+    def allVersionIds():
+        u"""Return a list of ids of all versions in this object.
+        List <OBJECT_VERSION_ID>"""
+
+    def versionCount(self):
+        return len(self)
+
+    def hasVersionId(an_id):
+        u"""Return True if an_id exists. Require an_id is not None
+        and an_id != '' """
+
+    def isOriginalVersion(an_id):
+        u"""True if version with an_id is an ORIGINAL_VERSION.
+        Require an_id is not None and hasVersionId(an_id)"""
+
+    def hasVersionAtTime(a_time):
+        u"""Return True if a version for time; 'a_time' exists.
+        Require isinstance(a_time, datetime)."""
+
+    def versionWithId(an_id):
+        u"""Return the version with id of 'an_id'.
+        Require hasVersionId(an_id)"""
+
+    def versionAtTime(a_time):
+        u"""Return the version for time 'a_time'.
+        Require hasVersionAtTime(a_time)."""
+
+    def latestVersion():
+        u"""Return the most recently added version (i.e. on trunk
+        or any branch)."""
+
+    def latestTrunkVersion():
+        u"""Return the most recently added trunk version."""
+
+    def trunkLifecycleState():
+        u"""Return the lifecycle state from the latest trunk version.
+        Useful for determining if the version container is logically deleted.
+        """
+
+    def revisionHistory():
+        u"""History of all audits and attestations in this versioned
+        repository."""
+
+    def commitOriginalVersion(self,newVersionUid,precedingVersionUid,data,lifecycleState,commitAudit,contribution,signingKey):
+        v = OriginalVersion(newVersionUid,precedingVersionUid,None,data,None,lifecycleState,commitAudit,contribution,signingKey)
+        self[newVersionUid.value] = v
+
+    def commitOriginalMergedVersion():
+        u"""Add a new original merged version. This commit function adds a
+        parameter containing the ids of other versions merged into the
+        current one.
+
+        (a_contribution: OBJECT_REF;a_new_version_uid, a_preceding_version_uid:
+        OBJECT_VERSION_ID; an_audit: AUDIT_DETAILS; a_lifecycle_state:
+        DV_CODED_TEXT; a_data: T; an_other_input_uids:Set<OBJECT_VERSION_ID>;
+        signing_key: String)
+
+        Require
+        Contribution_valid: a_contribution /= Void
+        New_version_valid: a_new_version_uid /= Void
+        Preceding_version_id_valid:
+        all_version_ids.has(a_preceding_version_uid)
+        or else version_count = 0
+        audit_valid: an_audit /= Void
+        data_valid: a_version_data /= Void
+        lifecycle_state_valid: a_lifecycle_state /= Void
+        Merge_input_ids_valid: an_other_input_uids /= Void
+        """
+
+    def commitImportedVersion(a_contribution, an_audit, a_version):
+        u"""Add a new imported version. Details of version id etc come from the
+        ORIGINAL_VERSION being committed.
+
+        (a_contribution: OBJECT_REF; an_audit: AUDIT_DETAILS;
+        a_version: ORIGINAL_VERSION<T>)
+
+        Require
+        Contribution_valid: a_contribution /= Void
+        audit_valid: an_audit /= Void
+        Version_valid: a_version /= Void
+        """
+
+    def commitAttestation(an_attestation, a_ver_id, signing_key):
+        u"""Add a new attestation to a specified original version. Attestations
+        can only be added to Original versions.
+
+        an_attestation: ATTESTATION; a_ver_id: OBJECT_VERSION_ID; signing_key:
+        String)
+
+        Require
+        Attestation_valid: an_attestation /= Void
+        Version_id_valid: has_version_id(a_ver_id) and
+        is_original_version(a_ver_id) """
+
+    def uidValid():
+        u"""uid is not None"""
+
+    def ownerIdValid():
+        u"""owner_id is not None"""
+
+    def timeCreatedValid():
+        u"""timeCreated is not None"""
+
+    def versionCountValid():
+        u"""versionCount >= 0"""
+
+    def allVersionIdsValid():
+        u"""allVersionIds is not None and allVersionIds.count = versionCount"""
+
+    def allVersionsValid():
+        u"""allVersions is not None and allVersions.count = versionCount"""
+
+    def latestVersionValid():
+        u"""versionCount > 0 implies latestVersion is not None"""
+
+    def revisionHistoryValid():
+        u"""revisionHistory is not None"""

=== added file 'src/oship/mlhim/rm/common/change_control/interfaces.py'
--- src/oship/mlhim/rm/common/change_control/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/change_control/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,341 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.interface import Interface
+from zope.schema import TextLine, Object, Field, List, Set
+from zope.i18nmessageid import MessageFactory
+import grok
+
+from oship.mlhim.rm.support.interfaces import (IUidBasedId,
+                        IObjectRef, IObjectVersionId)
+from oship.mlhim.rm.datatypes.text.interfaces import IDvCodedText
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import IDvDateTime
+from oship.mlhim.rm.common.generic.interfaces import IAuditDetails, IAttestation
+
+
+_ = MessageFactory('oship')
+
+class IContribution(Interface):
+    u"""
+    Documents a contribution of one or more versions added to a
+    change-controlled repository. """
+
+    uid=Object(
+        schema=IUidBasedId,
+        title=_(u'UID'),
+        description=_(u"""Unique identifier for this contribution."""),
+        required=True)
+
+    versions=Set(
+        value_type=Object(schema=IObjectRef),
+        title=_(u'Versions'),
+        description=_(u"""Set of references to versions causing changes to
+                      this EHR. Each contribution contains a list of versions
+                      which may include paths pointing to any number of
+                      VERSIONABLE items, i.e. items of type COMPOSITION and
+                      FOLDER."""),
+        required=True)
+
+    audit=Object(
+        schema=IAuditDetails,
+        title=_(u'Audit'),
+        description=_(u"""Audit trail corresponding to the committal of this
+                      Contribution."""),
+        required=True)
+
+
+
+
+class IVersion(Interface):
+    u"""
+    Abstract model of one Version within a Version container, containing
+    data, commit audit trail, and the identifier of its Contribution.
+    """
+
+    uid = Object(
+        schema=IObjectVersionId,
+        title=_(u'UID'),
+        description=_(u"""Unique identifier of this version, containing
+                      owner_id, version_tree_id and creating_system_id.
+                      Type == OBJECT_VERSION_ID"""),
+    )
+
+    precedingVersionUid = Object(
+        schema=IObjectVersionId,
+        title=_(u'Preceding Version Uid'),
+        description=_(u"""Unique identifier of the version of which this
+                      version is a modification; Void if this is the first version.
+                      Type == OBJECT_VERSION_ID"""),
+        required=False,
+    )
+
+    data = Field(
+        title=_(u'Data'),
+        description=_(u"""Original content of this Version. Any Type."""),
+        required=False,
+    )
+
+    lifecycleState = Object(
+        schema=IDvCodedText,
+        title=_(u'Lifecycle State'),
+        description=_(u"""Lifecycle state of this version; coded by openEHR
+                      vocabulary "version lifecycle state".
+                      Type == DV_CODED_TEXT"""),
+
+    )
+
+
+    commitAudit = Object(
+        schema=IAuditDetails,
+        title=_(u'Commit Audit'),
+        description=_(u"""Audit trail corresponding to the committal of this
+                      version to the VERSIONED_OBJECT. Type == AUDIT_DETAILS"""),
+
+    )
+
+    contribution = Object(
+        schema=IObjectRef,
+        title=_(u'Contribution'),
+        description=_(u"""Contribution in which this version was added."""),
+
+    )
+
+    signature = TextLine(
+        title=_(u'Signature'),
+        description=_(u"""OpenPGP digital signature or digest of content
+                      committed in this Version."""),
+        required=False,
+    )
+
+    def ownerId():
+        u"""Unique identifier of the owning VERSIONED_OBJECT.
+        Type == HIER_OBJECT_ID"""
+
+    def isBranch():
+        u"""True if this Version represents a branch.
+        Derived from uid attribute."""
+
+    def canonicalForm():
+        u"""Canonical form of Version object, created by serialising all
+        attributes except signature."""
+
+
+
+class IOriginalVersion(Interface):
+    u"""
+    A Version containing locally created content and optional attestations.
+    """
+
+    uid=Object(
+        schema=IObjectVersionId,
+        title=_(u"UID"),
+        description=_(u"""Stored version of inheritence precursor."""),
+        required=True)
+
+    precedingVersionUid=Object(
+        schema=IObjectVersionId,
+        title=_(u"Preceding Version UID"),
+        description=_(u"""Stored version of inheritence precursor."""),
+        required=True)
+
+    otherInputVersionUids=Set(
+            value_type=Object(schema=IObjectVersionId),
+            title=_(u"Other Input Version Uids"),
+            description=_(u"""Identifiers of other versions whose content was merged into this version, if any."""),
+            required=False,
+            )
+
+    attestations=List(
+            value_type=Object(schema=IAttestation),
+            title=_(u"Attestations"),
+            description=_(u"""Set of attestations relating to this version."""),
+            required=False,
+            )
+
+    def isMerged():
+        """
+        True if this Version was created from more than
+        just the preceding (checked out) version.
+        """
+
+
+
+class IImportedVersion(Interface):
+    u"""
+    A Version containing locally created content and optional attestations.
+    """
+
+    item=Object(
+        schema=IOriginalVersion,
+        title=_(u"Item"),
+        description=_(u"""Original Version object that was imported."""),
+        required=True)
+
+
+
+class IVersionedObject(Interface):
+    u"""
+    Version control abstraction, defining semantics for versioning one
+    complex object.
+    """
+
+    uid = Object(
+        schema=IUidBasedId,
+        title=_(u'UID'),
+        description=_(u"""Unique identifier of this version container. This id
+                      will be the same in all instances of the same container
+                      in a distributed environment, meaning that it can be
+                      understood as the uid of the "virtual version tree"."""),
+
+    )
+
+    ownerId = Object(
+        schema=IObjectRef,
+        title=_(u'Owner Id'),
+        description=_(u"""Reference to object to which this version container
+                      belongs, e.g. the id of the containing EHR or other
+                      relevant owning entity."""),
+
+    )
+
+    timeCreated = Object(
+        schema=IDvDateTime,
+        title=_(u'Time Created'),
+        description=_(u"""Time of initial creation of this versioned
+                      object."""),
+    )
+
+    def allVersions():
+        u"""Return a list of all versionsin this object. List <VERSION<T>>"""
+
+    def allVersionIds():
+        u"""Return a list of ids of all versions in this object.
+        List <OBJECT_VERSION_ID>"""
+
+    def versionCount():
+        u"Return the total number of versions in this object as an Integer."
+
+    def hasVersionId(an_id):
+        u"""Return True if an_id exists. Require an_id is not None
+        and an_id != '' """
+
+    def isOriginalVersion(an_id):
+        u"""True if version with an_id is an ORIGINAL_VERSION.
+        Require an_id is not None and hasVersionId(an_id)"""
+
+    def hasVersionAtTime(a_time):
+        u"""Return True if a version for time; 'a_time' exists.
+        Require isinstance(a_time, datetime)."""
+
+    def versionWithId(an_id):
+        u"""Return the version with id of 'an_id'.
+        Require hasVersionId(an_id)"""
+
+    def versionAtTime(a_time):
+        u"""Return the version for time 'a_time'.
+        Require hasVersionAtTime(a_time)."""
+
+    def latestVersion():
+        u"""Return the most recently added version (i.e. on trunk
+        or any branch)."""
+
+    def latestTrunkVersion():
+        u"""Return the most recently added trunk version."""
+
+    def trunkLifecycleState():
+        u"""Return the lifecycle state from the latest trunk version.
+        Useful for determining if the version container is logically deleted.
+        """
+
+    def revisionHistory():
+        u"""History of all audits and attestations in this versioned
+        repository."""
+
+    def commitOriginalVersion():
+        u"""
+        Add a new original version.
+        (a_contribution: OBJECT_REF; a_new_version_uid,
+        a_preceding_version_uid: OBJECT_VERSION_ID; an_audit: AUDIT_DETAILS;
+        a_lifecycle_state: DV_CODED_TEXT; a_data: T; signing_key: String)
+
+        Require
+        contributionValid: a_contribution /= Void
+        newVersionValid: a_new_version_uid /= Void
+        precedingVersionUidValid:all_version_ids.has(a_preceding_version_uid)
+        or else version_count = 0
+        audit_valid: an_audit /= Void
+        data_valid: a_version_data /= Void
+        lifecycle_state_valid: a_lifecycle_state /= Void
+        """
+
+    def commitOriginalMergedVersion():
+        u"""Add a new original merged version. This commit function adds a
+        parameter containing the ids of other versions merged into the
+        current one.
+
+        (a_contribution: OBJECT_REF;a_new_version_uid, a_preceding_version_uid:
+        OBJECT_VERSION_ID; an_audit: AUDIT_DETAILS; a_lifecycle_state:
+        DV_CODED_TEXT; a_data: T; an_other_input_uids:Set<OBJECT_VERSION_ID>;
+        signing_key: String)
+
+        Require
+        Contribution_valid: a_contribution /= Void
+        New_version_valid: a_new_version_uid /= Void
+        Preceding_version_id_valid:
+        all_version_ids.has(a_preceding_version_uid)
+        or else version_count = 0
+        audit_valid: an_audit /= Void
+        data_valid: a_version_data /= Void
+        lifecycle_state_valid: a_lifecycle_state /= Void
+        Merge_input_ids_valid: an_other_input_uids /= Void
+        """
+
+    def commitImportedVersion(a_contribution, an_audit, a_version):
+        u"""Add a new imported version. Details of version id etc come from the
+        ORIGINAL_VERSION being committed.
+
+        (a_contribution: OBJECT_REF; an_audit: AUDIT_DETAILS;
+        a_version: ORIGINAL_VERSION<T>)
+
+        Require
+        Contribution_valid: a_contribution /= Void
+        audit_valid: an_audit /= Void
+        Version_valid: a_version /= Void
+        """
+
+    def commitAttestation(an_attestation, a_ver_id, signing_key):
+        u"""Add a new attestation to a specified original version. Attestations
+        can only be added to Original versions.
+
+        an_attestation: ATTESTATION; a_ver_id: OBJECT_VERSION_ID; signing_key:
+        String)
+
+        Require
+        Attestation_valid: an_attestation /= Void
+        Version_id_valid: has_version_id(a_ver_id) and
+        is_original_version(a_ver_id) """
+
+    def uidValid():
+        u"""uid is not None"""
+
+    def ownerIdValid():
+        u"""owner_id is not None"""
+
+    def timeCreatedValid():
+        u"""timeCreated is not None"""
+
+    def versionCountValid():
+        u"""versionCount >= 0"""
+
+    def allVersionIdsValid():
+        u"""allVersionIds is not None and allVersionIds.count = versionCount"""
+
+    def allVersionsValid():
+        u"""allVersions is not None and allVersions.count = versionCount"""
+
+    def latestVersionValid():
+        u"""versionCount > 0 implies latestVersion is not None"""
+
+    def revisionHistoryValid():
+        u"""revisionHistory is not None"""
+

=== added directory 'src/oship/mlhim/rm/common/change_control/tests'
=== added file 'src/oship/mlhim/rm/common/change_control/tests/__init__.py'
=== added file 'src/oship/mlhim/rm/common/change_control/tests/version.txt'
--- src/oship/mlhim/rm/common/change_control/tests/version.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/change_control/tests/version.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,19 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.common.change_control import Version,OriginalVersion
+>>> from oship.mlhim.rm.common.change_control.interfaces import IVersion,IOriginalVersion
+>>> from oship.mlhim.rm.support.identification import ObjectVersionId,TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import DvCodedText,CodePhrase
+>>> uid = ObjectVersionId("87284370-2D4B-4e3d-A3F3-F303D2F4F34B::2::1")
+>>> data = u"Some data"
+>>> openEhrTerminologyId = TerminologyId(u"openehr")
+>>> versionCodePhrase = CodePhrase(openEhrTerminologyId,u"version lifecycle state")
+>>> lifecycleState = DvCodedText(versionCodePhrase,u"complete",None,None,None,None,None)
+>>> caudit=None
+>>> contribution=None
+>>> version = OriginalVersion(uid,None,None,data,None,lifecycleState,caudit,contribution,None)
+>>> version.ownerId().value
+u'87284370-2D4B-4e3d-A3F3-F303D2F4F34B'
+>>> version.isBranch()
+False
+>>> 

=== added file 'src/oship/mlhim/rm/common/change_control/tests/versionedobject.txt'
--- src/oship/mlhim/rm/common/change_control/tests/versionedobject.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/change_control/tests/versionedobject.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,20 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.common.change_control import Version,OriginalVersion, VersionedObject
+>>> from oship.mlhim.rm.common.change_control.interfaces import IVersion,IOriginalVersion
+>>> from oship.mlhim.rm.support.identification import ObjectVersionId,TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import DvCodedText,CodePhrase
+>>> uid = ObjectVersionId("87284370-2D4B-4e3d-A3F3-F303D2F4F34B::2::1")
+>>> data = u"Some data"
+>>> openEhrTerminologyId = TerminologyId(u"openehr")
+>>> versionCodePhrase = CodePhrase(openEhrTerminologyId,u"version lifecycle state")
+>>> lifecycleState = DvCodedText(versionCodePhrase,u"complete",None,None,None,None,None)
+>>> caudit=None
+>>> contribution=None
+>>> versionedObject = VersionedObject(None,None,None)
+>>> versionedObject.versionCount()
+0
+>>> versionedObject.commitOriginalVersion(uid,None,data,lifecycleState,caudit,contribution,None)
+>>> versionedObject.versionCount()
+1
+>>> 

=== added directory 'src/oship/mlhim/rm/common/directory'
=== added file 'src/oship/mlhim/rm/common/directory/__init__.py'
--- src/oship/mlhim/rm/common/directory/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/directory/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import grok
+from oship.mlhim.rm.common.archetyped import Locatable
+from oship.mlhim.rm.common.change_control import VersionedObject
+from interfaces import *
+
+
+class Folder(Locatable):
+    u"""
+    The concept of a named folder.
+    """
+
+    grok.implements(IFolder)
+
+    def __init__(self, folders, items):
+
+        self.folders=folders
+        self.items=items
+
+    def foldersValid():
+        u"""folders is not None and folders != '' """
+
+
+class VersionedFolder(VersionedObject):
+    u"""
+    A version-controlled hierarchy of FOLDERs giving the effect of a directory.
+    """
+
+    grok.implements(IVersionedFolder)
+
+    def __init__(self, ownerId, timeCreated, uid):
+        VersionedObject.__init__(ownerId, timeCreated, uid)

=== added file 'src/oship/mlhim/rm/common/directory/interfaces.py'
--- src/oship/mlhim/rm/common/directory/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/directory/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.interface import Interface
+from zope.schema import Object, List
+from zope.i18nmessageid import MessageFactory
+from oship.mlhim.rm.support.interfaces import IObjectRef
+
+
+_ = MessageFactory('oship')
+
+
+
+class IVersionedFolder(Interface):
+    u"""
+    A version-controlled hierarchy of FOLDERs giving the effect of a directory.
+    """
+    pass
+
+
+class IFolder(Interface):
+    u"""
+    The concept of a named folder.
+    """
+
+    folders = List(
+        value_type=Object(schema=IObjectRef), # documented as a list of folders
+        title=_(u"Folders"),
+        description=_(u"""Subfolders of this folder."""),
+        required=False,
+    )
+
+    items = List(
+        value_type=Object(schema=IObjectRef),
+        title=_(u"Items"),
+        description=_(u"""The list of references to other (usually) versioned
+                      objects logically in this folder."""),
+        required=False,
+    )
+
+    def foldersValid():
+        u"""folders is not None and folders != '' """

=== added directory 'src/oship/mlhim/rm/common/directory/tests'
=== added file 'src/oship/mlhim/rm/common/directory/tests/__init__.py'
=== added directory 'src/oship/mlhim/rm/common/generic'
=== added file 'src/oship/mlhim/rm/common/generic/__init__.py'
--- src/oship/mlhim/rm/common/generic/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/generic/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.interface import Interface
+import grok
+from interfaces import *
+
+class Participation(grok.Model):
+
+    grok.implements(IParticipation)
+
+    def __init__(self, performer, function, mode, time):
+        self.performer=performer
+        self.function=function
+        self.mode=mode
+        self.time=time
+
+
+class AuditDetails(grok.Model):
+    u"""
+    The set of attributes required to document the committal of an information
+    item to a repository.
+    """
+
+    grok.implements(IAuditDetails)
+
+    def __init___(self, systemId, committer, timeCommited, changeType,
+                  description):
+
+        self.systemId=systemId
+        self.committer=committer
+        self.timeCommitted=timeCommited
+        self.changeType=changeType
+        self.description=description
+
+
+class Attestation(AuditDetails):
+    u"""
+    Record an attestation of a party (the committer) to item(s) of record
+    content. The type of attestation is """
+
+    grok.implements(IAttestation)
+
+    def __init__(self, aview, proof, items, reason, ispend):
+
+        self.attestedView=aview
+        self.proof=proof
+        self.items=items
+        self.reason=reason
+        self.isPending=ispend
+
+    def itemsValid():
+        u"""items is not None items != '' """
+
+    def reasonValid():
+        u"""reason is not None and
+        then(reason.generating_type.is_equal("DV_CODED_TEXT") implies
+        terminology(Terminology_id_openehr).has_code_for_group_id
+        (Group_id_attestation_reason, reason.defining_code))"""
+
+
+class PartyProxy(grok.Model):
+    u"""
+    Abstract concept of a proxy description of a party, including an optional
+    link to data for this party in a demographic or other identity management
+    system. Subtyped into PARTY_IDENTIFIED and PARTY_SELF.
+    """
+
+    grok.implements(IPartyProxy)
+
+    def __init__(self, extref):
+        self.externalRef=extref
+
+
+class PartyIdentified(PartyProxy):
+    """
+    An identity owned by a party.
+    """
+
+    grok.implements(IPartyIdentified)
+
+    def __init__(self, name, identifiers, extref):
+        PartyProxy.__init__(self,extref)
+        self.name=name
+        self.identifiers=identifiers
+
+    def asString():
+        """
+        Indentity in the form of a string.
+        """
+
+
+class PartyRelated(PartyIdentified):
+    u"""
+    Proxy type for identifying a party and its relationship to the subject of
+    the record.
+
+    Use where the relationship between the party and the subject of the record
+    must be known.
+    """
+
+    grok.implements(IPartyRelated)
+
+    def __init__(self, relationship, name, identifiers, extref):
+        PartyIdentified.__init__(self, name, identifiers, extref)
+        self.relationship=relationship
+
+    def relationshipValid():
+        u"""relationship is not None and relationship in the relationship
+        vocabulary."""
+
+
+class PartySelf(PartyProxy):
+
+    grok.implements(IPartySelf)
+
+    def __init__(self,extref):
+        PartyProxy.__init__(self,extref)
+
+
+class RevisionHistoryItem(grok.Model):
+    u"""
+    An entry in a revision history, corresponding to a version from a versioned
+    container. Consists of AUDIT_DETAILS instances with revision identifier of
+    the revision to which the AUDIT_DETAILS intance belongs.
+    """
+
+    grok.implements(IRevisionHistoryItem)
+
+    def __init__(self, audits, verid):
+        self.audits=audits
+        self.versionId=verid
+
+    def auditValid():
+        u"""audits is not None and audits != ' """
+
+    def versionIdValid():
+        u"""versionId is not None"""
+
+
+class RevisionHistory(grok.Model):
+    u"""
+    Defines the notion of a revision history of audit items, each associated
+    with the version for which that audit was committed. The list is in
+    most-recent-first order.
+    """
+
+    grok.implements(IRevisionHistory)
+
+    def __init__(self, items):
+        self.items=items
+
+    def mostRecentVersion():
+        u"""The version id of the most recent item, as a String.
+        Ensure Result.is_equal(items.last.version_id.value)"""
+
+    def mostRecentVersionTimeCommitted():
+        u"""The commit date/time of the most recent item, as a string.
+        Ensure Result.is_equal(items.last.audits.first.time_committed.value)"""
+
+    def itemsValid():
+        u"""items is not None """

=== added file 'src/oship/mlhim/rm/common/generic/interfaces.py'
--- src/oship/mlhim/rm/common/generic/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/generic/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,341 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+
+from zope.interface import Interface
+from zope.schema import TextLine, Object, List, Set, Bool
+from zope.i18nmessageid import MessageFactory
+import grok
+from oship.mlhim.rm.support.interfaces import IPartyRef, IObjectVersionId
+from oship.mlhim.rm.datatypes.basic import IDvIdentifier
+from oship.mlhim.rm.datatypes.text.interfaces import IDvText, IDvCodedText
+from oship.mlhim.rm.datatypes.quantity.interfaces import IDvInterval
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import IDvDateTime
+from oship.mlhim.rm.datatypes.encapsulated.interfaces import IDvMultimedia
+from oship.mlhim.rm.datatypes.uri.interfaces import IDvEhrUri
+
+
+_ = MessageFactory('oship')
+
+class IPartyProxy(Interface):
+    u"""
+    Abstract concept of a proxy description of a party, including an optional
+    link to data for this party in a demographic or other identity management
+    system. Subtyped into PARTY_IDENTIFIED and PARTY_SELF.
+    """
+
+    externalRef = Object(
+        schema=IPartyRef,
+        title=_(u"External Reference"),
+        description=_(u"""Optional reference to more detailed demographic or
+                      identification information for this party, in an external
+                      system. Type == PartyRef."""),
+        required=False,
+    )
+
+
+class IParticipation(Interface):
+    u"""
+    Model of a participation of a Party (any Actor or Role) in an activity.
+
+    Used to represent any participation of a Party in some activity, which is
+    not explicitly in the model, e.g. assisting nurse. Can be used to record
+    past or future participations.
+
+    Should not be used in place of more permanent relationships between
+    demographic entities. """
+
+    performer = Object(
+        schema=IPartyProxy,
+        title=_(u'Performer'),
+        description=_(u"""The id and possibly demographic system link of
+                      performer: (PartyProxy) the party participating in the
+                      activity."""),
+
+    )
+
+    function = Object(
+        schema=IDvText,
+        title=_(u'Function'),
+        description=_(u"""The function of the Party in this participation (note
+                      in a particular activity). This attribute should be coded,
+                      but cannot be limited to the HL7v3:ParticipationFunction
+                      vocabulary, since it is too limited and
+                      hospital-oriented."""),
+
+    )
+
+    mode = Object(
+        schema=IDvCodedText,
+        title=_(u'Mode'),
+        description=_(u"""The mode of the performer / activity interaction,
+                      e.g. present, by telephone, by email etc. Type ==
+                      DvCodedText"""),
+    )
+
+    time = Object(
+        schema=IDvInterval,
+        title=_(u'Time Interval'),
+        description=_(u"""The time interval during which the participation took
+                      place, if it is used in an observational context (i.e.
+                      recording facts about the past); or the intended time
+                      interval of the participation when used in future contexts,
+                      such as EHR Instructions."""),
+        required=False,
+    )
+
+    def performerValid():
+        u"""performer is not None"""
+
+    def functionValid():
+        u"""function is not None and then
+        function.generating_type.is_equal("DV_CODED_TEXT") implies
+        terminology(Terminology_id_openehr)\
+        .has_code_for_group_id(Group_id_participation_function,
+        function.defining_code)"""
+
+    def modeValid():
+        u"""mode is not None and
+        terminology(Terminology_id_openehr).has_code_for_group_id
+        (Group_id_participation_mode, mode.defining_code)"""
+
+
+class IPartyRelated(Interface):
+    u"""
+    Proxy type for identifying a party and its relationship to the subject of
+    the record.
+
+    Use where the relationship between the party and the subject of the record
+    must be known.
+    """
+
+    relationship = Object(
+        schema=IDvCodedText,
+        title=_(u'Relationship'),
+        description=_(u"""Relationship of subject of this ENTRY to the subject
+                      of the record. May be coded. If it is the patient, coded
+                      as "self"."""),
+
+    )
+
+    def relationshipValid():
+        u"""relationship is not None and relationship in the relationship
+        vocabulary."""
+
+class IAuditDetails(Interface):
+    u"""
+    The set of attributes required to document the committal of an information
+    item to a repository.
+    """
+
+    systemId = TextLine(
+        title=_(u"""System Id"""),
+        description=_(u"""Identity of the system where the change was
+                      committed. Ideally this is a machine- and
+                      human-processable identifier, but it may not be."""),
+    )
+
+    committer = Object(
+        schema=IPartyProxy,
+        title=_(u"""Committer"""),
+        description=_(u"""Identity and optional reference into identity
+                      management service, of user who committed the item."""),
+    )
+
+    timeCommitted = Object(
+        schema=IDvDateTime,
+        title=_(u"""Time Committed"""),
+        description=_(u"""Time of committal of the item."""),
+
+    )
+
+    changeType = Object(
+        schema=IDvCodedText,
+        title=_(u"""Change Type"""),
+        description=_(u"""Type of change. Coded using the openEHR Terminology
+                      "audit change type" group. Type==DvCodedText"""),
+
+    )
+
+    description = Object(
+        schema=IDvText,
+        title=_(u"""Description"""),
+        description=_(u"""Reason for committal. Type==DvText"""),
+        required=False,
+    )
+
+    def systemIdValid():
+        u"""systemId is not None and systemId != '' """
+
+    def committerValid():
+        u"""committer!= None"""
+
+    def timeCommittedValid():
+        u"""timeCommitted is not None"""
+
+    def changeTypeValid():
+        u"""changeType is not None and then terminology(Terminology_id_openehr).
+        has_code_for_group_id(Group_id_audit_change_type,
+        change_type.defining_code)"""
+
+
+class IPartyIdentified(Interface):
+    u"""
+    Proxy data for an identified party other than the subject of the record,
+    minimally consisting of human-readable identifier(s), such as name, formal
+    (and possibly computable) identifiers such as NHS number, and an optional
+    link to external data. There must be at least one of name, identifier or
+    external_ref present.
+
+    Used to describe parties where only identifiers may be known, and there is
+    no entry at all in the demographic system (or even no demographic system).
+    Typically for health care providers, e.g. name and provider number of an
+    institution.
+
+    Should not be used to include patient identifying information.
+    """
+
+    name = TextLine(
+        title=_(u'Name'),
+        description=_(u"""Optional human-readable name (in String form)."""),
+        required=False,
+    )
+
+    identifiers = List(
+        value_type=Object(schema=IDvIdentifier),
+        title=_(u'Identifiers'),
+        description=_(u"""One or more formal identifiers (possibly computable).
+                      List<DvIdentifier>"""),
+        required=False,
+    )
+
+    def basicValid(obj):
+        u"""name None or identifiers is not None or external_ref is not None"""
+
+    def nameValid():
+        u"""name is not None and name != '' """
+
+    def identifiersValid():
+        u"""identifiers != none and identifiers != '' """
+
+
+class IAttestation(Interface):
+    u"""
+    Record an attestation of a party (the committer) to item(s) of record
+    content. The type of attestation is """
+
+    attestedView = Object(
+        schema=IDvMultimedia,
+        title=_(u'Attested View'),
+        description=_(u"""Optional visual representation of content attested
+                      e.g. screen image. Type==DvMultimedia"""),
+        required=False,
+    )
+
+    proof = TextLine(
+        title=_(u'Proof'),
+        description=_(u"""Proof of attestation."""),
+        required=False,
+    )
+
+    items = Set(
+        value_type=Object(IDvEhrUri),
+        title=_(u'Items'),
+        description=_(u"""Items attested, expressed as fully qualified runtime
+                      paths to the items in question. Although not recommended,
+                      these may include fine-grained items which have been
+                      attested in some other system. Otherwise it is assumed to
+                      be for the entire VERSION with which it is associated.
+                      Set <DV_EHR_URI>"""),
+        required=False,
+    )
+
+
+    reason = Object(
+        schema=IDvText,
+        title=_(u'Reason'),
+        description=_(u"""Reason of this attestation. Optionally coded by the
+                      openEHR Terminology group "attestation reason"; includes
+                      values like "authorisation", "witness" etc."""),
+
+    )
+
+    isPending = Bool(
+        title=_(u'Pending?'),
+        description=_(u"""True if this attestation is outstanding;
+                      False means it has been completed."""),
+
+    )
+
+    def itemsValid():
+        u"""items is not None items != '' """
+
+    def reasonValid():
+        u"""Reason is not None and
+        then(reason.generating_type.is_equal("DV_CODED_TEXT") implies
+        terminology(Terminology_id_openehr).has_code_for_group_id
+        (Group_id_attestation_reason, reason.defining_code))"""
+
+
+class IPartySelf(Interface):
+    u"""
+    Party proxy representing the subject of the record.
+    Used to indicate that the party is the owner of the record. May or may
+    not have external_ref set.
+    """
+    pass
+
+
+class IRevisionHistoryItem(Interface):
+    u"""
+    An entry in a revision history, corresponding to a version from a versioned
+    container. Consists of AUDIT_DETAILS instances with revision identifier of
+    the revision to which the AUDIT_DETAILS intance belongs.
+    """
+
+    audits = List(
+        value_type=Object(IAuditDetails),
+        title=_(u'Audits'),
+        description=_(u"""The audits for this revision; there will always be at
+                      least one commit audit (which may itself be an
+                      ATTESTATION), there may also be further attestations."""),
+    )
+
+    versionId = Object(
+        schema=IObjectVersionId,
+        title=_(u'Version Id'),
+        description=_(u"""Version identifier for this revision."""),
+
+    )
+
+    def auditValid():
+        u"""audits is not None and audits != ' """
+
+    def versionIdValid():
+        u"""versionId is not None"""
+
+
+class IRevisionHistory(Interface):
+    u"""
+    Defines the notion of a revision history of audit items, each associated
+    with the version for which that audit was committed. The list is in
+    most-recent-first order.
+    """
+
+    items = List(
+        value_type=TextLine(),
+        title=_(u'Items'),
+        description=_(u"The items in this history in most-recent-last order."),
+
+    )
+
+    def mostRecentVersion():
+        u"""The version id of the most recent item, as a String.
+        Ensure Result.is_equal(items.last.version_id.value)"""
+
+    def mostRecentVersionTimeCommitted():
+        u"""The commit date/time of the most recent item, as a string.
+        Ensure Result.is_equal(items.last.audits.first.time_committed.value)"""
+
+    def itemsValid():
+        u"""items is not None """

=== added directory 'src/oship/mlhim/rm/common/generic/tests'
=== added file 'src/oship/mlhim/rm/common/generic/tests/__init__.py'
=== added directory 'src/oship/mlhim/rm/common/resource'
=== added file 'src/oship/mlhim/rm/common/resource/__init__.py'
--- src/oship/mlhim/rm/common/resource/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/resource/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import grok
+
+from oship.mlhim.rm.datatypes.text import CodePhrase
+from interfaces import *
+
+
+
+class AuthoredResource(grok.Model):
+    u"""
+    Abstract idea of an online resource created by a human author.
+    """
+
+    grok.implements(IAuthoredResource)
+
+    def __init__(self,originalLanguage,translations,description,revisionHistory,isControlled):
+        if isinstance(originalLanguage, CodePhrase):
+            self.originalLanguage=originalLanguage
+        else:
+            raise AttributeError("Incorrect AuthoredResource.originalLanguage")
+
+        self.translations=translations
+        self.description=description
+        self.revisionHistory=revisionHistory
+        if isControlled is None:
+            self.isControlled = False
+        else:
+            self.isControlled=isControlled
+
+    def currentRevision(self):
+        u"""
+        Extracted from revisionHistory.
+        """
+        revlist = self.revisionHistory.items
+
+        return revlist[(lenrevlist)] # the last one
+
+    def languagesAvailable(self):
+        u"""
+        Derived from originalLanguage and translations.
+        """
+        return [self.originalLanguage,self.translations]
+
+
+class TranslationDetails(grok.Model):
+    u""" """
+
+    grok.implements(ITranslationDetails)
+
+    def __init__(self, lang, author, accred, other):
+        self.language=lang
+        self.author=author
+        self.accreditation=accred
+        self.otherDetails=other
+
+
+class ResourceDescriptionItem(grok.Model):
+    u"""Language-specific detail of resource description. When a resource is
+    translated for use in another language environment, each
+    RESOURCE_DESCRIPTION_ITEM needs to be copied and translated into the new
+    language. """
+
+    pass
+
+
+class ResourceDescription(grok.Model):
+    u"""Defines the descriptive meta-data of a resource."""
+
+    pass

=== added file 'src/oship/mlhim/rm/common/resource/interfaces.py'
--- src/oship/mlhim/rm/common/resource/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/common/resource/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.interface import Interface, Attribute
+from zope.schema import TextLine, List, Object, Set, Bool, Dict
+from zope.i18nmessageid import MessageFactory
+import grok
+
+from oship.mlhim.rm.support.interfaces import  IPartyRef
+from oship.mlhim.rm.datatypes.text.interfaces import ICodePhrase
+from oship.mlhim.rm.common.generic.interfaces import IRevisionHistory
+
+_ = MessageFactory('oship')
+
+
+
+
+class ITranslationDetails(Interface):
+    u""""""
+
+    language=Object(
+        schema=ICodePhrase,
+        title=_(u'Language'),
+        description=_(u""" """),
+        required=True)
+
+    author=Dict(
+        title=_(u'Author'),
+        description=_(u""" """),
+        required=True)
+
+    accreditation=TextLine(
+        title=_(u'Accreditation'),
+        description=_(u""""""),
+        required=False)
+
+    otherDetails=Dict(
+        title=_(u'Other Details'),
+        description=_(u""""""),
+        required=False)
+
+
+class IResourceDescriptionItem(Interface):
+    u"""Language-specific detail of resource description. When a resource is
+    translated for use in another language environment, each
+    RESOURCE_DESCRIPTION_ITEM needs to be copied and translated into the new
+    language. """
+
+    language=Object(
+        schema=ICodePhrase,
+        title=_(u'Language'),
+        description=_(u""""""),
+        required=True)
+
+    purpose=TextLine(
+        title=_(u'Purpose'),
+        description=_(u""""""),
+        required=True)
+
+    keywords=List(
+        value_type=TextLine(),
+        title=_(u'Keywords'),
+        description=_(u""""""),
+        required=False)
+
+    use=TextLine(
+        title=_(u'Use'),
+        description=_(u""""""),
+        required=False)
+
+    misuse=TextLine(
+        title=_(u'Misuse'),
+        description=_(u""""""),
+        required=False)
+
+    copyright=TextLine(
+        title=_(u'Copyright'),
+        description=_(u""""""),
+        required=False)
+
+    originalResourceUri=Dict(
+        title=_(u'Original Resource URI'),
+        description=_(u""""""),
+        required=False)
+
+    otherDetails=Dict(
+        title=_(u'Other Details'),
+        description=_(u""""""),
+        required=False)
+
+
+class IResourceDescription(Interface):
+    u"""Defines the descriptive meta-data of a resource."""
+
+    originalAuthor=Dict(
+        title=_(u'Original Author'),
+        description=_(u""""""),
+        required=True
+    )
+
+    otherContributors=List(
+        title=_(u'Other Contributors'),
+        description=_(u""""""),
+        required=False
+    )
+
+    lifecycleState=TextLine(
+        title=_(u'Lifecycle State'),
+        description=_(u""""""),
+        required=True
+    )
+
+    details=Dict(
+        title=_(u'Details'),
+        description=_(u""""""),
+        required=True
+    )
+
+    resourcePackageUri=TextLine(
+        title=_(u'Resource Package URI'),
+        description=_(u""""""),
+        required=False
+    )
+
+    otherDetails=Dict(
+        title=_(u'Other Details'),
+        description=_(u""""""),
+        required=False
+    )
+
+    parentResource=Attribute(u'Parent Resource')
+
+
+class IAuthoredResource(Interface):
+    u"""Abstract idea of an online resource created by a human author. """
+
+    originalLanguage=Object(
+        schema=ICodePhrase,
+        title=_(u"Original Language"),
+        description=_(u"""Original Language"""),
+        required=False)
+
+    translations=Dict(
+        key_type = TextLine(),
+        value_type = Object(schema=ITranslationDetails),
+        title=_(u"Translations"),
+        description=_(u"Translations"),
+        required=False)
+
+    description=Object(
+        schema=IResourceDescription,
+        title=_(u"Description"),
+        description=_(u""""""),
+        required=False)
+
+    revisionHistory=Object(
+        schema=IRevisionHistory,
+        title=_(u"Revision History"),
+        description=_(u""""""),
+        required=False)
+
+    isControlled=Bool(
+        title=_(u"Is Controlled"),
+        description=_(u""""""),
+        required=False)
+
+    def currentRevision():
+        u"""
+        Extracted from revisionHistory.
+        """
+
+    def languagesAvailable():
+        u"""
+        Derived from originalLanguage and translations.
+        """

=== added directory 'src/oship/mlhim/rm/common/resource/tests'
=== added file 'src/oship/mlhim/rm/common/resource/tests/__init__.py'
=== added directory 'src/oship/mlhim/rm/composition'
=== added file 'src/oship/mlhim/rm/composition/__init__.py'
--- src/oship/mlhim/rm/composition/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+
+import grok
+from oship.mlhim.rm.common.archetyped import Locatable, Pathable
+from interfaces import *
+
+
+
+class Composition(Locatable,grok.Container):
+    """
+    One version in a VersionedComposition.  A composition is considered the unit of modification in an EHR.
+    """
+
+    grok.implements(IComposition)
+
+    def __init__(self,content,context,composer,cat,lang,terr,uid,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.content=content
+        self.context=context
+        self.composer=composer
+        self.category=cat
+        self.language=lang
+        self.territory=terr
+
+    def isPersistent(self):
+        return True # all Compositions in OSHIP are persistent.
+
+
+
+
+class EventContext(Pathable):
+    """
+    The context information of a healthcare event.
+    These include patient contacts or other investigations.
+    """
+
+    grok.implements(IEventContext)
+
+    def __init__(self,hcf,start,end,part,loc,sett,other):
+        self.healthCareFacility=hcf
+        self.startTime=start
+        self.endTime=end
+        self.participations=part
+        self.location=loc
+        self.setting=sett
+        self.otherContext=other

=== added directory 'src/oship/mlhim/rm/composition/content'
=== added file 'src/oship/mlhim/rm/composition/content/__init__.py'
--- src/oship/mlhim/rm/composition/content/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import grok
+
+from oship.mlhim.rm.common.archetyped import Locatable
+from interfaces import IContentItem
+
+
+class ContentItem(Locatable):
+    """
+    Abstract ancestor of all concrete content types.
+    """
+
+    grok.implements(IContentItem)

=== added directory 'src/oship/mlhim/rm/composition/content/entry'
=== added file 'src/oship/mlhim/rm/composition/content/entry/__init__.py'
--- src/oship/mlhim/rm/composition/content/entry/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/entry/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,187 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from oship.mlhim.rm.common.archetyped import Locatable, Pathable
+from oship.mlhim.rm.common.generic import PartySelf
+from oship.mlhim.rm.common.change_control import VersionedObject
+from oship.mlhim.rm.composition.content import ContentItem
+from interfaces import *
+
+
+
+class Entry(ContentItem):
+    """
+    The abstract parent of all ENTRY subtypes. An ENTRY is the root of a logical item
+    of "hard" clinical information created in the "clinical statement" context, within a
+    clinical session. There can be numerous such contexts in a clinical session. Obser-
+    vations and other Entry types only ever document information captured/created in
+    the event documented by the enclosing Composition.
+    An ENTRY is also the minimal unit of information any query should return, since a
+    whole ENTRY (including subparts) records spatial structure, timing information,
+    and contextual information, as well as the subject and generator of the informa-
+    tion.
+    """
+
+    grok.implements(IEntry)
+
+    def __init__(self,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        ContentItem.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+
+        self.language=lang
+        self.encoding=encod
+        self.subject=subject
+        self.provider=provider
+        self.otherParticipations=opart
+        self.workflowId=wfid
+
+    def subjectIsSelf(self):
+        u"""Returns True if this Entry is about the subject of the EHR, in which case the
+        subject attribute is of type PARTY_SELF. """
+        return (isinstance(self.subject, PartySelf))
+
+
+
+class CareEntry(Entry):
+    """
+    The abstract parent of all clinical ENTRY subtypes. A CARE_ENTRY defines
+    protocol and guideline attributes for all clinical Entry subtypes.
+    """
+
+    grok.implements(ICareEntry)
+
+
+    def __init__(self,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        Entry.__init__(self,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.protocol=protocol
+        self.guidelineId=gid
+
+
+
+class AdminEntry(Entry):
+    """
+    Entry subtype for administrative information, i.e. information about setting up the
+    clinical process, but not itself clinically relevant. Archetypes will define con-
+    tained information.
+    Used for admistrative details of admission, episode, ward location, discharge,
+    appointment (if not stored in a practice management or appointments system).
+
+    Not used for any clinically significant information.
+    """
+
+    grok.implements(IAdminEntry)
+
+
+    def __init__(self,data,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        Entry.__init__(self,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.data=data
+
+
+
+class Evaluation(CareEntry):
+    """
+    Entry type for evaluation statements.
+    """
+
+    grok.implements(IEvaluation)
+
+    def __init__(self,data,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        CareEntry.__init__(self,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.data=data
+
+
+
+class Action(CareEntry):
+    """
+    Used to record a clinical action that has been performed.
+    """
+
+    grok.implements(IAction)
+
+
+    def __init__(self,time,desc,ism,inst,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        CareEntry.__init__(self,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.time=time
+        self.description=desc
+        self.ismTransition=ism
+        self.instructionDetails=inst
+
+
+
+class Activity(Locatable):
+    """
+    A single activity within an instruction.
+    """
+
+    grok.implements(IActivity)
+
+
+    def __init__(self,description,timing,atid,uid,atnodeid,name,atdetails,fdraudit,links):
+        Locatable.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.description=description
+        self.timing=timing
+        self.actionArchetypeId=atid
+
+
+
+class InstructionDetails(Pathable):
+    """
+    Used to record the details of an Instruction causing an Action.
+    """
+
+    grok.implements(IInstructionDetails)
+
+    def __init__(self,inst,actid,wfd):
+        Pathable.__init__(self)
+        self.instructionId=inst
+        self.activityId=actid
+        self.wfDetails=wfd
+
+
+
+class Instruction(CareEntry):
+    """
+    Used to specify future actions and includes a workflow form.
+    """
+
+    grok.implements(IInstruction)
+
+    def __init__(self,narr,act,exp,wfd,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        CareEntry.__init__(self,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.narrative=narr
+        self.activities=act
+        self.expiryTime=exp
+        self.wfDefinition=wfd
+
+
+
+class IsmTransition(Pathable):
+    """
+    Model of a transition in the Instruction state machine.
+    """
+
+    grok.implements(IIsmTransition)
+
+    def __init__(self,cstate,trans,cfs):
+        Pathable.__init__(self)
+        self.currentState=cstate
+        self.transition=trans
+        self.careflowStep=cfs
+
+
+class Observation(CareEntry):
+    """
+    Entry subtype for all clinical data in the past or present, i.e. which (by the time it
+    is recorded) has already occurred. OBSERVATION data is expressed using the class
+    HISTORY<T>, which guarantees that it is situated in time.
+    OBSERVATION is used for all notionally objective (i.e. measured in some way)
+    observations of phenomena, and patient-reported phenomena, e.g. pain.
+    Not used for recording opinion or future statements of any kind, including instructions,
+    intentions, plans etc.
+    """
+
+    grok.implements(IObservation)
+
+    def __init__(self,data,state,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links):
+        CareEntry.__init__(self,protocol,gid,lang,encod,subject,provider,opart,wfid,uid,atnodeid,name,atdetails,fdraudit,links)
+        self.data=data
+        self.state=state

=== added file 'src/oship/mlhim/rm/composition/content/entry/interfaces.py'
--- src/oship/mlhim/rm/composition/content/entry/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/entry/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,335 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import grok
+
+from zope.interface import Interface
+from zope.schema import List, TextLine, Object, Bool
+from zope.i18nmessageid import MessageFactory
+
+from oship.mlhim.rm.common.generic.interfaces import IParticipation, IPartyProxy
+from oship.mlhim.rm.support.interfaces import IUidBasedId, IObjectRef, ILocatableRef
+from oship.mlhim.rm.datatypes.text.interfaces import IDvCodedText, ICodePhrase, IDvText
+from oship.mlhim.rm.datatypes.encapsulated.interfaces import IDvParsable
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import IDvDateTime
+from oship.mlhim.rm.data_structures.item_structure.interfaces import IItemStructure
+from oship.mlhim.rm.data_structures.history.interfaces import IHistory
+
+
+_ = MessageFactory('oship')
+
+
+class ICareEntry(Interface):
+    u"""
+            The abstract parent of all clinical ENTRY subtypes. A CARE_ENTRY defines
+            protocol and guideline attributes for all clinical Entry subtypes.
+
+    """
+
+    protocol = Object(
+        schema=IItemStructure,
+        title=_(u"Protocol"),
+        description=_(u"""Description of the method (i.e. how) the information in this
+                    entry was arrived at. For OBSERVATIONs, this is a description of the
+                    method or instrument used. For EVALUATIONs, how the evaluation was
+                    arrived at. For INSTRUCTIONs, how to execute the Instruction.
+                    This may take the form of references to guidelines, including
+                    manually followed and executable; knowledge references such as a
+                    paper in Medline; clinical reasons within a largercare process."""),
+        required=False
+    )
+
+    guidelineId = Object(
+        schema=IObjectRef,
+        title=_(u"guidelineId"),
+        description=_(u"""Optional external identifier of guideline creating this
+                    action if relevant."""),
+        required=False
+    )
+
+
+
+class IAdminEntry(Interface):
+    u"""
+        Entry subtype for administrative information, i.e. information about setting up the
+        clinical process, but not itself clinically relevant. Archetypes will define con-
+        tained information.
+        Used for admistrative details of admission, episode, ward location, discharge,
+        appointment (if not stored in a practice management or appointments system).
+
+        Not used for any clinically significant information.
+    """
+
+    data = Object(
+        schema=IItemStructure,
+        title=u"""data""",
+        description=u"""The data of the Entry; modelled in archetypes.""",
+        required=True
+        )
+
+
+
+class IEvaluation(Interface):
+    """
+    Entry type for evaluation statements.
+    """
+
+    data=Object(
+        schema=IItemStructure,
+        title=_(u"Data"),
+        description=_(u"The data of this evaluation."),
+
+    )
+
+
+
+class IIsmTransition(Interface):
+    """
+    Model of a transition in the Instruction state machine.
+    """
+
+    currentState=Object(
+        schema=IDvCodedText,
+        title=_(u"Current State"),
+        description=_(u"The ISM current state."),
+
+    )
+
+    transition=Object(
+        schema=IDvCodedText,
+        title=_(u"Transition"),
+        description=_(u"The ISM transition which occured to arrive at the current state."),
+        required=False,
+    )
+
+    careflowStep=Object(
+        schema=IDvCodedText,
+        title=_(u"Careflow Step"),
+        description=_(u"The step in the careflow process which occured as part of this process."),
+        required=False,
+    )
+
+
+
+class IEntry(Interface):
+    u"""
+        The abstract parent of all ENTRY subtypes. An ENTRY is the root of a logical item
+        of "hard" clinical information created in the "clinical statement" context, within a
+        clinical session. There can be numerous such contexts in a clinical session. Obser-
+        vations and other Entry types only ever document information captured/created in
+        the event documented by the enclosing Composition.
+        An ENTRY is also the minimal unit of information any query should return, since a
+        whole ENTRY (including subparts) records spatial structure, timing information,
+        and contextual information, as well as the subject and generator of the informa-
+        tion.
+
+    """
+
+    language = Object(
+        schema=ICodePhrase,
+        title = _(u"language"),
+        description = _(u"""Mandatory indicator of the localised language in which this Entry
+                      is written. Coded from openEHR Code Set "languages"."""),
+        required = True
+        )
+
+    encoding = Object(
+        schema=ICodePhrase,
+        title = _(u"encoding"),
+        description = _(u"""Name of character set in which text values in this Entry are encoded.
+                      Coded from openEHR Code Set "character sets"."""),
+        required = True
+        )
+
+
+    subject = Object(
+        schema=IPartyProxy,
+        title = _(u"subject"),
+        description = _(u"""Id of human subject of this ENTRY, e.g.
+                           organ donor, foetus, a family member
+                           another clinically relevant person."""),
+        required = True
+        )
+
+    provider = Object(
+        schema=IPartyProxy,
+        title = _(u"provider"),
+        description = _(u"""Optional identification of provider of the information in this ENTRY, which might be:
+                        the patient
+                        a patient agent, e.g. parent, guardian
+                        the clinician
+                        a device or software
+                       Generally only used when the recorder needs to make it explicit. Otherwise, Composition
+                       composer and other participants are assumed. """),
+        required = False
+        )
+
+    otherParticipations = List(
+        title = _(u"otherParticipations"),
+        description = _(u"""Other participations at ENTRY level."""),
+	value_type=Object(schema=IParticipation),
+        required = False
+        )
+
+    workflowId = Object(
+        schema=IObjectRef,
+        title = _(u"workflowId"),
+        description = _(u"""Identifier of externally held workflow engine data for this
+                      workflow execution, for this subject of care."""),
+        required = False
+        )
+
+
+    def subectIsSelf():
+        u"""Returns True if this Entry is about the subject of the EHR, in which case the
+        subject attribute is of type PARTY_SELF. """
+
+
+
+
+class IInstructionDetails(Interface):
+    """
+    Used to record the details of an Instruction causing an Action.
+    """
+
+    instructionId=Object(
+        schema=ILocatableRef,
+        title=_(u"Instruction Id"),
+        description=_(u"Reference to causing Instruction."),
+
+    )
+
+    activityId=TextLine(
+        title=_(u"Activity Id"),
+        description=_(u"Indentifier of Activity within Instruction."),
+        required=False,
+    )
+
+    wfDetails=Object(
+        schema=IItemStructure,
+        title=_(u"WF Details"),
+        description=_(u"Various workflow engine state details."),
+        required=False,
+    )
+
+
+
+
+class IAction(Interface):
+    """
+    Used to record a clinical action that has been performed.
+    """
+
+    time=Object(
+        schema=IDvDateTime,
+        title=_(u"Timing"),
+        description=_(u"Point in time of completion of this action."),
+    )
+
+    description=Object(
+        schema=IItemStructure,
+        title=_(u"Description"),
+        description=_(u"Description of the activity in ItemStructure form."),
+    )
+
+    ismTransition=Object(
+        schema=IIsmTransition,
+        title=_(u"ISM Transition"),
+        description=_(u"Details of the transition of the Instruction state."),
+    )
+
+    instructionDetails=Object(
+        schema=IInstructionDetails,
+        title=_(u"Instruction Details"),
+        description=_(u"Details of the Instruction causing this Action."),
+        required=False,
+    )
+
+
+class IActivity(Interface):
+    """
+    A single activity within an instruction.
+    """
+
+    description=Object(
+        schema=IItemStructure,
+        title=_(u"Description"),
+        description=_(u"Description of the activity."),
+        required=True,
+    )
+
+    timing=Object(
+        schema=IDvParsable,
+        title=_(u"Timing"),
+        description=_(u"Timing of the activity in a format such as ISO8601."),
+        required=True,
+    )
+
+    actionArchetypeId=TextLine(
+        title=_(u"Action ArchetypeId"),
+        description=_(u"re pattern enclosed in '//' delimiters."),
+        required=False,
+    )
+
+
+class IInstruction(Interface):
+    """
+    Used to specify future actions and includes a workflow form.
+    """
+
+    narrative=Object(
+        schema=IDvText,
+        title=_(u"Narrative"),
+        description=_(u"Human readable version of the Instructions."),
+        required=True
+    )
+
+    activities=List(
+        value_type = Object(schema = IActivity),
+        title=_(u"Activities"),
+        description=_(u"List of all activities in the Instruction."),
+        required=False,
+    )
+
+    expiryTime=Object(
+        schema=IDvDateTime,
+        title=_(u"Expiry Time"),
+        description=_(u"Data/time when this Instruction can be assumed to have expired."),
+        required=False,
+    )
+
+    wfDefinition=Object(
+        schema=IDvParsable,
+        title=_(u"Workflow Definition"),
+        description=_(u"Workflow engine executable expression of the Instruction."),
+        required=False,
+    )
+
+
+
+class IObservation(Interface):
+    u"""Entry subtype for all clinical data in the past or present, i.e. which (by the time it
+    is recorded) has already occurred. OBSERVATION data is expressed using the class
+    HISTORY<T>, which guarantees that it is situated in time.
+    OBSERVATION is used for all notionally objective (i.e. measured in some way)
+    observations of phenomena, and patient-reported phenomena, e.g. pain.
+    Not used for recording opinion or future statements of any kind, including instructions,
+    intentions, plans etc."""
+
+    data = Object(
+        schema=IHistory,
+        title=_(u"data"),
+        description=_(u"""The data of this observation, in the form of a history of
+                    values which may be of any complexity."""),
+        required=True
+    )
+
+    state = Object(
+        schema=IHistory,
+        title=_(u"state"),
+        description=_(u"""Optional recording of the state of subject of this
+                    observation during the observation process, in the form of
+                    a separate history of values which may be of any complexity.
+                    State may also be recorded within the History of the data attribute."""),
+        required=False
+    )

=== added directory 'src/oship/mlhim/rm/composition/content/entry/tests'
=== added file 'src/oship/mlhim/rm/composition/content/entry/tests/__init__.py'
=== added file 'src/oship/mlhim/rm/composition/content/entry/tests/action.txt'
--- src/oship/mlhim/rm/composition/content/entry/tests/action.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/entry/tests/action.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,55 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition.content.entry import Action,IsmTransition
+>>> from oship.mlhim.rm.composition.content.entry.interfaces import IAction,IIsmTransition
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase,DvText,DvCodedText
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.data_structures.history import History
+>>> from oship.mlhim.rm.data_structures.item_structure import ItemSingle
+>>> from oship.mlhim.rm.common.generic import PartySelf
+>>> tid1 = TerminologyId(u'ISO_639-1') 
+>>> encod = CodePhrase(tid1,u'en')
+>>> lang = CodePhrase(tid1,u'UTF-8')
+>>> subject = PartySelf(None)
+>>> actionName = DvText(u"An action", None, u"font-family:Arial", None, None, None)
+>>> time = DvDateTime(u'2010-01-13T00:00:00',0,None,None,None,None)
+>>> origin_date = DvDateTime(u'2009-09-09T00:00:00',0,None,None,None,None)
+>>> description = History(origin_date, ItemSingle)
+>>> openEhrTerminologyId = TerminologyId(u"openehr")
+>>> stateCodePhrase = CodePhrase(openEhrTerminologyId,u"Instruction States")
+>>> currentState = DvCodedText(stateCodePhrase,u"planned",None,None,None,None,None)
+>>> transitionCodePhrase = CodePhrase(openEhrTerminologyId,u"Instruction Transition")
+>>> transition = DvCodedText(transitionCodePhrase,u"initiate",None,None,None,None,None)
+>>> ismTransition = IsmTransition(currentState,transition,None)
+>>> action = Action(time,description,ismTransition,None,None,None,lang,encod,subject,None,None,None,None,u'at0004',actionName,None,None,None)
+>>> action.time.value
+u'2010-01-13T00:00:00'
+>>> action.description.origin.value
+u'2009-09-09T00:00:00'
+>>> action.ismTransition.currentState.definingCode.codeString
+u'Instruction States'
+>>> action.ismTransition.currentState.definingCode.terminologyId.value
+u'openehr'
+>>> action.ismTransition.currentState.value
+u'planned'
+>>> action.ismTransition.transition.definingCode.codeString
+u'Instruction Transition'
+>>> action.ismTransition.transition.definingCode.terminologyId.value
+u'openehr'
+>>> action.ismTransition.transition.value
+u'initiate'
+>>> action.name.value
+u'An action'
+>>> action.archetypeNodeId
+u'at0004'
+>>> IAction.providedBy(action)
+True
+>>> isinstance(action,Action)
+True
+>>> IIsmTransition.providedBy(ismTransition)
+True
+>>> isinstance(ismTransition,IsmTransition)
+True
+>>> 
+

=== added file 'src/oship/mlhim/rm/composition/content/entry/tests/evaluation.txt'
--- src/oship/mlhim/rm/composition/content/entry/tests/evaluation.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/entry/tests/evaluation.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,47 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition.content.entry import Evaluation
+>>> from oship.mlhim.rm.composition.content.entry.interfaces import IEvaluation
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase, TermMapping, DvText
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.datatypes.uri import DvUri
+>>> from oship.mlhim.rm.data_structures.history import History
+>>> from oship.mlhim.rm.data_structures.item_structure import ItemSingle 
+>>> from oship.mlhim.rm.common.generic import PartySelf
+>>> origin_date = DvDateTime(u'2009-09-09T00:00:00',0,None,None,None,None)
+>>> data = History(origin_date, ItemSingle)
+>>> tid1 = TerminologyId(u'ISO_639-1') 
+>>> encod = CodePhrase(tid1,u'en')
+>>> lang = CodePhrase(tid1,u'UTF-8')
+>>> partySelf = PartySelf(None)
+>>> tid2 = TerminologyId(u"ISO_639-1")
+>>> tid3 = TerminologyId(u"10646-1:1993")
+>>> cpm = CodePhrase(tid1,u"abc123")
+>>> tm = TermMapping(cpm,u"=",None)
+>>> uri = DvUri(u"http://www.oship.org";)
+>>> cplang = CodePhrase(tid2,u"en")
+>>> cpenc = CodePhrase(tid3,u"utf-8")
+>>> entryName = DvText(u"Evaluation", [tm,], u"font-family:Arial", uri, cplang, cpenc)
+>>> evaluation = Evaluation(data,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',entryName,None,None,None)
+>>> evaluation.data.origin.value
+u'2009-09-09T00:00:00'
+>>> evaluation.language.terminologyId.value
+u'ISO_639-1'
+>>> evaluation.language.codeString
+u'UTF-8'
+>>> evaluation.encoding.terminologyId.value
+u'ISO_639-1'
+>>> evaluation.encoding.codeString
+u'en'
+>>> evaluation.subjectIsSelf()
+True
+>>> evaluation.archetypeNodeId
+u'at0004'
+>>> evaluation.name.value
+u'Evaluation'
+>>> IEvaluation.providedBy(evaluation)
+True
+>>> isinstance(evaluation,Evaluation)
+True
+>>>

=== added file 'src/oship/mlhim/rm/composition/content/entry/tests/instruction.txt'
--- src/oship/mlhim/rm/composition/content/entry/tests/instruction.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/entry/tests/instruction.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,73 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition.content.entry import Instruction,Activity
+>>> from oship.mlhim.rm.composition.content.entry.interfaces import IInstruction
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase,DvText
+>>> from oship.mlhim.rm.datatypes.encapsulated import DvParsable
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.data_structures.history import History
+>>> from oship.mlhim.rm.data_structures.item_structure import ItemSingle
+>>> from oship.mlhim.rm.common.generic import PartySelf
+>>> tid1 = TerminologyId(u'ISO_639-1') 
+>>> encod = CodePhrase(tid1,u'en')
+>>> lang = CodePhrase(tid1,u'UTF-8')
+>>> partySelf = PartySelf(None)
+>>> # Minimal instruction - without activities and workflow definition
+>>> minimalInstructionNarrative = DvText(u"A minimal instruction. It just has a narrative.", None, u"font-family:Arial", None, None, None)
+>>> minimalInstructionName = DvText(u"Minimal Instruction", None, u"font-family:Arial", None, None, None)
+>>> minimalInstruction = Instruction(minimalInstructionNarrative,None,None,None,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',minimalInstructionName,None,None,None)
+>>> minimalInstruction.narrative.value
+u'A minimal instruction. It just has a narrative.'
+>>> minimalInstruction.name.value
+u'Minimal Instruction'
+>>> IInstruction.providedBy(minimalInstruction)
+True
+>>> isinstance(minimalInstruction,Instruction)
+True
+>>> #Basic instruction - without a workflow definition but with computable activities
+>>> basicInstructionNarrative = DvText(u"A basic instruction. It has a narrative and computable activities.", None, u"font-family:Arial", None, None, None)
+>>> basicInstructionName = DvText(u"Basic Instruction", None, u"font-family:Arial", None, None, None)
+>>> activityTiming = DvParsable(u"Timing",u"ISO8601",None,None,None)
+>>> origin_date = DvDateTime(u'2009-09-09T00:00:00',0,None,None,None,None)
+>>> activityDescription = History(origin_date, ItemSingle)
+>>> activityName = DvText(u"Activity", None, u"font-family:Arial", None, None, None)
+>>> activity = Activity(activityDescription,activityTiming,None,None,u'at0005',activityName,None,None,None)
+>>> basicInstruction = Instruction(basicInstructionNarrative,[activity],None,None,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',basicInstructionName,None,None,None)
+>>> basicInstruction.narrative.value
+u'A basic instruction. It has a narrative and computable activities.'
+>>> basicInstruction.name.value
+u'Basic Instruction'
+>>> basicInstruction.activities[0].name.value
+u'Activity'
+>>> basicInstruction.activities[0].timing.value
+u'Timing'
+>>> basicInstruction.activities[0].description.origin.value
+u'2009-09-09T00:00:00'
+>>> IInstruction.providedBy(basicInstruction)
+True
+>>> isinstance(basicInstruction,Instruction)
+True
+>>> #Full instruction - with activities and  a computable workflow
+>>> fullInstructionNarrative = DvText(u"A full instruction", None, u"font-family:Arial", None, None, None)
+>>> fullInstructionName = DvText(u"Full Instruction", None, u"font-family:Arial", None, None, None)
+>>> wfDefinition = DvParsable(u"Workflow engine", u"", None, None, None)
+>>> fullInstruction = Instruction(fullInstructionNarrative,[activity],None,wfDefinition,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',fullInstructionName,None,None,None)
+>>> fullInstruction.narrative.value
+u'A full instruction'
+>>> fullInstruction.name.value
+u'Full Instruction'
+>>> fullInstruction.activities[0].name.value
+u'Activity'
+>>> fullInstruction.activities[0].timing.value
+u'Timing'
+>>> fullInstruction.activities[0].description.origin.value
+u'2009-09-09T00:00:00'
+>>> fullInstruction.wfDefinition.value
+u'Workflow engine'
+>>> IInstruction.providedBy(fullInstruction)
+True
+>>> isinstance(fullInstruction,Instruction)
+True
+>>> 
+

=== added file 'src/oship/mlhim/rm/composition/content/entry/tests/observation.txt'
--- src/oship/mlhim/rm/composition/content/entry/tests/observation.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/entry/tests/observation.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,45 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition.content.entry import Observation
+>>> from oship.mlhim.rm.composition.content.entry.interfaces import IObservation
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase,TermMapping,DvText
+>>> from oship.mlhim.rm.datatypes.uri import DvUri
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.data_structures.history import History
+>>> from oship.mlhim.rm.data_structures.item_structure import ItemSingle
+>>> from oship.mlhim.rm.common.generic import PartySelf
+>>> data = History(DvDateTime(u'2009-09-09T00:00:00',0,None,None,None,None), ItemSingle, None, None, None, None)
+>>> tid1 = TerminologyId(u'ISO_639-1') 
+>>> encod = CodePhrase(tid1,u'en')
+>>> lang = CodePhrase(tid1,u'UTF-8')
+>>> partySelf = PartySelf(None)
+>>> tid2 = TerminologyId(u"ISO_639-1")
+>>> tid3 = TerminologyId(u"10646-1:1993")
+>>> cpm = CodePhrase(tid1,u"abc123")
+>>> tm = TermMapping(cpm,u"=",None)
+>>> uri = DvUri(u"http://www.oship.org";)
+>>> cplang = CodePhrase(tid2,u"en")
+>>> cpenc = CodePhrase(tid3,u"utf-8")
+>>> entryName = DvText(u"Observation", [tm,], u"font-family:Arial", uri, cplang, cpenc)
+>>> observation = Observation(data,None,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',entryName,None,None,None)
+>>> observation.data.origin.value
+u'2009-09-09T00:00:00'
+>>> observation.language.terminologyId.value
+u'ISO_639-1'
+>>> observation.language.codeString
+u'UTF-8'
+>>> observation.encoding.terminologyId.value
+u'ISO_639-1'
+>>> observation.encoding.codeString
+u'en'
+>>> observation.subjectIsSelf()
+True
+>>> observation.archetypeNodeId
+u'at0004'
+>>> observation.name.value
+u'Observation'
+>>> IObservation.providedBy(observation)
+True
+>>> isinstance(observation,Observation)
+True

=== added file 'src/oship/mlhim/rm/composition/content/interfaces.py'
--- src/oship/mlhim/rm/composition/content/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,8 @@
+
+from zope.interface import Interface
+
+
+class IContentItem(Interface):
+    """
+    Abstract ancestor of all concrete content types.
+    """

=== added directory 'src/oship/mlhim/rm/composition/content/navigation'
=== added file 'src/oship/mlhim/rm/composition/content/navigation/__init__.py'
--- src/oship/mlhim/rm/composition/content/navigation/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/navigation/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from oship.mlhim.rm.composition.content import ContentItem
+from interfaces import ISection
+import grok
+
+class Section(ContentItem):
+    """
+    Represents a heading in a heading structure or 'section tree'.
+    """
+
+    grok.implements(ISection)
+
+    def __init__(self,items,uid,atnodeid,name,atdetails,fdraudit,links):
+        ContentItem.__init__(self,uid,atnodeid,name,atdetails,fdraudit,links)
+
+        self.items=items

=== added file 'src/oship/mlhim/rm/composition/content/navigation/interfaces.py'
--- src/oship/mlhim/rm/composition/content/navigation/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/navigation/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import List, Object
+from oship.mlhim.rm.composition.content.interfaces import IContentItem
+import grok
+
+
+
+_ = MessageFactory('oship')
+
+
+
+class ISection(Interface):
+    """
+    Represents a heading in a heading structure or 'section tree'.
+    """
+
+    items=List(
+        title=_(u"Items"),
+        description=_(u"Ordered list of content items that may include more SECTIONs or ENTRYs."),
+	value_type=Object(schema=IContentItem),
+        required=False,
+    )

=== added directory 'src/oship/mlhim/rm/composition/content/navigation/tests'
=== added file 'src/oship/mlhim/rm/composition/content/navigation/tests/__init__.py'
=== added file 'src/oship/mlhim/rm/composition/content/navigation/tests/section.txt'
--- src/oship/mlhim/rm/composition/content/navigation/tests/section.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/content/navigation/tests/section.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,50 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition.content.navigation import Section
+>>> from oship.mlhim.rm.composition.content.navigation.interfaces import ISection
+>>> from oship.mlhim.rm.composition.content.entry import Observation
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase,TermMapping,DvText
+>>> from oship.mlhim.rm.datatypes.uri import DvUri
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.data_structures.item_structure import ItemSingle
+>>> from oship.mlhim.rm.data_structures.history import History 
+>>> from oship.mlhim.rm.common.generic import PartySelf
+>>> origin_date = DvDateTime(u'2009-09-09T00:00:00',0,None,None,None,None)
+>>> data = History(origin_date,ItemSingle)
+>>> tid1 = TerminologyId(u'ISO_639-1') 
+>>> encod = CodePhrase(tid1,u'en')
+>>> lang = CodePhrase(tid1,u'UTF-8')
+>>> partySelf = PartySelf(None)
+>>> tid2 = TerminologyId(u"ISO_639-1")
+>>> tid3 = TerminologyId(u"10646-1:1993")
+>>> cpm = CodePhrase(tid1,u"abc123")
+>>> tm = TermMapping(cpm,u"=",None)
+>>> uri = DvUri(u"http://www.oship.org";)
+>>> cplang = CodePhrase(tid2,u"en")
+>>> cpenc = CodePhrase(tid3,u"utf-8")
+>>> observationEntryName = DvText(u"Observation", [tm,], u"font-family:Arial", uri, cplang, cpenc)
+>>> observation = Observation(data,None,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',observationEntryName,None,None,None)
+>>> items = [observation,]
+>>> section1EntryName = DvText(u"Section 1", [tm,], u"font-family:Arial", uri, cplang, cpenc)
+>>> section1 = Section(items,None,u"at0003",section1EntryName,None,None,None)
+>>> section1.items[0].data.origin.value
+u'2009-09-09T00:00:00'
+>>> section1.archetypeNodeId
+u'at0003'
+>>> section1.name.value
+u'Section 1'
+>>> ISection.providedBy(section1)
+True
+>>> isinstance(section1,Section)
+True
+>>> section2EntryName = DvText(u"Section 2", [tm,], u"font-family:Arial", uri, cplang, cpenc)
+>>> section2 = Section([section1],None,u"at0003",section2EntryName,None,None,None)
+>>> section2.name.value
+u'Section 2'
+>>> section2.items[0].name.value
+u'Section 1'
+>>> section2.items[0].items[0].name.value
+u'Observation'
+>>> 
+

=== added file 'src/oship/mlhim/rm/composition/interfaces.py'
--- src/oship/mlhim/rm/composition/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+
+
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import List, Object, TextLine
+from oship.mlhim.rm.common.generic.interfaces import (IPartyIdentified,
+                                     IParticipation, IPartyProxy)
+from oship.mlhim.rm.datatypes.text.interfaces import IDvCodedText,ICodePhrase
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import IDvDateTime
+from oship.mlhim.rm.data_structures.item_structure.interfaces import IItemStructure
+from oship.mlhim.rm.composition.content.interfaces import IContentItem
+
+
+_ = MessageFactory('oship')
+
+
+class IEventContext(Interface):
+    """
+    The context information of a healthcare event.
+    These include patient contacts or other investigations.
+    """
+
+    healthCareFacility=Object(
+        schema=IPartyIdentified,
+        title=_(u"Healthcare Facility"),
+        description=_(u"Where this event took place."),
+        required=False,
+    )
+
+    startTime=Object(
+        schema=IDvDateTime,
+        title=_(u"Start Time"),
+        description=_(u"Start Time"),
+
+    )
+
+    endTime=Object(
+        schema=IDvDateTime,
+        title=_(u"End Time"),
+        description=_(u"End Time"),
+        required=False,
+    )
+
+    participations=List(
+        title=_(u"Participations"),
+        description=_(u"List of all parties involved in the event."),
+	value_type=Object(schema=IParticipation),
+        required=False,
+    )
+
+    location=TextLine(
+        title=_(u"Location"),
+        description=_(u"Physical location of this event; ABCLab, home,etc."),
+        required=False,
+    )
+
+    setting=Object(
+        schema=IDvCodedText,
+        title=_(u"Setting"),
+        description=_(u"The setting of the clinical event."),
+
+    )
+
+    otherContext=Object(
+        schema=IItemStructure,
+        title=_(u"Other Context"),
+        description=_(u"Other optional archetyped context."),
+        required=False,
+    )
+
+
+class IComposition(Interface):
+    """
+    One version in a VersionedComposition.  A composition is considered the unit of modification in an EHR.
+    """
+
+    content=List(
+        title=_(u"Content"),
+        description=_(u"Content of this composition."),
+	value_type=Object(schema=IContentItem),
+        required=False,
+    )
+
+    context=Object(
+        schema=IEventContext,
+        title=_(u"Context"),
+        description=_(u"The clinical session context."),
+        required=False,
+    )
+
+    composer=Object(
+        schema=IPartyProxy,
+        title=_(u"Composer"),
+        description=_(u"The party responsible for the content. It may not be the actual person entering the data."),
+
+    )
+
+    category=Object(
+        schema=IDvCodedText,
+        title=_(u"Category"),
+        description=_(u"Defines the broad category of this composition."),
+
+    )
+
+    language=Object(
+        schema=ICodePhrase,
+        title=_(u"Language"),
+        description=_(u"Indicator of the localised language where this composition was created."),
+
+    )
+
+    territory=Object(
+        schema=ICodePhrase,
+        title=_(u"Territory"),
+        description=_(u"Territory where this composition was written. ISO 3166."),
+
+    )
+
+    def isPersistent():
+        """Used to locate items that are of interest to most users."""

=== added directory 'src/oship/mlhim/rm/composition/tests'
=== added file 'src/oship/mlhim/rm/composition/tests/__init__.py'
=== added file 'src/oship/mlhim/rm/composition/tests/composition.txt'
--- src/oship/mlhim/rm/composition/tests/composition.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/tests/composition.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,66 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition.content.entry import Observation
+>>> from oship.mlhim.rm.composition.content.navigation import Section
+>>> from oship.mlhim.rm.composition import EventContext, Composition
+>>> from oship.mlhim.rm.composition.interfaces import IComposition
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase,TermMapping,DvText,DvCodedText
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.datatypes.uri import DvUri
+>>> from oship.mlhim.rm.data_structures.history import History
+>>> from oship.mlhim.rm.data_structures.item_structure import ItemSingle
+>>> from oship.mlhim.rm.common.generic import PartySelf,PartyIdentified,Participation
+>>> origin_date = DvDateTime(u'2009-09-09T00:00:00',0,None,None,None,None)
+>>> data = History(origin_date, ItemSingle)
+>>> tid1 = TerminologyId(u'ISO_639-1') 
+>>> encod = CodePhrase(tid1,u'en')
+>>> lang = CodePhrase(tid1,u'UTF-8')
+>>> partySelf = PartySelf(None)
+>>> observationEntryName = DvText(u"Observation", None, u"font-family:Arial", None, None, None)
+>>> observation = Observation(data,None,None,None,lang,encod,partySelf,None,None,None,None,u'at0004',observationEntryName,None,None,None)
+>>> sectionEntryName = DvText(u"Section 1", None, u"font-family:Arial", None, None, None)
+>>> section = Section([observation,],None,u"at0003",sectionEntryName,None,None,None)
+>>> healthCareFacility = PartyIdentified(u'The health care facility', None, None)
+>>> start = DvDateTime(u'2009-12-31T00:00:00',0,None,None,None,None)
+>>> tid2 = TerminologyId(u'OpenEHR Terminology - setting group')
+>>> cp = CodePhrase(tid2,u'abc123')
+>>> setting = DvCodedText(cp,u"setting",[],u"",None,None,None)
+>>> performer = PartyIdentified(u'Performer',None,None)
+>>> function = DvText(u"Some really interesting text.",None,u"font-family:Arial",None,None,None)
+>>> mode = DvCodedText(cp,u"mode",[],u"",None,None,None)
+>>> participations = [Participation(performer,function,mode,None),]
+>>> location = u'home'
+>>> eventContext = EventContext(healthCareFacility,start,None,participations,location,setting,None)
+>>> composer = PartyIdentified(u'Composer',None,None)
+>>> cpcategory = CodePhrase(tid1,u'abc123')
+>>> category = DvCodedText(cpcategory,u'category',[],u'',None,None,None)
+>>> lang = CodePhrase(tid1,u'en')
+>>> tid3 = TerminologyId(u'ISO_3166') 
+>>> territory = CodePhrase(tid3,u'US') 
+>>> compositionEntryName = DvText(u"Composition", None, u"font-family:Arial", None, None, None)
+>>> composition = Composition([section,],eventContext,composer,category,lang,territory,None,u'at0005',compositionEntryName,None,None,None)
+>>> composition.content[0].name.value
+u'Section 1'
+>>> composition.content[0].items[0].name.value
+u'Observation'
+>>> composition.context.location
+u'home'
+>>> composition.composer.name
+u'Composer'
+>>> composition.category.value
+u'category'
+>>> composition.language.codeString
+u'en'
+>>> composition.territory.codeString
+u'US'
+>>> composition.name.value
+u'Composition'
+>>> composition.isPersistent()
+True
+>>> IComposition.providedBy(composition)
+True
+>>> isinstance(composition,Composition)
+True
+>>> 
+

=== added file 'src/oship/mlhim/rm/composition/tests/eventcontext.txt'
--- src/oship/mlhim/rm/composition/tests/eventcontext.txt	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/composition/tests/eventcontext.txt	2010-08-06 02:59:44 +0000
@@ -0,0 +1,38 @@
+:Test-Layer: unit
+
+>>> from oship.mlhim.rm.composition import EventContext
+>>> from oship.mlhim.rm.composition.interfaces import IEventContext
+>>> from oship.mlhim.rm.support.identification import TerminologyId
+>>> from oship.mlhim.rm.datatypes.text import CodePhrase, DvCodedText, DvText
+>>> from oship.mlhim.rm.datatypes.quantity.datetime import DvDateTime
+>>> from oship.mlhim.rm.common.generic import PartyIdentified,Participation
+>>> healthCareFacility = PartyIdentified(u'The health care facility', None, None)
+>>> start = DvDateTime(u'2009-12-31T00:00:00',0,None,None,None,None)
+>>> tid = TerminologyId(u'OpenEHR Terminology - setting group')
+>>> cp = CodePhrase(tid,u'abc123')
+>>> setting = DvCodedText(cp,u"setting",[],u"",None,None,None)
+>>> performer = PartyIdentified(u'Performer',None,None)
+>>> function = DvText(u"Some really interesting text.",None,u"font-family:Arial",None,None,None)
+>>> mode = DvCodedText(cp,u"mode",[],u"",None,None,None)
+>>> participations = [Participation(performer,function,mode,None),]
+>>> location = u'home'
+>>> eventContext = EventContext(healthCareFacility,start,None,participations,location,setting,None)
+>>> eventContext.healthCareFacility.name
+u'The health care facility'
+>>> eventContext.startTime.value
+u'2009-12-31T00:00:00'
+>>> eventContext.participations[0].performer.name
+u'Performer'
+>>> eventContext.participations[0].function.value
+u'Some really interesting text.'
+>>> eventContext.participations[0].mode.value
+u'mode'
+>>> eventContext.location
+u'home'
+>>> eventContext.setting.value
+u'setting'
+>>> IEventContext.providedBy(eventContext)
+True
+>>> isinstance(eventContext,EventContext)
+True
+>>> 

=== added directory 'src/oship/mlhim/rm/data_structures'
=== added file 'src/oship/mlhim/rm/data_structures/__init__.py'
--- src/oship/mlhim/rm/data_structures/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/data_structures/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2007, Timothy W. Cook and Contributors. All rights reserved.
+# Redistribution and use are governed by the MPL license.
+#
+# Use and/or redistribution of this file assumes you have read and accepted the
+# terms of the license.
+##############################################################################
+
+
+u"""
+From the Data Structures Information Model
+Data Structure Package Rev. 2.1.0.
+"""
+
+
+__author__ = u'Timothy Cook <timothywayne.cook@xxxxxxxxx>'
+__docformat__ = u'plaintext'
+__contributors__ = u'<name> <email address>'
+
+import grok
+
+
+from oship.mlhim.rm.common.archetyped import Locatable
+from interfaces import *
+
+
+class DataStructure(Locatable):
+    u"""
+     Abstract parent class of all data structure types. Includes the
+     as_hierarchy function which can generate the equivalent CEN EN13606 single
+     hierarchy for each subtype's physical representation. For example, the
+     physical representation of an ITEM_LIST is List<ELEMENT>; its
+     implementation of as_hierarchy will generate a CLUSTER containing the set
+     of ELEMENT nodes from the list.
+    """
+
+    grok.implements(IDataStructure)
+
+    def __init__(self, uid, atnodeid, name, atdetails, fdraudit, links, parent):
+        Locatable.__init__(self, uid, atnodeid, name, atdetails, fdraudit,
+                           links)
+
+    def asHierarchy(self):
+        u"""Hierarchical equivalent of the physical representation of each
+        subtype, compatible with CEN EN 13606 structures. Returns a List."""
+        pass
+
+

=== added directory 'src/oship/mlhim/rm/data_structures/history'
=== added file 'src/oship/mlhim/rm/data_structures/history/__init__.py'
--- src/oship/mlhim/rm/data_structures/history/__init__.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/data_structures/history/__init__.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,226 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import time
+from zope.container.constraints import checkObject
+from zope.schema.fieldproperty import FieldProperty
+from zope.container.contained import NameChooser
+from zope.container.interfaces import INameChooser
+import grok
+from grok import IObjectRemovedEvent
+from oship.mlhim.rm.common.archetyped import Locatable
+from oship.mlhim.rm.data_structures import DataStructure
+from interfaces import *
+
+_ = MessageFactory('oship')
+
+
+class DiferentStructureError(Exception):
+    pass
+
+
+class NotAItemStructureError(Exception):
+    pass
+
+
+class EventContainer(grok.Container):
+    grok.implements(IEventContainer)
+
+
+    def __init__(self, history, klass_structure, event_list=None ):
+        if IItemStructure.implementedBy(klass_structure):
+            self.klass_structure = klass_structure
+        else:
+            raise NotAItemStructureError("""The %s class don't implement the
+                    IItemStructure Interface.""")
+        self.history = history
+        super(EventContainer,self).__init__()
+        if event_list is not None:
+            name_chooser = INameChooser(self)
+            for event_object in event_list:
+                name = name_chooser.chooseName('',event_object)
+                self[name] = event_object
+
+    def __setitem__(self,name,value):
+        if not isinstance(value.data,self.klass_structure):
+            raise DiferentStructureError("""It was expected a diferent Structure""")
+        checkObject(self,name, value)
+        super(EventContainer,self).__setitem__(name,value)
+        value.__parent__ = self.history
+
+
+class Event(Locatable):
+    u"""
+    Defines the abstract notion of a single event in a series. This class is
+    generic,allowing types to be generated which are locked to particular
+    spatial types, such as EVENT<ITEM_LIST> Subtypes express point or interval
+    data. 
+    
+    """
+
+
+    grok.implements(IEvent, IEventContained)
+
+    def __init__( self, time, data, state, uid, atnodeid, name, atdetails, fdraudit, links ):
+        """
+        Event class initializer.
+
+        time -- A object that implement IDvDateTime Interface.
+        Usually a object from DvDateTime class.
+        data -- A object that implement IItemStructure Interface.
+        state --
+
+        """
+        Locatable.__init__(self, uid, atnodeid, name, atdetails, fdraudit, links)
+        self.time=time
+        self.data=data
+        self.state=state
+    
+    def __eq__(self, obj):
+        if obj is self: return True
+        return isinstance(obj, Event)
+        
+    def __ne__(self, obj):
+        return not self == obj
+    
+    def __hash__(self):
+        return hash(self.time)
+    
+    def parent(self):
+        return self.__parent__
+    
+    def offset(self):
+        if self.parent is None:
+            return None
+        return self.time.diff(self.parent.origin)
+
+class EventNameChooser(grok.Adapter, NameChooser):
+
+    grok.context(IEventContainer)
+    grok.implements(INameChooser)
+
+    def chooseName(self, name, obj):
+        if not name:
+            new_name = str(len(self.context)+1)
+            self.checkName(new_name, obj)
+        else:
+            new_name = super(EventNameChooser,self).chooseName(name, obj)
+        return new_name
+
+
+@grok.subscribe(IHistory, IObjectRemovedEvent)
+def notifyEventsToHaveNoParents(history, event):
+    # TODO: improve the history removed event trigger to enable redefine 
+    # the contained events even the history is not added to a container.
+    for event_key in history.events.keys():
+        history.events[event_key].__parent__ = None
+
+
+class History(DataStructure):
+    u"""
+    Root object of a linear history, i.e. time series structure. For a periodic
+    series of events, period will be set, and the time of each Event in the
+    History must correspond; i.e. the EVENT.offset must be a multiple of period
+    for each Event. Missing events in a period History are however allowed.
+
+    NOTE: The invariants have NOT been written yet for this interface.
+
+    """
+    
+    grok.implements(IEventContainer, IHistory)
+
+    origin = FieldProperty(IHistory['origin'])
+    period = FieldProperty(IHistory['period'])
+    summary = FieldProperty(IHistory['summary'])
+    duration = FieldProperty(IHistory['duration'])
+    events = FieldProperty(IHistory['events'])
+    
+
+    def __init__(self, origin, klass_structure, events=None,
+                 period=None, duration=None, summary=None):
+
+        self.origin=origin
+        self.events = EventContainer(self,klass_structure,events)
+        self.period=period
+        self.duration=duration
+        self.summary=summary
+
+    def __setitem__(self, key, value):
+        self.events[key] = value
+
+    def __getitem__(self, key):
+        return self.events[key]
+
+    def __delitem__(self, key):
+        del self.events[key]
+
+    def keys(self):
+        """Return the keys of the mapping object.
+        """
+        return self.events.keys()
+
+    def __iter__(self):
+        """Return an iterator for the keys of the mapping object.
+        """
+        return iter(self.events)
+
+    def values(self):
+        """Return the values of the mapping object.
+        """
+        return self.events.values()
+
+    def items(self):
+        """Return the items of the mapping object.
+        """
+        return self.events.items()
+
+    def __len__(self):
+        """Return the number of items.
+        """
+        return len(self.events)
+        
+    def __ne__(self, obj):
+        if not isinstance(obj, History): return True
+        return not self == obj
+        
+    def __hash__(self):
+        return hash(self.origin) + hash(self.events)
+        
+        
+    def isPeriodic(self):
+        u"""Indicates whether history is periodic. Returns Boolean"""
+        pass
+
+
+class PointEvent(Event):
+    u"""
+    Defines a single point event in a series.
+    """
+
+    grok.implements(IEvent)
+
+    def __init__( self, time, data, state, uid, atnodeid, name, atdetails, fdraudit, links ):
+        Event.__init__(self, time, data, state, uid, atnodeid, name, atdetails, fdraudit, links)
+
+
+class IntervalEvent(Event):
+    u"""
+    Defines a single interval event in a series.
+
+    """
+
+    grok.implements(IIntervalEvent)
+
+    def __init__(self, width, mfunc, scount):
+        self.width=width
+        self.mathFunction=mfunc
+        self.sampleCount=scount
+        
+        self.startTime=None
+        self.timer()
+        
+    def timer(self):
+        self.startTime=time.strftime("%Y-%m-%dT%H:%M:%S")
+
+    def intervalStartTime(self):
+        return self.startTime

=== added file 'src/oship/mlhim/rm/data_structures/history/interfaces.py'
--- src/oship/mlhim/rm/data_structures/history/interfaces.py	1970-01-01 00:00:00 +0000
+++ src/oship/mlhim/rm/data_structures/history/interfaces.py	2010-08-06 02:59:44 +0000
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+from zope.i18nmessageid import MessageFactory
+from zope.interface import Interface
+from zope.schema import Object, Int
+
+from zope.container.interfaces import IContainer, IContained, INameChooser
+from zope.container.constraints import contains, containers, checkObject
+from oship.mlhim.rm.datatypes.quantity.datetime.interfaces import (IDvDateTime,
+                                                            IDvDuration)
+from oship.mlhim.rm.datatypes.text.interfaces import IDvCodedText
+from oship.mlhim.rm.data_structures.item_structure.interfaces import IItemStructure
+
+_ = MessageFactory('oship')
+
+
+class IEvent(Interface):
+    u"""
+    Defines the abstract notion of a single event in a series. This class is
+    generic,allowing types to be generated which are locked to particular
+    spatial types, such as EVENT<ITEM_LIST> Subtypes express point or interval
+    data. """
+
+    time=Object(
+        schema=IDvDateTime,
+        title=_(u'time'),
+        description=_(u"""Time of this event. If the width is non-zero, it is
+        the time point of the trailing edge of the event."""),
+        required=True)
+
+
+    data=Object(
+        schema=IItemStructure,
+        title=_(u'data'),
+        description=_(u'The data of this event.'),
+        required=True)
+
+    state=Object(
+        schema=IItemStructure,
+        title=_(u'state'),
+        description=_(u'Optional state information for this event.'),
+        required=False)
+
+    def parent():
+        u"""
+        Parent IHistory where the Event is Contained.
+        It's redefinition of LOCATABLE.parent to be of type History
+        """
+
+    def offset():
+        u"""
+        Offset of this event from origin , computed as
+        time.diff(parent.origin) .
+        """
+
+
+class IEventContainer(IContainer):
+    contains(IEvent)
+
+
+class IHistory(Interface):
+    u"""
+    Root object of a linear history, i.e. time series structure. For a periodic
+    series of events, period will be set, and the time of each Event in the
+    History must correspond; i.e. the EVENT.offset must be a multiple of period
+    for each Event. Missing events in a period History are however allowed.
+
+    NOTE: The invariants have NOT been written yet for this interface.
+
+    """
+
+    origin = Object(
+        schema=IDvDateTime,
+        title=_(u"origin"),
+        description=_(u"Time origin of this event history. The first event is"
+                        " not necessarily at the origin point."),
+        required=True)
+
+    events = Object(
+        schema=IEventContainer,
+        title=_(u"events"),
+        description=_(u"The events in the series."),
+        required = False,
+        )
+
+    period=Object(
+        schema=IDvDuration,
+        title=_(u"period"),
+        description=_(u"Period between samples in this segment if periodic."),
+        required=False)
+
+    duration=Object(
+        schema=IDvDuration,
+        title=_(u"duration"),
+        description=_(u"Duration of the entire History; either corresponds to"
+        " the duration of all the events, and/or the duration represented by"
+        " the summary, if it exists."),
+        required=False)
+
+    summary=Object(
+        schema=IItemStructure,
+        title=_(u"summary"),
+        description=_(u"Optional summary data expressing e.g. text or image"
+        " which summarises entire History."),
+        required=False)
+
+    def isPeriodic():
+        u"""Indicates whether history is periodic. Returns Boolean"""
+
+    def asHierarchy():
+        u"""
+        Returns CLUSTER. Generate a CEN EN13606-compatible hierarchy of the
+        physical representation.
+
+        """
+
+
+class IEventContained(IContained):
+    containers(IEventContainer)
+    
+
+class IIntervalEvent(Interface):
+    u"""
+    Defines a single interval event in a series.
+    """
+
+    width=Object(
+        schema=IDvDuration,
+        title=_(u"width"),
+        description=_(u"Length of the interval during which the state was"
+        " true."),
+        required=True)
+
+    mathFunction=Object(
+        schema=IDvCodedText,
+        title=_(u"mathFunction"),
+        description=_(u'Mathematical function of the data of this event, e.g.'
+        ' "maximum", "mean" etc. Coded using openEHR Terminology group'
+        ' "event math function".'),
+        required=True)
+
+    sampleCount=Int(
+        title=_(u"sampleCount"),
+        description=_(u"Optional count of original samples to which this event"
+                      " corresponds."),
+        required=False)
+
+    def intervalStartTime():
+        u"""Start time of the interval of this event."""

=== added directory 'src/oship/mlhim/rm/data_structures/history/tests'
=== added file 'src/oship/mlhim/rm/data_structures/history/tests/__init__.py'
--- src/oship/mlhim/rm/data_structures/history/te

Follow ups