← Back to team overview

oship-dev team mailing list archive

[Merge] lp:oship into lp:~dmpinheiro/oship/module-reorganization

 

Diego Manhães Pinheiro has proposed merging lp:oship into lp:~dmpinheiro/oship/module-reorganization.

Requested reviews:
  Diego Manhães Pinheiro (dmpinheiro)
Related bugs:
  #578967 Interface IEvent doesn't have a right reference for the IHistory Interface due a circular reference/import problem.
  https://bugs.launchpad.net/bugs/578967
  #607533 missing argument in the initializer of class DataStructure
  https://bugs.launchpad.net/bugs/607533
  #609150 Invariant not implemented in class TermMapping
  https://bugs.launchpad.net/bugs/609150
  #609156 Invariants not implemented in class DvText
  https://bugs.launchpad.net/bugs/609156
  #610518 some issues in DvOrdered
  https://bugs.launchpad.net/bugs/610518
  #610972 some issues in class DvAmount
  https://bugs.launchpad.net/bugs/610972
  #612572 several issues in DvDuration
  https://bugs.launchpad.net/bugs/612572
  #623602 issues in class FeederAudit in package common
  https://bugs.launchpad.net/bugs/623602
  #625975 some issues in Version and IVersion
  https://bugs.launchpad.net/bugs/625975
  #625978 some issues in ImportedVersion
  https://bugs.launchpad.net/bugs/625978
  #630488 invariant in class Section is not enforced.
  https://bugs.launchpad.net/bugs/630488


Fixing a few tests that didn't check the new TerminologyService behaviour correctly.
-- 
https://code.launchpad.net/~oship-dev/oship/devel/+merge/43717
Your team OSHIP Development Team is subscribed to branch lp:oship.
=== modified file 'src/oship/openehr/rm/common/change_control/__init__.py'
--- src/oship/openehr/rm/common/change_control/__init__.py	2010-12-04 00:30:48 +0000
+++ src/oship/openehr/rm/common/change_control/__init__.py	2010-12-14 23:56:12 +0000
@@ -37,7 +37,7 @@
 
     grok.implements(IVersion)
 
-    def __init__(self, uid, preVid, data, lcstate, caudit, contribution, sig, terminologyService=None):
+    def __init__(self, uid, preVid, data, lcstate, caudit, contribution, sig, term_service=None):
         if uid.versionTreeId().isFirst() == (preVid!=None):
             raise ValueError(u"If this is the first version it's not possible to have a preceding version uid and vice-versa.")
         if contribution == None or contribution.type != 'CONTRIBUTION':
@@ -46,8 +46,11 @@
             raise AttributeError(u'lcstate must not be None')
 
         #TODO remove this consistence when we finish implementing the terminologyService
-        if terminologyService is not None:
-            if not terminologyService.terminology(TerminologyService.OPENEHR).hasCodeForGroupId('group_id_version_lifecycle_state', lcstate.definingCode):
+        if term_service is not None:
+            OPENEHR_TERMINOLOGY_NAME = TerminologyService.TERMINOLOGY_ID
+            openehr_terminology = term_service.terminology(OPENEHR_TERMINOLOGY_NAME)
+            GROUP_ID_TERM_MAPPING_PURPOSE = TerminologyService.GROUP_ID_TERM_MAPPING_PURPOSE
+            if not openehr_terminology.has_code_for_group_id(GROUP_ID_TERM_MAPPING_PURPOSE, lcstate.definingCode):
                 raise AttributeError(u'lifecycle state must be in terminology service')
         self.uid=uid
         self.precedingVersionId=preVid

=== modified file 'src/oship/openehr/rm/common/change_control/tests/originalversion.py'
--- src/oship/openehr/rm/common/change_control/tests/originalversion.py	2010-11-21 03:20:28 +0000
+++ src/oship/openehr/rm/common/change_control/tests/originalversion.py	2010-12-14 23:56:12 +0000
@@ -79,7 +79,7 @@
     def __init__(self, returnValue):
         self.returnValue = returnValue
 
