← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 270: Renamed Test template to Examples, as it is more descriptive since there are no negative 'tests' ...

 

------------------------------------------------------------
revno: 270
committer: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>
branch nick: cdd
timestamp: Thu 2012-09-27 17:52:27 -0300
message:
  Renamed Test template to Examples, as it is more descriptive since there are no negative 'tests' in it.  Added AdminEntry and DemographicEntry to xls2ccd.py.
removed:
  src/xls2ccd/examples/TestTemplate/
  src/xls2ccd/examples/TestTemplate/MLHIM_Std_Template-Tests.xls
added:
  src/xls2ccd/examples/ExampleTemplate/
  src/xls2ccd/examples/ExampleTemplate/MLHIM_Std_Template-Examples.xls
modified:
  src/xls2ccd/README.txt
  src/xls2ccd/xls2ccdRM.py


--
lp:cdd
https://code.launchpad.net/~cdd-dev/cdd/trunk

Your team MLHIM Specifications Developers is subscribed to branch lp:cdd.
To unsubscribe from this branch go to https://code.launchpad.net/~cdd-dev/cdd/trunk/+edit-subscription
=== modified file 'src/xls2ccd/README.txt'
--- src/xls2ccd/README.txt	2012-09-26 19:50:07 +0000
+++ src/xls2ccd/README.txt	2012-09-27 20:52:27 +0000
@@ -42,12 +42,12 @@
 The CCDs will be generated in the currect (xls2ccd) directory.   
 For example to build the Test CCDS from the xls2ccd directory that was unpacked into your home directory:  
 
-~/xls2ccd$python xls2ccd examples/TestTemplate/MLHIM_Std_Template-Tests.xls 
+~/xls2ccd$python xls2ccd examples/ExampleTemplate/MLHIM_Std_Template-Examples.xls 
  
 
 =========  EXAMPLES ===========
 
-There is a folder labeled TestTemplate.  This is a test template used in developement of the tool.  
+There is a folder labeled ExampleTemplate.  This is an example template used in developement of the tool.  
 You can generate these CCDs to see how the generated schemas compare with the spreadsheet data. 
 
 In the Demography folder there is a copy of the Demography_NCI_Standard_Template 06_29_2012.xls file that has been renamed
@@ -56,7 +56,7 @@
 changing the dataype column 'O' to MLHIM datatypes.  
 
 ------------------------------------- CareEntry Example ------------------------------------------------------
-This example is a bit more complex than the others.  Also, it doesn't generate a complete CareEntry CCD.
+This example is a bit more complex than the others.  Also, it doesn't generate a complete, complex CareEntry CCD.
 It does produce a valid framework that you can use to expand upon.  The framework uses a Cluster as the 
 CareEntry.entry-data and includes on Element with a DvCount datatype.  The folder, cluster-example 
 contains a bit more complex Cluster with two Elements and datatypes to show how to  manually add other

=== added directory 'src/xls2ccd/examples/ExampleTemplate'
=== added file 'src/xls2ccd/examples/ExampleTemplate/MLHIM_Std_Template-Examples.xls'
Binary files src/xls2ccd/examples/ExampleTemplate/MLHIM_Std_Template-Examples.xls	1970-01-01 00:00:00 +0000 and src/xls2ccd/examples/ExampleTemplate/MLHIM_Std_Template-Examples.xls	2012-09-27 20:52:27 +0000 differ
=== removed directory 'src/xls2ccd/examples/TestTemplate'
=== removed file 'src/xls2ccd/examples/TestTemplate/MLHIM_Std_Template-Tests.xls'
Binary files src/xls2ccd/examples/TestTemplate/MLHIM_Std_Template-Tests.xls	2012-09-23 11:57:38 +0000 and src/xls2ccd/examples/TestTemplate/MLHIM_Std_Template-Tests.xls	1970-01-01 00:00:00 +0000 differ
=== modified file 'src/xls2ccd/xls2ccdRM.py'
--- src/xls2ccd/xls2ccdRM.py	2012-09-27 20:39:54 +0000
+++ src/xls2ccd/xls2ccdRM.py	2012-09-27 20:52:27 +0000
@@ -10,6 +10,70 @@
 
 #====================================================================
 
