← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 238: Corrected formatting error in generated header.

 

------------------------------------------------------------
revno: 238
committer: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>
branch nick: cdd
timestamp: Thu 2012-08-30 17:35:42 -0300
message:
  Corrected formatting error in generated header.
modified:
  src/xls2ccd/README.txt
  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/README.txt'
--- src/xls2ccd/README.txt	2012-08-30 16:40:52 +0000
+++ src/xls2ccd/README.txt	2012-08-30 20:35:42 +0000
@@ -6,10 +6,10 @@
 
 Some pre-processing is required. 
 
-Download a set of CDEs in Excel format using the "Available Downloads" link near the top-right of the page. 
+Download a set of CDEs in .xls format using the "Available Downloads" link near the top-right of the page. 
 Select the set you want to convert from the links available on the "caDSR CDE Downloads" page.
 
-Be sure that the filename contains "NCI_Standard_Template (MM)_(DD)_2012".  Other formats have not been tested.  Please let us know which dates of the Standard TEmplate works for you.
+Be sure that the filename contains "NCI_Standard_Template (MM)_(DD)_2012".  Other formats have not been tested.  Please let us know which dates of the Standard Template works for you.
 
 Open the spreadsheet.  
 Delete rows 1 - 10.
@@ -20,7 +20,7 @@
 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 thier 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".
+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. 
 

=== modified file 'src/xls2ccd/xls2ccd.py'
--- src/xls2ccd/xls2ccd.py	2012-08-30 16:40:52 +0000
+++ src/xls2ccd/xls2ccd.py	2012-08-30 20:35:42 +0000
@@ -1,5 +1,14 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
+#xls2ccd.py
+#REQUIRES: Python 2.6/2.7 and xlrd
+
+#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.
+#Copyright 2012, Timothy W. Cook and Contributors.
+
 
 import sys
 import uuid
@@ -76,72 +85,63 @@
 
     f = open(schema,'w')
 
-    f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
-
-    f.write("""
-
-    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema#";
-          xmlns:mlhim2="http://www.mlhim.org/xmls/mlhim2/2_3_1";
-          elementFormDefault="qualified"
-          targetNamespace="http://www.mlhim.org/xmls/mlhim2/2_3_1";
-          xmlns:data-view="http://www.w3.org/2003/g/data-view#";
-          data-view:transformation="http://www.mlhim.org/ccd/ccd_md_view.xsl";>
+    f.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";
+           elementFormDefault="qualified"
+           targetNamespace="http://www.mlhim.org/xmls/mlhim2/2_3_1";
+           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>
-     """)
-
+        <xs:appinfo>
+        """)
     f.write("""
-       This is a """+title+""" 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.mlhim.org/ccd/"""; + ccd_id + """">
-      <dc:title>"""+title+"""</dc:title>
-      <dc:creator>"""+creator+"""</dc:creator>
-      <dc:contributor>"""+contributor+"""</dc:contributor>
-      <dc:subject>"""+subject+"""</dc:subject>
-      <dc:source>"""+source+"""</dc:source>
-      <dc:rights>"""+rights+"""</dc:rights>
-      <dc:relation>"""+relation+"""</dc:relation>
-      <dc:coverage>"""+coverage+"""</dc:coverage>
-      <dc:type>"""+resource_type+"""</dc:type>
-      <dc:identifier>"""+identifier+"""</dc:identifier>
-      <dc:description>"""+description+"""</dc:description>
-      <dc:publisher>"""+publisher+"""</dc:publisher>
-      <dc:date>"""+date+"""</dc:date>
-      <dc:format>"""+resource_format+"""</dc:format>
-      <dc:language>"""+language+"""</dc:language>
-    </rdf:Description>
-
-    </rdf:RDF>
+       <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 + """">
+        <dc:title>"""+title+"""</dc:title>
+        <dc:creator>"""+creator+"""</dc:creator>
+        <dc:contributor>"""+contributor+"""</dc:contributor>
+        <dc:subject>"""+subject+"""</dc:subject>
+        <dc:source>"""+source+"""</dc:source>
+        <dc:rights>"""+rights+"""</dc:rights>
+        <dc:relation>"""+relation+"""</dc:relation>
+        <dc:coverage>"""+coverage+"""</dc:coverage>
+        <dc:type>"""+resource_type+"""</dc:type>
+        <dc:identifier>"""+identifier+"""</dc:identifier>
+        <dc:description>"""+description+"""</dc:description>
+        <dc:publisher>"""+publisher+"""</dc:publisher>
+        <dc:date>"""+date+"""</dc:date>
+        <dc:format>"""+resource_format+"""</dc:format>
+        <dc:language>"""+language+"""</dc:language>
+        </rdf:Description>
+       </rdf:RDF>
      </xs:appinfo>
     </xs:annotation>
 
-
-
     <xs:include schemaLocation="http://www.mlhim.org/xmls/mlhim2/2_3_1/mlhim2.xsd"/>
 
     <xs:element name='"""+ccd_id+"""' type="mlhim2:"""+ccdct+""""/>
 
     <xs:complexType name='"""+ccdct+"""'>
       <xs:complexContent>
-      <xs:restriction base="mlhim2:CCDType">
-      <xs:sequence>
-        <xs:element name="definition"  minOccurs="1"  maxOccurs="1" type="mlhim2:"""+ect+""""/>
-      </xs:sequence>
-      </xs:restriction>
+        <xs:restriction base="mlhim2:CCDType">
+        <xs:sequence>
+          <xs:element name="definition"  minOccurs="1"  maxOccurs="1" type="mlhim2:"""+ect+""""/>
+        </xs:sequence>
+        </xs:restriction>
       </xs:complexContent>
     </xs:complexType>
 
     <xs:complexType name='"""+ect+"""'>
       <xs:complexContent>
-      <xs:restriction base="mlhim2:ElementType">
-      <xs:sequence>
-        <xs:element name="Element_dv"  minOccurs="1"  maxOccurs="1" type="mlhim2:"""+dct+""""/>
-      </xs:sequence>
-      </xs:restriction>
+        <xs:restriction base="mlhim2:ElementType">
+        <xs:sequence>
+          <xs:element name="Element_dv"  minOccurs="1"  maxOccurs="1" type="mlhim2:"""+dct+""""/>
+        </xs:sequence>
+        </xs:restriction>
       </xs:complexContent>
     </xs:complexType>
     """)