-    def hasCodeForGroupId(self, groupId,code):
+    def has_code_for_group_id(self, groupId,code):
         return self.returnValue
 
 

=== modified file 'src/oship/openehr/rm/datatypes/text/__init__.py'
--- src/oship/openehr/rm/datatypes/text/__init__.py	2010-11-21 03:23:52 +0000
+++ src/oship/openehr/rm/datatypes/text/__init__.py	2010-12-14 23:56:12 +0000
@@ -24,7 +24,8 @@
     def __init__(self,target,match,purpose, terminologyService=None):
         self.target = target
         if purpose is not None:
-            if not terminologyService.terminology(TerminologyService.OPENEHR).hasCodeForGroupId('Group Id Term Mapping Purpose', purpose.definingCode):
+            openehr_terminology = terminologyService.terminology(TerminologyService.TERMINOLOGY_ID)
+            if not openehr_terminology.has_code_for_group_id(TerminologyService.GROUP_ID_TERM_MAPPING_PURPOSE, purpose.definingCode):
                 raise AttributeError(u'Terminology service must have the purpose defining code')
         self.purpose = purpose
         if match in ['<','>','=','?']:
@@ -92,9 +93,13 @@
 
         #TODO we need to remove this consistence when we finish the terminologyService
         if terminologyService is not None:
-            if language is not None and not terminologyService.codeSetForId(u'code_set_id_languages').hasCode(language):
+            CODE_SET_ID_LANGUAGES = TerminologyService.CODE_SET_ID_LANGUAGES
+            code_set = terminologyService.code_set_for_id(CODE_SET_ID_LANGUAGES)
+            if language is not None and not code_set.has_code(language):
                 raise AttributeError(u'language must be in the language code set of the terminology service')
-            if encoding is not None and not terminologyService.codeSetForId(u'code_set_id_character_sets').hasCode(encoding):
+            CODE_SET_ID_CHARACTER_SETS = TerminologyService.CODE_SET_ID_CHARACTER_SETS
+            code_set = terminologyService.code_set_for_id(CODE_SET_ID_CHARACTER_SETS)
+            if encoding is not None and not code_set.has_code(encoding):
                 raise AttributeError(u'encoding must be in the character code set of the terminology service')
         self.value=value
         self.mappings=mappings

=== modified file 'src/oship/openehr/rm/datatypes/text/tests/dvtext.py'
--- src/oship/openehr/rm/datatypes/text/tests/dvtext.py	2010-11-21 02:17:24 +0000
+++ src/oship/openehr/rm/datatypes/text/tests/dvtext.py	2010-12-14 23:56:12 +0000
@@ -83,7 +83,7 @@
     def __init__(self, returnValue):
         self.returnValue = returnValue
 
-    def codeSetForId(self, id):
+    def code_set_for_id(self, id):
         return DummyCodeSetAccess(self.returnValue)
 
 class DummyCodeSetAccess(object):
@@ -91,6 +91,6 @@
     def __init__(self, returnValue):
         self.returnValue = returnValue
 
-    def hasCode(self, code):
+    def has_code(self, code):
         return self.returnValue
 

=== modified file 'src/oship/openehr/rm/datatypes/text/tests/termmapping.py'
--- src/oship/openehr/rm/datatypes/text/tests/termmapping.py	2010-11-21 01:25:08 +0000
+++ src/oship/openehr/rm/datatypes/text/tests/termmapping.py	2010-12-14 23:56:12 +0000
@@ -41,6 +41,7 @@
     def __init__(self, returnValue):
         self.returnValue = returnValue
 
-    def hasCodeForGroupId(self, groupId, code):
+    def has_code_for_group_id(self, groupId, code):
         return self.returnValue
 
+


Follow ups