mlhim-specs-dev team mailing list archive
-
mlhim-specs-dev team
-
Mailing list archive
-
Message #00747
[Branch ~cdd-dev/cdd/trunk] Rev 267: Added CareEntry demo to xls2ccd and added a cluster-example for more complex CCD building.
------------------------------------------------------------
revno: 267
committer: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>
branch nick: cdd
timestamp: Wed 2012-09-26 16:50:07 -0300
message:
Added CareEntry demo to xls2ccd and added a cluster-example for more complex CCD building.
removed:
src/ccd2hkcr/ccd2hkcr.cfg
src/xls2ccd/examples/Physical Exam/
src/xls2ccd/examples/Physical Exam/Physical Examination_NCI Standard_Template 08_03_2012.xls
src/xls2ccd/readxls.py
added:
src/xls2ccd/examples/Demography/original-Demography_NCI_Standard_Template 06_29_2012.xls
src/xls2ccd/examples/cluster-example/
src/xls2ccd/examples/cluster-example/HOWTO-Cluster-example.txt
src/xls2ccd/examples/cluster-example/ccd-f9493153-8960-4974-8725-3bf824319ac8.xsd
modified:
src/ccd2hkcr/ccd2hkcr.py
src/xls2ccd/README.txt
src/xls2ccd/mlhim2RM.py
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
=== removed file 'src/ccd2hkcr/ccd2hkcr.cfg'
--- src/ccd2hkcr/ccd2hkcr.cfg 2012-09-24 18:47:56 +0000
+++ src/ccd2hkcr/ccd2hkcr.cfg 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-# Enter your HKCR.net username and password, e.g. host: www.hkcr.net/HKCR
-# do not remove the text to the left of the ':', do not add/delete any lines.
-host:localhost:8080/Plone
-user:admin
-password:abc123
=== modified file 'src/ccd2hkcr/ccd2hkcr.py'
--- src/ccd2hkcr/ccd2hkcr.py 2012-09-24 18:47:56 +0000
+++ src/ccd2hkcr/ccd2hkcr.py 2012-09-26 19:50:07 +0000
@@ -20,14 +20,19 @@
ccd_dir = sys.argv[1]
os.path.isdir(ccd_dir) == True
except:
- print "Please include the absolute path to the CCDs/XMTs on the commandline."
- print "e.g. /home/mydir/my_ccd_dir"
+ print "Please include the absolute path to the CCDs/XMTs directory on the commandline."
+ print "e.g. ~/xls2ccd"
exit()
if os.path.isdir(ccd_dir) == False:
print "\n\n********>>> "+ ccd_dir + " is not a valid directory.\n\n"
exit()
+try:
+ PUSH = sys.argv[2]
+except:
+ PUSH = '' # if 'FAKEIT' on the cmd line, no actual post operation will occur.
+
file_list = os.listdir(ccd_dir)
ccd_list =[]
@@ -36,7 +41,7 @@
for x in file_list:
if 'ccd-' in x and '.xsd' in x:
ccd_list.append(x)
- if '.xmt' in x:
+ elif '.xmt' in x:
xmt_list.append(x)
#read from ccd2hkcr.cfg file
@@ -50,18 +55,32 @@
print "\nConnecting to: "+host+ " as " + user+"\n"
client = ServerProxy('http://'+user+':'+password+'@'+host)
-my_folder = '/Members/'+user
+
+
+print client
+
+my_folder = 'Members/'+user
now = datetime.now()
-if ccd_list:
+if len(ccd_list) > 0:
for filename in ccd_list:
- # validate using ??????, if not valid skip to next file
- #TODO
- f = open(filename,'r')
+ f = open(ccd_dir+'/'+filename,'r')
ccd_file = f.read()
f.close()
+ ## Do some simple tests to see if it is a CCD.
+ #print "\n\n Testing "+filename+" for CCD file format validity."
+ #invalid = False
+ #if '<xs:include schemaLocation="http://www.mlhim.org/xmlns/mlhim2/2_4_0/mlhim2.xsd"/>' not in ccd_file: invalid = True
+ #if '<dc:type>MLHIM Concept Constraint Definition (CCD)</dc:type>' not in ccd_file: invalid = True
+ #if '</xs:schema>' not in ccd_file: invalid = True
+ #if '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mlhim2="http://www.mlhim.org/xmlns/mlhim2/2_4_0"' not in ccd_file: invalid = True
+
+ #if invalid == True:
+ #print "\n"+filename + ": does not appear to be a valid CCD.\n\n"
+ ##continue
+
#Search ccd_file and get metadata
begin = ccd_file.find('<dc:title>') + len('<dc:title>')
end = ccd_file.find('</dc:title>')
@@ -114,6 +133,8 @@
xmlrpc_dc_date = DateTime(dc_date)
push_location = my_folder+'/'+filename
+
+
#build object
ccd_object = {'file': ccd_file,
'title':filename,
@@ -133,14 +154,17 @@
'excludeFromNav': False,
'id':filename,
'location': dc_coverage}
+ if PUSH != "FAKEIT":
+ print "Sending: "+ dc_title + ' -- '+filename + ' to '+ push_location
+ client.post_object({push_location:[ccd_object, 'File']})
+ else:
+ print "Fake Sending: "+ dc_title + ' -- '+filename
- print "Sending: "+ dc_title + ' -- '+filename
- client.post_object({push_location:[ccd_object, 'File']})
else:
- print "You have no CCDs in: ", os.getcwd()
-
-
-if xmt_list:
+ print "\n\nYou have no CCDs in: ", ccd_dir
+
+
+if len(xmt_list) > 0:
for filename in xmt_list:
f = open(filename,'r')
xmt_file = Binary(f.read())
@@ -152,6 +176,7 @@
print "Storing: "+filename
client.post_object({push_location:[xmt_object, 'File']})
else:
- print "You have no CCD Templates in: ", os.getcwd()
-
-print "\n\nCCD/XMT Processing complete.\n\n"
\ No newline at end of file
+ print "\n\nYou have no CCD (XMind) Templates in: ", ccd_dir
+
+print "\n\nCCD/XMT Processing complete.\n\n"
+
=== modified file 'src/xls2ccd/README.txt'
--- src/xls2ccd/README.txt 2012-09-23 11:57:38 +0000
+++ src/xls2ccd/README.txt 2012-09-26 19:50:07 +0000
@@ -36,10 +36,14 @@
how to use these in the context of creating larger, more common concept definitions.
Execute the tool with this commandline:
-python [path/to/]xls2ccd.py <filename>
-
-replace the [path/to/] with the path to where you extracted xls2ccd.py
-and the filename with the name you used to save your spreadsheet.
+python xls2ccd.py [path/to/filename]
+
+replace the [path/to/filename] with the path/filename to where your spreadsheet is located.
+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
+
========= EXAMPLES ===========
@@ -51,6 +55,14 @@
The file MLHIM_Std_Template-NCI-Demographics.xls shows the results of pasting the original data into the MLHIM template and
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.
+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
+Clusters, Elements or Slots to your Cluster. There is a short text file in the cluster-example folder that
+discusses some of the options available to the developer.
+----------------------------------------------------------------------------------------------------------------
Direct all questions to:
Preferred: https://launchpad.net/~mlhim-owners mailing list.
=== added file 'src/xls2ccd/examples/Demography/original-Demography_NCI_Standard_Template 06_29_2012.xls'
Binary files src/xls2ccd/examples/Demography/original-Demography_NCI_Standard_Template 06_29_2012.xls 1970-01-01 00:00:00 +0000 and src/xls2ccd/examples/Demography/original-Demography_NCI_Standard_Template 06_29_2012.xls 2012-09-26 19:50:07 +0000 differ
=== removed directory 'src/xls2ccd/examples/Physical Exam'
=== removed file 'src/xls2ccd/examples/Physical Exam/Physical Examination_NCI Standard_Template 08_03_2012.xls'
Binary files src/xls2ccd/examples/Physical Exam/Physical Examination_NCI Standard_Template 08_03_2012.xls 2012-09-15 22:10:45 +0000 and src/xls2ccd/examples/Physical Exam/Physical Examination_NCI Standard_Template 08_03_2012.xls 1970-01-01 00:00:00 +0000 differ
=== added directory 'src/xls2ccd/examples/cluster-example'
=== added file 'src/xls2ccd/examples/cluster-example/HOWTO-Cluster-example.txt'
--- src/xls2ccd/examples/cluster-example/HOWTO-Cluster-example.txt 1970-01-01 00:00:00 +0000
+++ src/xls2ccd/examples/cluster-example/HOWTO-Cluster-example.txt 2012-09-26 19:50:07 +0000
@@ -0,0 +1,36 @@
+To create multiple items for a RM element. Such as in 'items' for a ClusterType.
+See ccd-f9493153-8960-4974-8725-3bf824319ac8 as a Cluster Example.
+
+You generally will want only one 'set' of items and therefore should restrict 'items' maxoccurs to 1.
+Change the items element to a reference like this:
+<xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-013f4560-9b34-4081-9162-e58245cec514"/>
+
+Then reference a complexType like this:
+<xs:element name="el-013f4560-9b34-4081-9162-e58245cec514" substitutionGroup="mlhim2:items" type="mlhim2:ct-013f4560-9b34-4081-9162-e58245cec514"/>
+Note the substitutionGroup.
+
+The actual items list is then built out of a complexType like this:
+ <!--Cluster Items List-->
+ <xs:complexType name="ct-013f4560-9b34-4081-9162-e58245cec514">
+ <xs:complexContent>
+ <xs:extension base="mlhim2:ItemType">
+ <xs:sequence>
+ <xs:element maxOccurs="2" minOccurs="1" ref="mlhim2:el-62116dd0-9942-4f28-b2b3-4a90d29cbf49"/>
+ <xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-abe678a9-8f30-4c5a-9f7a-6fe3e927f303"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="el-62116dd0-9942-4f28-b2b3-4a90d29cbf49" substitutionGroup="mlhim2:Item" type="mlhim2:ct-62116dd0-9942-4f28-b2b3-4a90d29cbf49"/>
+ <xs:element name="el-abe678a9-8f30-4c5a-9f7a-6fe3e927f303" substitutionGroup="mlhim2:Item" type="mlhim2:ct-abe678a9-8f30-4c5a-9f7a-6fe3e927f303"/>
+
+Notice the substitutionGroup(s) and the ct- xxxxxx must be Element, Slot or Cluster.
+
+Also notice that you now have the flexability to use as many occurences of each element as desired. In the first element we set it
+to two. Though in most sensible cases there will only be maxOccurs of 1. (Use Cases ?????)
+
+
+
+
+
+
\ No newline at end of file
=== added file 'src/xls2ccd/examples/cluster-example/ccd-f9493153-8960-4974-8725-3bf824319ac8.xsd'
--- src/xls2ccd/examples/cluster-example/ccd-f9493153-8960-4974-8725-3bf824319ac8.xsd 1970-01-01 00:00:00 +0000
+++ src/xls2ccd/examples/cluster-example/ccd-f9493153-8960-4974-8725-3bf824319ac8.xsd 2012-09-26 19:50:07 +0000
@@ -0,0 +1,174 @@
+<?xml version="1.1" encoding="UTF-8"?>
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mlhim2="http://www.mlhim.org/xmlns/mlhim2/2_4_0"
+ elementFormDefault="qualified" targetNamespace="http://www.mlhim.org/xmlns/mlhim2/2_4_0">
+
+ <xs:annotation>
+ <xs:documentation source="http://www.mlhim.org" xml:lang="en-US"> This is a Cluster Example Concept Constraint
+ Definition schema file (CCD). <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.hkcr.net/ccd/ccd-f9493153-8960-4974-8725-3bf824319ac8">
+ <dc:title>Cluster Example</dc:title>
+ <dc:creator>Timothy W. Cook <timothywayne.cook@xxxxxxxxx> </dc:creator>
+ <dc:contributor>None</dc:contributor>
+ <dc:subject>Cluster CCD; Example</dc:subject>
+ <dc:source>My Brain</dc:source>
+ <dc:rights>CC-BY http://creativecommons.org/licenses/by/3.0/</dc:rights>
+ <dc:relation>None</dc:relation>
+ <dc:coverage>Universal</dc:coverage>
+ <dc:type>MLHIM Concept Constraint Definition (CCD)</dc:type>
+ <dc:identifier>ccd-f9493153-8960-4974-8725-3bf824319ac8</dc:identifier>
+ <dc:description>Experimental Cluster CCD</dc:description>
+ <dc:publisher>MLHIM</dc:publisher>
+ <dc:date>2012-08-24</dc:date>
+ <dc:format>text/xml</dc:format>
+ <dc:language>en-US</dc:language>
+ </rdf:Description>
+ </rdf:RDF>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:include schemaLocation="http://www.mlhim.org/xmlns/mlhim2/2_4_0/mlhim2.xsd"/>
+
+ <xs:element name="ccd-f9493153-8960-4974-8725-3bf824319ac8" type="mlhim2:ct-a575df1d-20fd-4d65-aba3-4ad550cd7230"/>
+
+ <xs:complexType name="ct-a575df1d-20fd-4d65-aba3-4ad550cd7230">
+ <xs:complexContent>
+ <xs:restriction base="mlhim2:CCDType">
+ <xs:sequence>
+ <xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-8f1c16bb-a00c-4858-80c9-762299516191"/>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="el-8f1c16bb-a00c-4858-80c9-762299516191" substitutionGroup="mlhim2:definition"
+ type="mlhim2:ct-8f1c16bb-a00c-4858-80c9-762299516191"/>
+
+ <xs:complexType name="ct-8f1c16bb-a00c-4858-80c9-762299516191">
+ <xs:complexContent>
+ <xs:restriction base="mlhim2:ClusterType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" ref="mlhim2:links"/>
+ <xs:element maxOccurs="1" minOccurs="0" ref="mlhim2:feeder-audit"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="annotation" type="xs:string"/>
+ <xs:element maxOccurs="1" minOccurs="1" name="cluster-subject" type="xs:string"
+ fixed="CareEntry Cluster"/>
+ <xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-013f4560-9b34-4081-9162-e58245cec514"/>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="el-013f4560-9b34-4081-9162-e58245cec514" substitutionGroup="mlhim2:items" type="mlhim2:ct-013f4560-9b34-4081-9162-e58245cec514"/>
+
+
+ <!--Cluster Items List-->
+ <xs:complexType name="ct-013f4560-9b34-4081-9162-e58245cec514">
+ <xs:complexContent>
+ <xs:extension base="mlhim2:ItemType">
+ <xs:sequence>
+ <xs:element maxOccurs="2" minOccurs="1" ref="mlhim2:el-62116dd0-9942-4f28-b2b3-4a90d29cbf49"/>
+ <xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-abe678a9-8f30-4c5a-9f7a-6fe3e927f303"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="el-62116dd0-9942-4f28-b2b3-4a90d29cbf49" substitutionGroup="mlhim2:Item" type="mlhim2:ct-62116dd0-9942-4f28-b2b3-4a90d29cbf49"/>
+ <xs:element name="el-abe678a9-8f30-4c5a-9f7a-6fe3e927f303" substitutionGroup="mlhim2:Item" type="mlhim2:ct-abe678a9-8f30-4c5a-9f7a-6fe3e927f303"/>
+
+
+ <!--Element One-->
+ <xs:complexType name="ct-62116dd0-9942-4f28-b2b3-4a90d29cbf49">
+ <xs:complexContent>
+ <xs:restriction base="mlhim2:ElementType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" ref="mlhim2:links"/>
+ <xs:element maxOccurs="1" minOccurs="0" ref="mlhim2:feeder-audit"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="annotation" type="xs:string"/>
+ <xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-12ff0b58-3bd3-41b6-93a2-866e16d3ce2c"/>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="el-12ff0b58-3bd3-41b6-93a2-866e16d3ce2c" substitutionGroup="mlhim2:Element-dv"
+ type="mlhim2:ct-12ff0b58-3bd3-41b6-93a2-866e16d3ce2c"/>
+
+
+ <xs:complexType name="ct-12ff0b58-3bd3-41b6-93a2-866e16d3ce2c">
+ <xs:complexContent>
+ <xs:restriction base="mlhim2:DvStringType">
+ <xs:sequence>
+ <xs:element maxOccurs="1" minOccurs="1" name="data-name" type="xs:string" fixed="Gender"/>
+ <xs:element maxOccurs="1" minOccurs="0" ref="mlhim2:ExceptionalValue"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="valid-time-begin" type="xs:dateTime"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="valid-time-end" type="xs:dateTime"/>
+ <xs:element maxOccurs="1" minOccurs="1" name="DvString-dv">
+ <xs:annotation>
+ <xs:documentation> Person Gender Text Type </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Female">
+ <xs:annotation>
+ <xs:documentation> Female </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="Male">
+ <xs:annotation>
+ <xs:documentation> Male </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="Unknown">
+ <xs:annotation>
+ <xs:documentation> Unknown </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="Unspecified">
+ <xs:annotation>
+ <xs:documentation> Unspecified </xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <!--Element Two-->
+
+ <xs:complexType name="ct-abe678a9-8f30-4c5a-9f7a-6fe3e927f303">
+ <xs:complexContent>
+ <xs:restriction base="mlhim2:ElementType">
+ <xs:sequence>
+ <xs:element maxOccurs="1" minOccurs="1" ref="mlhim2:el-1a013198-3d18-4865-8107-25e09575d4cf"/>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="el-1a013198-3d18-4865-8107-25e09575d4cf" substitutionGroup="mlhim2:Element-dv"
+ type="mlhim2:ct-1a013198-3d18-4865-8107-25e09575d4cf"/>
+
+
+ <xs:complexType name="ct-1a013198-3d18-4865-8107-25e09575d4cf">
+ <xs:complexContent>
+ <xs:restriction base="mlhim2:DvTimeType">
+ <xs:sequence>
+ <xs:element maxOccurs="1" minOccurs="1" name="data-name" type="xs:string" fixed="Start Time"/>
+ <xs:element maxOccurs="1" minOccurs="0" ref="mlhim2:ExceptionalValue"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="valid-time-begin" type="xs:dateTime"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="valid-time-end" type="xs:dateTime"/>
+ <xs:element maxOccurs="1" minOccurs="0" ref="mlhim2:normal-range"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" ref="mlhim2:other-reference-ranges"/>
+ <xs:element maxOccurs="1" minOccurs="0" name="normal-status" type="xs:string"/>
+ <xs:element maxOccurs="1" minOccurs="1" name="DvTime-dv" type="xs:time">
+ <xs:annotation>
+ <xs:documentation> Start Time of Event </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+</xs:schema>
=== modified file 'src/xls2ccd/mlhim2RM.py'
--- src/xls2ccd/mlhim2RM.py 2012-09-23 18:19:22 +0000
+++ src/xls2ccd/mlhim2RM.py 2012-09-26 19:50:07 +0000
@@ -214,7 +214,7 @@
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:EntryType'>\n")
+ defin_str += padding.rjust(indent+4) + ("<xs:restriction base='mlhim2:CareEntryType'>\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")
@@ -241,7 +241,7 @@
if e_subject_type == "PartyIdentifiedType":
pass #TODO for CDD
elif e_subject_type == "PartySelfType":
- defin_str += getPartSelfType(indent)
+ defin_str += getPartySelfType(es_id,indent)
else:
print e_subject_type + ": is not a valid CareEntry.entry-subject type."
exit()
@@ -255,10 +255,50 @@
else:
raise TypeError(e_data_type + ": is not a valid CCD.definition type.")
- return(defin_str)
-
-def getClusterType(data_name, edid, dt_id, indent):
- return "\n\n<!-- ClusterType -->\n\n"
+ return defin_str
+
+def getClusterType(data_name, ed_id, dt_id, indent):
+ defin_str = ''
+ il_id = str(uuid.uuid4()) #items list id
+ et_id = str(uuid.uuid4()) #ElementType id
+
+ padding = ('').rjust(indent)
+ defin_str += '\n\n'+padding.rjust(indent) + ("<xs:complexType name='ct-"+ed_id+"'>\n")
+ defin_str += padding.rjust(indent+2) + ("<xs:complexContent>\n")
+ defin_str += padding.rjust(indent+4) + ("<xs:restriction base='mlhim2:ClusterType'>\n")
+ defin_str += padding.rjust(indent+6) + ("<xs:sequence>\n")
+ 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")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' name='annotation' type='xs:string'/>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' name='cluster-subject' type='xs:string' fixed='CareEntry Cluster'/>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:el-"+il_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) + ("<xs:element name='el-"+il_id+"' substitutionGroup='mlhim2:items' type='mlhim2:ct-"+il_id+"'/>\n\n")
+
+ defin_str += padding.rjust(indent) + ("<!-- Cluster Items List - Additional ItemType subtypes may be added here.-->\n")
+ defin_str += padding.rjust(indent) + ("<xs:complexType name='ct-"+il_id+"'>\n")
+ defin_str += padding.rjust(indent+2) + ("<xs:complexContent>\n")
+ defin_str += padding.rjust(indent+4) + ("<xs:extension base='mlhim2:ItemType'>\n")
+ defin_str += padding.rjust(indent+6) + ("<xs:sequence>\n")
+
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:el-"+et_id+"'/>\n")
+ defin_str += padding.rjust(indent+6) + ("</xs:sequence>\n")
+ defin_str += padding.rjust(indent+4) + ("</xs:extension>\n")
+ defin_str += padding.rjust(indent+2) + ("</xs:complexContent>\n")
+ defin_str += padding.rjust(indent) + ("</xs:complexType>\n")
+ defin_str += padding.rjust(indent) + ("<xs:element name='el-"+et_id+"' substitutionGroup='mlhim2:Item' type='mlhim2:ct-"+et_id+"'/>\n\n")
+
+ defin_str += getElementType(et_id, dt_id, indent)
+
+ return defin_str
+
+
+
+
+
def getDvBooleanType(data_name, ct_name, bool_values, docs, indent=0):
"""
@@ -758,8 +798,36 @@
return defin_str
-def getPartSelfType(indent):
- return "\n\n<!-- PartySelfType -->\n\n"
+def getPartIdentifiedType(es_id, indent):
+ defin_str = ''
+ padding = ('').rjust(indent)
+ defin_str += '\n\n'+padding.rjust(indent) + ("<xs:complexType name='ct-"+es_id+"'>\n")
+ defin_str += padding.rjust(indent+2) + ("<xs:complexContent>\n")
+ defin_str += padding.rjust(indent+4) + ("<xs:restriction base='mlhim2:PartyIdentifiedType'>\n")
+ defin_str += padding.rjust(indent+6) + ("<xs:sequence>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:links'/>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:feeder-audit'/>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' name='party-name' type='xs:string'/>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='0' ref='mlhim2:external-ref'/>\n")
+ defin_str += padding.rjust(indent+8) + ("<xs:element maxOccurs='1' minOccurs='1' ref='mlhim2:details'/>\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")
+
+ return defin_str
+
+
+def getPartySelfType(es_id, indent):
+ defin_str = ''
+ padding = ('').rjust(indent)
+ defin_str += '\n\n'+padding.rjust(indent) + ("<xs:complexType name='ct-"+es_id+"'>\n")
+ defin_str += padding.rjust(indent+2) + ("<xs:complexContent>\n")
+ defin_str += padding.rjust(indent+4) + ("<xs:extension base='mlhim2:PartySelfType'/>\n")
+ defin_str += padding.rjust(indent+2) + ("</xs:complexContent>\n")
+ defin_str += padding.rjust(indent) + ("</xs:complexType>\n")
+
+ return defin_str
def getReferenceRangeType(data_name, ct_name, rr_def, dvi_list, docs, indent):
"""
@@ -797,4 +865,4 @@
dt_str += getDvIntervalType(data_name, dvi_id, docs, indent, dvi_list)
- return dt_str
+ return dt_str
\ No newline at end of file
=== removed file 'src/xls2ccd/readxls.py'
--- src/xls2ccd/readxls.py 2012-08-30 16:40:52 +0000
+++ src/xls2ccd/readxls.py 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-import sys
-
-from xlrd import open_workbook
-
-xlsfile = sys.argv[1]
-
-wb = open_workbook(xlsfile)
-ccd_dict = {}
-currkey = ''
-
-for s in wb.sheets():
- print 'Sheet:',s.name
- print 'Cols.: ',s.ncols
- print 'Rows: ', s.nrows
- for row in range(s.nrows):
- values = []
- for col in range(s.ncols):
- values.append(s.cell(row,col).value)
- if values[0]:
- currkey = values[0]
- ccd_dict[currkey] = [values[0],values[1],values[2],values[3],values[4],values[5],values[6],values[7]]
- elif currkey:
- if values[8]:
- ccd_dict[currkey].append((values[8],values[9],values[10]))
-
-for k in ccd_dict.keys():
- size = len(ccd_dict[k])
- print "Title: "+ccd_dict[k][0]
- #print "Description: "+ccd_dict[k][1]
- #print "Public ID: "+ccd_dict[k][2]
- #print "CDE Version: "+ccd_dict[k][3]
- #print ": "+ccd_dict[k][4]
- print "Datatype: "+ccd_dict[k][5]
- print "UOM: "+ccd_dict[k][6]
- print "Format: "+ccd_dict[k][7]
- #if size > 8:
- #for n in range(8,size):
- #print "Enumeration: ", ccd_dict[k][n]
- print '\n===========================================\n'
\ No newline at end of file
=== modified file 'src/xls2ccd/xls2ccd.py'
--- src/xls2ccd/xls2ccd.py 2012-09-23 18:19:22 +0000
+++ src/xls2ccd/xls2ccd.py 2012-09-26 19:50:07 +0000
@@ -4,7 +4,8 @@
#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.
+#This utility is used to create MLHIM CCDs from standard template,
+#.xls downloads from the NCI CDE.
#https://cdebrowser.nci.nih.gov/CDEBrowser/
#Some pre-processing is required. See the README.txt for details.
@@ -21,7 +22,7 @@
try:
xlsfile = sys.argv[1]
except:
- print "\n\nPlease include a valid .xls filename on the commandline.\n\n"
+ print "\n\nPlease include a valid path/filename for the .xls file, on the commandline.\n\n"
exit()
try:
@@ -79,7 +80,7 @@
elif values[25] != '': #DvBoolean true/false values
bool_vals.append((values[25],values[26]))
- if values[27]:
+ if values[27]: #Is there an EntryType?
ccd_dict[currkey][19].append(values[27])
for k in ccd_dict.keys():
@@ -122,7 +123,7 @@
#MLHIM DataType
dt_id = str(uuid.uuid4())
- if ccd_dict[k][19]:
+ if ccd_dict[k][19]: #Use the EntryType as the definition, otherwise make it an ElementType
defin_type = ccd_dict[k][19]
else:
defin_type = ["ElementType"]