@@ -150,12 +150,12 @@
         f.write("""
     <xs:complexType name='"""+dct+"""'>
       <xs:complexContent>
-      <xs:restriction base="mlhim2:DvDateType">
-      <xs:sequence>
-        <xs:element name="data_name"  minOccurs="1"  maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
-        <xs:element name="DvDate_dv"  minOccurs="1"  maxOccurs="1" type="xs:date"/>
-      </xs:sequence>
-      </xs:restriction>
+        <xs:restriction base="mlhim2:DvDateType">
+        <xs:sequence>
+          <xs:element name="data_name"  minOccurs="1"  maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
+          <xs:element name="DvDate_dv"  minOccurs="1"  maxOccurs="1" type="xs:date"/>
+        </xs:sequence>
+        </xs:restriction>
       </xs:complexContent>
     </xs:complexType>
         """)
@@ -164,12 +164,12 @@
         f.write("""
     <xs:complexType name='"""+dct+"""'>
       <xs:complexContent>
-      <xs:restriction base="mlhim2:DvTimeType">
-      <xs:sequence>
-        <xs:element name="data_name"  minOccurs="1"  maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
-        <xs:element name="DvTime_dv"  minOccurs="1"  maxOccurs="1" type="xs:time"/>
-      </xs:sequence>
-      </xs:restriction>
+        <xs:restriction base="mlhim2:DvTimeType">
+        <xs:sequence>
+          <xs:element name="data_name"  minOccurs="1"  maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
+          <xs:element name="DvTime_dv"  minOccurs="1"  maxOccurs="1" type="xs:time"/>
+        </xs:sequence>
+        </xs:restriction>
       </xs:complexContent>
     </xs:complexType>
         """)
@@ -205,18 +205,18 @@
         f.write("""
     <xs:complexType name='"""+dct+"""'>
       <xs:complexContent>
-      <xs:restriction base="mlhim2:DvStringType">
-      <xs:sequence>
-        <xs:element name="data_name"  minOccurs="1"  maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
-        <xs:element name="DvString_dv"  minOccurs="1"  maxOccurs="1" type="xs:string"/>
-      </xs:sequence>
-      </xs:restriction>
+        <xs:restriction base="mlhim2:DvStringType">
+        <xs:sequence>
+          <xs:element name="data_name"  minOccurs="1"  maxOccurs="1" type="xs:string" fixed='"""+data_name+"""'/>
+          <xs:element name="DvString_dv"  minOccurs="1"  maxOccurs="1" type="xs:string"/>
+        </xs:sequence>
+        </xs:restriction>
       </xs:complexContent>
     </xs:complexType>
         """)
 
     f.write("""
-    </xs:schema>""")
+</xs:schema>""")
 
     f.close()