+def getAdminEntryType(data_name, ct_name, docs, dt_id, e_data_type, indent=0):
+    """
+    data_name - string to use for data_name
+    ct_name - uuid string for complexType.name
+    docs - string for documentation
+    dt_id - the uuid for the datatype name
+    e_data_type - ClusterType, ElementType or SlotType - in xls2ccd this is only ClusterType
+    indent - number of spaces to indent first line
+    """
+
+    e_subject_type = "PartySelfType" #TODO for CDD add options for PartyIdentifiedType
+    es_id = str(uuid.uuid4()) #entry-subject id
+    ed_id = str(uuid.uuid4()) #entry-data id
+    defin_str = ''
+    padding = ('').rjust(indent)
+
+    defin_str = '\n\n'+padding.rjust(indent) + ("<xs:complexType name='ct-"+ct_name+"'>\n")
+    defin_str += padding.rjust(indent+2) + ("<xs:complexContent>\n")
+    defin_str += padding.rjust(indent+4) + ("<xs:restriction base='mlhim2:AdminEntryType'>\n")
+    defin_str += padding.rjust(indent+6) + ("<xs:sequence>\n")
+    #Locatable
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='unbounded' minOccurs='0' ref='mlhim2:links'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:feeder-audit'/>\n")
+    #Entry
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' name='language' type='xs:language' default='en-US'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' name='encoding' type='xs:string' default='utf-8'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:el-"+es_id+"'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:entry-provider'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='unbounded' minOccurs='0' ref='mlhim2:other-participations'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:protocol-id'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' name='current-state' type='xs:string'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:workflow-id'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:attestation'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:el-"+ed_id+"'/>\n")
+
+    defin_str += padding.rjust(indent+6) + ("</xs:sequence>\n")
+    defin_str += padding.rjust(indent+4) + ("</xs:restriction>\n")
+    defin_str += padding.rjust(indent+2) + ("</xs:complexContent>\n")
+    defin_str += padding.rjust(indent) + ("</xs:complexType>\n")
+    defin_str += padding.rjust(indent+2) + ("<xs:element name='el-"+ed_id+"' substitutionGroup='mlhim2:entry-data' type='mlhim2:ct-"+ed_id+"'/>\n")
+    defin_str += padding.rjust(indent+2) + ("<xs:element name='el-"+es_id+"' substitutionGroup='mlhim2:entry-subject' type='mlhim2:ct-"+es_id+"'/>\n")
+
+    if e_subject_type == "PartyIdentifiedType":
+        pass #TODO for CDD
+    elif e_subject_type == "PartySelfType":
+        defin_str += getPartySelfType(es_id,indent)
+    else:
+        print e_subject_type + ": is not a valid AdminEntry.entry-subject type."
+        exit()
+
+    if e_data_type == "ElementType":
+        pass #TODO for CDD
+    elif e_data_type == "SlotType":
+        pass #TODO for CDD
+    elif e_data_type == "ClusterType":
+        defin_str += getClusterType(data_name, ed_id, dt_id, indent)
+    else:
+        raise TypeError(e_data_type + ": is not a valid CCD.definition type.")
+
+    return defin_str
+
+
+
+
 def getCareEntryType(data_name, ct_name, docs, dt_id, e_data_type, indent=0):
     """
     data_name - string to use for data_name
@@ -71,6 +135,71 @@
 
     return defin_str
 
+
+def getDemographicEntryType(data_name, ct_name, docs, dt_id, e_data_type, indent=0):
+    """
+    data_name - string to use for data_name
+    ct_name - uuid string for complexType.name
+    docs - string for documentation
+    dt_id - the uuid for the datatype name
+    e_data_type - ClusterType, ElementType or SlotType - in xls2ccd this is only ClusterType
+    indent - number of spaces to indent first line
+    """
+
+    e_subject_type = "PartySelfType" #TODO for CDD add options for PartyIdentifiedType
+    es_id = str(uuid.uuid4()) #entry-subject id
+    ed_id = str(uuid.uuid4()) #entry-data id
+    defin_str = ''
+    padding = ('').rjust(indent)
+
+    defin_str = '\n\n'+padding.rjust(indent) + ("<xs:complexType name='ct-"+ct_name+"'>\n")
+    defin_str += padding.rjust(indent+2) + ("<xs:complexContent>\n")
+    defin_str += padding.rjust(indent+4) + ("<xs:restriction base='mlhim2:DemographicEntryType'>\n")
+    defin_str += padding.rjust(indent+6) + ("<xs:sequence>\n")
+    #Locatable
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='unbounded' minOccurs='0' ref='mlhim2:links'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:feeder-audit'/>\n")
+    #Entry
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' name='language' type='xs:language' default='en-US'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' name='encoding' type='xs:string' default='utf-8'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:el-"+es_id+"'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:entry-provider'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='unbounded' minOccurs='0' ref='mlhim2:other-participations'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:protocol-id'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' name='current-state' type='xs:string'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:workflow-id'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:attestation'/>\n")
+    defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:el-"+ed_id+"'/>\n")
+
+    defin_str += padding.rjust(indent+6) + ("</xs:sequence>\n")
+    defin_str += padding.rjust(indent+4) + ("</xs:restriction>\n")
+    defin_str += padding.rjust(indent+2) + ("</xs:complexContent>\n")
+    defin_str += padding.rjust(indent) + ("</xs:complexType>\n")
+    defin_str += padding.rjust(indent+2) + ("<xs:element name='el-"+ed_id+"' substitutionGroup='mlhim2:entry-data' type='mlhim2:ct-"+ed_id+"'/>\n")
+    defin_str += padding.rjust(indent+2) + ("<xs:element name='el-"+es_id+"' substitutionGroup='mlhim2:entry-subject' type='mlhim2:ct-"+es_id+"'/>\n")
+
+    if e_subject_type == "PartyIdentifiedType":
+        pass #TODO for CDD
+    elif e_subject_type == "PartySelfType":
+        defin_str += getPartySelfType(es_id,indent)
+    else:
+        print e_subject_type + ": is not a valid DemographicEntry.entry-subject type."
+        exit()
+
+    if e_data_type == "ElementType":
+        pass #TODO for CDD
+    elif e_data_type == "SlotType":
+        pass #TODO for CDD
+    elif e_data_type == "ClusterType":
+        defin_str += getClusterType(data_name, ed_id, dt_id, indent)
+    else:
+        raise TypeError(e_data_type + ": is not a valid CCD.definition type.")
+
+    return defin_str
+
+
+
+
 def getClusterType(data_name, ed_id, dt_id, indent):
     defin_str = ''
     il_id = str(uuid.uuid4()) #items list id