mlhim-specs-dev team mailing list archive
-
mlhim-specs-dev team
-
Mailing list archive
-
Message #00729
[Branch ~cdd-dev/cdd/trunk] Rev 255: Reconciled template to schema and made minor mods to xls2ccd.py for 2.4.0
------------------------------------------------------------
revno: 255
committer: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>
branch nick: cdd
timestamp: Fri 2012-09-14 09:44:18 -0300
message:
Reconciled template to schema and made minor mods to xls2ccd.py for 2.4.0
modified:
README.txt
src/xls2ccd/README.txt
src/xls2ccd/xls2ccd.py
templates/CDD-2.4.0.xmt
--
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 'README.txt'
--- README.txt 2012-08-04 11:06:19 +0000
+++ README.txt 2012-09-14 12:44:18 +0000
@@ -1,11 +1,14 @@
-CDD 2.3.0 - Release Date: 2012-08-01
+CDD 2.3.1 - Release Date: 2012-09-09
A graphical tool used to model and output a common XML definition defining constraint definitions for the MLHIM reference model.
-Currently the tool is represented by a template of the MLHIM2 reference model, for the XMind engine. Additionly the CDD is in its early stages as a code generator and is found in the 'src' subdirectory. You can execute the CDD if you have Python 2.6 or later installed. $ python cdd.py
+Currently the tool is represented by a template of the MLHIM2 reference model, for the XMind engine.
+Additionly the CDD is in its early stages as a code generator and is found in the 'src/2.0' subdirectory.
+You can execute the CDD if you have Python 2.6 or later installed and wxPython installed. $ python cdd.py
There is also a cross platform version as well as a Windows version on http://www.hkcr.net
-The CDD manual is under a rewrite at this time. However, an earlier version as well as a document describing how to use the CDD to create a basic CCDare available in the docs subdirectory.
+The CDD manual is under a rewrite at this time. However, an earlier version as well as a document describing how to use the CDD to create a basic CCD
+are available in the docs subdirectory.
=== modified file 'src/xls2ccd/README.txt'
--- src/xls2ccd/README.txt 2012-08-30 20:35:42 +0000
+++ src/xls2ccd/README.txt 2012-09-14 12:44:18 +0000
@@ -20,9 +20,8 @@
Execute the tool with this commandline:
python xls2ccd.py <filename>
-All CCDs created that are not of the CHARACTER or ALPHANUMERIC datatype will be flagged with an "R" as the first character of their filename. These must be reviewed manually before use. When all corrections are made, remove the "R" from the CCD element name and then save the file w/o the "R".
-
-readxls.py is a development tool to explore the files for improvements.
+All CCDs created that are not of the CHARACTER or ALPHANUMERIC datatype will be flagged with an "R" as the first character of their filename.
+These must be reviewed manually before use. When all corrections are made, remove the "R" from the CCD element name and then save the file w/o the "R".
=== modified file 'src/xls2ccd/xls2ccd.py'
--- src/xls2ccd/xls2ccd.py 2012-09-04 13:27:38 +0000
+++ src/xls2ccd/xls2ccd.py 2012-09-14 12:44:18 +0000
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
#xls2ccd.py
#REQUIRES: Python 2.6/2.7 and xlrd
+# Used with MLHIM RM 2.4.0
#This utility is used to create MLHIM CCDs from standard template, XLS downloads from the NCI CDE.
#https://cdebrowser.nci.nih.gov/CDEBrowser/
@@ -15,7 +16,12 @@
import time
from xlrd import open_workbook
-xlsfile = sys.argv[1]
+try:
+ xlsfile = sys.argv[1]
+except:
+ print "Please include the .xls filename on the commandline."
+ exit()
+
wb = open_workbook(xlsfile)
ccd_dict = {}
@@ -26,6 +32,7 @@
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
#print 'Cols.: ',s.ncols
@@ -57,13 +64,14 @@
#print '\n===========================================\n'
#ccd setup
- ccd_id = "ccd_"+str(uuid.uuid4()).replace('-','_')
+ ccd_id = "ccd-"+str(uuid.uuid4())
if ccd_dict[k][5] not in ("CHARACTER","ALPHANUMERIC"):
ccd_id = "R"+ccd_id
- ccdct = "ct_"+str(uuid.uuid4()).replace('-','_')
- ect = "ct_"+str(uuid.uuid4()).replace('-','_')
- dct = "ct_"+str(uuid.uuid4()).replace('-','_')
+ ccdct = "ct-"+str(uuid.uuid4())
+ ect = "ct-"+str(uuid.uuid4())
+ dct = "ct-"+str(uuid.uuid4())
schema = ccd_id + ".xsd"
+ xform = ccd_id + ".xhtml"
#/ccd setup
title = ccd_dict[k][0]
@@ -89,24 +97,44 @@
data_name = title.replace("'",''')
dt = ccd_dict[k][5]
- f = open(schema,'w')
-
- f.write("""<?xml version="1.0" encoding="UTF-8"?>
+ xsd = open(schema,'w')
+ xhtml = open(xform, 'w')
+ xfModel= """
+ <xf:model>"""
+ xfBind = ""
+ xfBody = """
+ </head>
+ <body>
+ <h1>"""+title+"""</h1>
+ <p>Enter the CCD data.</p>
+ """
+ pre = ccd_id + """/definition/DvElement_dv/"""
+ #pre = ""
+ xsd.write("""<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:mlhim2="http://www.mlhim.org/xmls/mlhim2/2_3_1"
+ xmlns:mlhim2="http://www.mlhim.org/xmls/mlhim2/2_4_0"
elementFormDefault="qualified"
- targetNamespace="http://www.mlhim.org/xmls/mlhim2/2_3_1"
+ targetNamespace="http://www.mlhim.org/xmls/mlhim2/2_4_0"
xmlns:data-view="http://www.w3.org/2003/g/data-view#"
data-view:transformation="http://www.mlhim.org/ccd/ccd_md_view.xsl">
<xs:annotation>
<xs:appinfo>
""")
- f.write("""
+ xhtml.write("""<?xml version="1.0" encoding="UTF-8"?>
+<html
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:mlhim2="http://www.mlhim.org/xmls/mlhim2/2_4_0"
+ xmlns:ev="http://www.w3.org/2001/xml-events"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xf="http://www.w3.org/2002/xforms">
+ <head>""")
+
+ xsd.write("""
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc= "http://purl.org/dc/elements/1.1/">
- <rdf:Description rdf:about="http://www.mlhim.org/ccd/""" + ccd_id + """">
+ <rdf:Description rdf:about="http://www.hkcr.net/ccd/""" + ccd_id + """">
<dc:title>"""+title+"""</dc:title>
<dc:creator>"""+creator+"""</dc:creator>
<dc:contributor>"""+contributor+"""</dc:contributor>
@@ -127,7 +155,7 @@
</xs:appinfo>
</xs:annotation>
- <xs:include schemaLocation="http://www.mlhim.org/xmls/mlhim2/2_3_1/mlhim2.xsd"/>
+ <xs:include schemaLocation="http://www.mlhim.org/xmls/mlhim2/2_4_0/mlhim2.xsd"/>
<xs:element name='"""+ccd_id+"""' type="mlhim2:"""+ccdct+""""/>
@@ -152,8 +180,22 @@
</xs:complexType>
""")
+ xhtml.write("""
+ <title>"""+title+"""</title>
+ <style type="text/css">
+ @namespace xf url("http://www.w3.org/2002/xforms");
+ body {font-family:Helvetica, sans-serif;}
+ </style>""")
+
+ xfModel += ("""
+ <xf:instance xmlns="">
+ <"""+ccd_id+""">
+ <definition>
+ <DvElement_dv>\n""")
+
+
if dt == "DATE":
- f.write("""
+ xsd.write("""
<xs:complexType name='"""+dct+"""'>
<xs:complexContent>
<xs:restriction base="mlhim2:DvDateType">
@@ -165,9 +207,15 @@
</xs:complexContent>
</xs:complexType>
""")
+ xfModel += (""" <data_name>"""+data_name+"""</data_name>\n""")
+ xfModel += (""" <DvDate_dv></DvDate_dv>\n""")
+ xfBody += (""" <xf:input ref='"""+pre+"""DvDate_dv'>
+ <xf:label>Date: </xf:label>
+ </xf:input>
+ """)
elif dt == "TIME":
- f.write("""
+ xsd.write("""
<xs:complexType name='"""+dct+"""'>
<xs:complexContent>
<xs:restriction base="mlhim2:DvTimeType">
@@ -180,21 +228,48 @@
</xs:complexType>
""")
+ xfModel += (""" <data_name>"""+data_name+"""</data_name>\n""")
+ xfModel += (""" <DvTime_dv></DvTime_dv>\n""")
+ xfBody += (""" <xf:input ref='"""+pre+"""DvTime_dv'>
+ <xf:label>Time: </xf:label>
+ </xf:input>
+ """)
+
elif dt == "NUMBER":
- f.write("""
+ xsd.write("""
<xs:complexType name='"""+dct+"""'>
<xs:complexContent>
- <xs:restriction base="mlhim2:Dv*****Type"> <!-- This will require a DvCount, DvQuantity or other numeric type. Add elements inside the sequence, below data_name, as required. -->
+ <xs:restriction base="mlhim2:DvCountType"> <!-- This will require a DvCount, DvQuantity or other numeric type. Add elements inside the sequence, below data_name, as required. -->
<xs:sequence>
<xs:element name="data_name" minOccurs="1" maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
+ <xs:element name="magnitude" minOccurs="1" maxOccurs="1" type="xs:decimal"/>
+ <xs:element name="error" minOccurs="1" maxOccurs="1" type="xs:int"/>
+ <xs:element maxOccurs="1" minOccurs="1" name="DvCount_units" type="xs:string"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
""")
+ xfModel += (""" <data_name>"""+data_name+"""</data_name>\n""")
+ xfModel += (""" <magnitude></magnitude>\n""")
+ xfModel += (""" <error></error>\n""")
+ xfModel += (""" <DvCount_units></DvCount_units>\n""")
+ xfBody += (""" <xf:input ref='"""+pre+"""DvCount_units'>
+ <xf:label>Units Counted: </xf:label>
+ </xf:input>
+ """)
+ xfBody += (""" <xf:input ref='"""+pre+"""magnitude'>
+ <xf:label>Quantity: </xf:label>
+ </xf:input>
+ """)
+ xfBody += (""" <xf:input ref='"""+pre+"""error'>
+ <xf:label>Error: </xf:label>
+ <xf:hint>An integer representing the % of error.</xf:hint>
+ </xf:input>
+ """)
elif len(ccd_dict[k]) > 8:
- f.write("""
+ xsd.write("""
<xs:complexType name='"""+dct+"""'>
<xs:complexContent>
<xs:restriction base="mlhim2:DvStringType">
@@ -207,7 +282,7 @@
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+"""'>
+ xsd.write(""" <xs:enumeration value='"""+enum+"""'>
<xs:annotation>
<xs:documentation>
""" + adoc + """
@@ -215,7 +290,7 @@
</xs:annotation>
</xs:enumeration>
""")
- f.write("""
+ xsd.write("""
</xs:restriction>
</xs:simpleType>
</xs:element>
@@ -225,10 +300,16 @@
</xs:complexType>
""")
+ xfModel += (""" <data_name>"""+data_name+"""</data_name>\n""")
+ xfModel += (""" <DvString_dv></DvString_dv>\n""")
+ xfBody += (""" <xf:input ref='"""+pre+"""DvString_dv'>
+ <xf:label>String: </xf:label>
+ </xf:input>
+ """)
else:
- f.write("""
+ xsd.write("""
<xs:complexType name='"""+dct+"""'>
<xs:complexContent>
<xs:restriction base="mlhim2:DvStringType">
@@ -240,11 +321,34 @@
</xs:complexContent>
</xs:complexType>
""")
+ xfModel += (""" <data_name>"""+data_name+"""</data_name>\n""")
+ xfModel += (""" <DvString_dv></DvString_dv>\n""")
+ xfBody += (""" <xf:input ref='"""+pre+"""DvString_dv'>
+ <xf:label>String: </xf:label>
+ </xf:input>
+ """)
- f.write("""
+ xsd.write("""
</xs:schema>""")
- f.close()
+ xfModel += (""" </DvElement_dv>
+ </definition>
+ </"""+ccd_id+""">
+ </xf:instance>\n""")
+ xfModel += xfBind
+ xfModel += (""" </xf:model>""")
+
+ xfBody += ("""
+ </body>
+</html>
+ """)
+
+ xhtml.write(xfModel)
+ xhtml.write(xfBody)
+
+ xsd.close()
+ xhtml.close()
+
print "\nDone.\n"
ccd_catalog.close()
=== modified file 'templates/CDD-2.4.0.xmt'
Binary files templates/CDD-2.4.0.xmt 2012-09-08 15:35:08 +0000 and templates/CDD-2.4.0.xmt 2012-09-14 12:44:18 +0000 differ