← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 240: Added annotations for enumerations and added a catalog to match title and ccd_id.

 

------------------------------------------------------------
revno: 240
committer: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>
branch nick: cdd
timestamp: Thu 2012-08-30 19:13:51 -0300
message:
  Added annotations for enumerations and added a catalog to match title and ccd_id.
modified:
  src/xls2ccd/xls2ccd.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/xls2ccd.py'
--- src/xls2ccd/xls2ccd.py	2012-08-30 21:40:36 +0000
+++ src/xls2ccd/xls2ccd.py	2012-08-30 22:13:51 +0000
@@ -20,6 +20,11 @@
 wb = open_workbook(xlsfile)
 ccd_dict = {}
 currkey = ''
+n = time.localtime()
+now = "%d-%d-%d" % (n.tm_year, n.tm_mon, n.tm_mday)
+
+ccd_catalog = open('ccd_catalog.txt', 'a')
+ccd_catalog.write('\n====== Appended: ' + str("%d-%d-%d %d:%d" % (n.tm_year, n.tm_mon, n.tm_mday, n.tm_hour, n.tm_min)) +' ======\n')
 
 for s in wb.sheets():
     #print 'Sheet:',s.name
@@ -59,13 +64,12 @@
     ect = "ct_"+str(uuid.uuid4()).replace('-','_')
     dct = "ct_"+str(uuid.uuid4()).replace('-','_')
     schema = ccd_id + ".xsd"
-    n = time.localtime()
-    now = "%d-%d-%d" % (n.tm_year, n.tm_mon, n.tm_mday)
 
     #/ccd setup
     title = ccd_dict[k][0]
     print ""
     print "Generating: "+ title +" --  CCD ID = " + ccd_id
+    ccd_catalog.write('{0:<40}'.format(title) + ccd_id +'\n')
     description = ccd_dict[k][1] + "\n" +"          CDE Version: "+ccd_dict[k][3] + "\n" + "           Datatype: "+ccd_dict[k][5] + "\n"+ "           UOM: "+ccd_dict[k][6] + "\n" + "           Format: "+ccd_dict[k][7]
     date = str(now)
     creator = "Generated by MLHIM xls2ccd.py"
@@ -188,7 +192,13 @@
         """)
         for n in range(8, len(ccd_dict[k])):
             enum = (ccd_dict[k][n][0]).replace("'",'')
+            adoc = (ccd_dict[k][n][1]).replace("'",'') + " : " + (ccd_dict[k][n][2]).replace("'",'')
             f.write("""       <xs:enumeration value='"""+enum+"""'/>
+                                 <xs:annotation>
+                                    <xs:documentation>
+                                      """ + adoc + """
+                                    </xs:documentation>
+                                 </xs:annotation>
             """)
         f.write("""
               </xs:restriction>
@@ -222,6 +232,7 @@
     f.close()
 
 print "\nDone.\n"
+ccd_catalog.close()