Module Expr Str Import alias Import alias Import alias Assign NameStore ListLoad Str Str Str Assign NameStore ListLoad Str Str Str Str Str Str Str Str Str Str Str Str Str Assign NameStore ListLoad FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Assign NameStore ListLoad For NameStore Call NameLoad Call NameLoad NameLoad body If CompareEq SubscriptLoad NameLoad Index NameLoad Str body If CompareNotEq NameLoad ListLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad orelse Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad If CompareNotEq NameLoad ListLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad For NameStore Call NameLoad Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index BinOpSub NameLoad Num Assign TupleStore NameStore NameStore Call NameLoad SubscriptLoad NameLoad Slice Num NameLoad NameLoad Num NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore BinOpAdd BinOpSub NameLoad NameLoad Num For NameStore Call NameLoad BinOpMult NameLoad NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad BinOpAdd NameLoad NameLoad For NameStore Call AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body For NameStore Call NameLoad NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad BinOpAdd BinOpAdd BinOpMult NameLoad NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore BinOpMod Str TupleLoad NameLoad BinOpAdd NameLoad NameLoad Assign SubscriptStore NameLoad Index Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad Assign NameStore BinOpAdd NameLoad Num If CompareIn NameLoad NameLoad body Assign NameStore Num For NameStore NameLoad body AugAssignAdd NameStore Num If CompareEq NameLoad Str body AugAssignAdd NameStore Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad NameLoad Num NameLoad Break Assign SubscriptStore NameLoad Index Call NameLoad NameLoad Call NameLoad NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Num Assign NameStore Num Assign SubscriptStore NameLoad Index Str BinOpAdd BinOpSub NameLoad NameLoad Num Assign NameStore Call NameLoad NameLoad For NameStore Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If CompareEq NameLoad Str body AugAssignAdd NameStore Num Assign SubscriptStore NameLoad Index Str Call NameLoad SubscriptLoad NameLoad Index NameLoad orelse If CompareEq NameLoad Str body AugAssignAdd NameStore Num Assign NameStore Call NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad orelse If CompareEq NameLoad Str body AugAssignAdd NameStore Num Assign NameStore Call NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Index BinOpAdd BinOpAdd NameLoad NameLoad Num Assign SubscriptStore NameLoad Index Str NameLoad AugAssignAdd NameStore NameLoad orelse If CompareEq NameLoad Str body Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Index BinOpAdd BinOpAdd NameLoad NameLoad Num Assign SubscriptStore NameLoad Index Str NameLoad AugAssignAdd NameStore NameLoad orelse If CompareEq NameLoad Str body Assign NameStore ListLoad Assign NameStore ListLoad For NameStore Call NameLoad BinOpAdd NameLoad Num NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If CompareEq NameLoad Str body Break orelse Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad If CompareEq Call NameLoad NameLoad Num body Assign NameStore BinOpMult NameLoad NameLoad Assign NameStore BinOpMult ListLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index Str NameLoad orelse If CompareEq Call NameLoad NameLoad NameLoad body For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Str NameLoad orelse For NameStore Call NameLoad NameLoad body Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index BinOpAdd BinOpMult NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Str NameLoad If CompareEq NameLoad Str body If CompareEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad orelse If CompareEq Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad NameLoad NameLoad NameLoad Break Assign NameStore BinOpAdd NameLoad BinOpMult NameLoad NameLoad orelse Pass Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign NameStore ListLoad For NameStore Call NameLoad Num AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareEq NameLoad Str body Break Expr Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore Str Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore ListLoad For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Slice Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num If CompareNotEq NameLoad NameLoad body Assign NameStore NameLoad AugAssignAdd NameStore Num Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad Dict body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore ListLoad For NameStore Call NameLoad Num AttributeLoad NameLoad attr body Assign NameStore ListLoad For NameStore Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareEq NameLoad Str body Break If CompareIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad If CompareEq NameLoad ListLoad body Break Expr Call AttributeLoad NameLoad attr NameLoad Return ListLoad Dict Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore ListLoad For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Dict Str Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore NameLoad Assign NameStore ListLoad For NameStore Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num If CompareEq NameLoad Str body If CompareNotEq NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad orelse If CompareEq NameLoad Str body Pass orelse If CompareIn NameLoad NameLoad body If CompareNotEq NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad If CompareNotEq NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Num Assign NameStore ListLoad Assign NameStore Call NameLoad NameLoad Assign NameStore NameStore Num Assign NameStore AttributeLoad NameLoad attr For NameStore Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad While CompareLt NameLoad NameLoad body If CompareEq Call AttributeLoad NameLoad attr NameLoad Num NameLoad body Break orelse AugAssignAdd NameStore Num If CompareEq BinOpAdd NameLoad Num NameLoad body Assign NameStore NameLoad orelse Assign NameStore SubscriptLoad NameLoad Index BinOpAdd NameLoad Num While CompareLt NameLoad NameLoad body If CompareEq Call AttributeLoad NameLoad attr NameLoad Num NameLoad body Break orelse AugAssignAdd NameStore Num Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad BinOpAdd NameLoad Num NameLoad Expr Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad BinOpAdd NameLoad Num NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore ListLoad For NameStore Call NameLoad Num AttributeLoad NameLoad attr body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Num If BoolOpAnd CompareGt AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr NameLoad Num body Assign NameStore ListLoad NameLoad For NameStore Call NameLoad Num AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call NameLoad Num AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad SubscriptLoad NameLoad Index Num NameLoad NameLoad Assign NameStore ListLoad For NameStore NameLoad body If CompareNotIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad ListLoad body Print BinOpMod Str NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore BinOpMod Str NameLoad Assign NameStore ListLoad Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr ListLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore BinOpMod Str NameLoad Assign NameStore ListLoad Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr ListLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Expr Str If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Print Str Return Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign TupleStore NameStore NameStore Call NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
    Sahana-Eden ADAT helper script
    ==============================

    Script to generate the import files for a new survey template.
    The input is a "xls" spreadsheet with four sheets, namely:
     * Template
     * Sections
     * Questions
     * Layout

    The output is two csv files one that can beused to import the
    questions into the system, the other that may be used to import
    the layout details into the system. The name of the files will the
    same as the input file with either the .Layout.csv or .Question.csv prefix
    replacing the .xls type.

    Details of the input sheets
    ===========================

    Template
    --------
    This includes the basic details of the template as follows:
    A1: Template Name
    A2: Template Description
    A3: Complete Question
    A4: Date Question
    A5: Time Question
    A6: Location Detail
    A7: Priority Question

    The questions in cells A3:A7 are the unique questions codes which are given
    later in sheet the Questions sheet.

    Sections
    --------
    This lists each section within the template. Each section name is given in
    the A column, they should be provided in their default order. Thier display
    order can be later be changed by the layout but this will be the default
    order of the sections.

    Questions
    ---------
    This holds details of questions in each column as follows:
    A: Unique Question Code
    B: The Section    - the section to which the question belongs
    C: Question Name  - the actual question which is what will be displayed
                        and should be in the base template language (English)
    D: Question type  - This must be one of the known question widget types
    E: Question notes - any help information that should be associated with
                        the question to help the enumerators complete
                        the questionnaire.
    F onwards: Metadata
      Any option type:  The list of options, thus:
                        OptionOther: Early   Continue
      The Grid type: This is the most complex type when it comes to the metadata
                     and it relies on keywords to make it as simple as possible.
                     The columns alternate between keywords and their value.
                     The valid keywords are:
                     Subtitle -        the subtitle of the grid [Optional]
                     Column count -    the number of columns in the grid
                     Row count -       the number of rows in the grid
                     Column Headings - the headings for each column with one
                                       heading per cell
                     Row Questions -   the headings for each row with one
                                       heading per cell
                     Question Type -   this is the type of each question, again
                                       this must be one of the known question
                                       widget types. If just one value is given
                                       then all questions take this type. If the
                                       same number of types as columns are given
                                       then this type reflects the types used
                                       in each column. Otherwise, their should
                                       be a direct mapping between question and
                                       type.
                     GridChild -       Some of the question types need to have
                                       metadata associated with them. This 
                                       keyword is followed by a number to
                                       indicate which question type the metadata
                                       is for, refering to the order in the
                                       Question Type list. [Optional]
                     NOTE: The metadata must be provided in this order.

    NOTE on the grid question type:
         The question code for this should be unique and end with a hyphen.
         The questions within the grid will then be properly numbered.
         So a grid question code of PMI-WASH-A-, will then hold the questions
         PMI-WASH-A-1, PMI-WASH-A-2, PMI-WASH-A-3 etc.


    Layout
    ------
    This is used to describe in a semi-visual way how the questions should be
    laid out. This layout can be used for any representation of the
    questionnaire such as web form, spreadsheet, PDF etc.

    The rules to complete this section are as follows:
     * Add the section name
     * On subsequent lines add the question codes for the questions to appear
       in this section
     * For questions that are to appear in a the same line add them in adjacent
       columns of the same row, thus:
       PMI-Ass-1    PMI-Ass-2    PMI-Ass-3
     * For questions that are to appear in adjacent columns use the keyword
       column in the first column and then add the questions in subsequent
       columns, thus:
       columns  PMI-Health-1    PMI-Health-4    PMI-Health-A-
                PMI-Health-2
       So this describes three columns with two questions in the first column
       and one question each in columns 2 and 3.
     * To add a subheading (normally at the start of a column) just add the
       text in the cell and the question codes in the columns below. Any text
       that does not match a question code or keyword is assumed to be a
       subheading.

     NOTE: The script might be able to manage blank lines between the end of
           one section and the next but *please* try and avoid using blank lines
           since this is not fully tested and future enhancements of this script
           may break that.
     NOTE: Only include questions codes from within the section. Including
           questions from different sections is untested and whilst the script
           may work as expected, Sahana-Eden *might* not.

 N/A sys N/A xlrd N/A csv N/A optionTypes N/A Option OptionOther MultiOption N/A widgetTypes N/A String Text Numeric Date Option YesNo YesNoDontKnow OptionOther MultiOption Location Link Grid GridChild N/A layoutQuestions N/A splitGridChildMetadata N/A N/A metadataList N/A N/A N/A gridChildList N/A N/A dataList N/A N/A x N/A range N/A len metadataList N/A N/A N/A N/A metadataList N/A x GridChild N/A N/A N/A dataList N/A N/A N/A N/A N/A gridChildList append dataList N/A dataList N/A N/A N/A N/A N/A dataList append N/A metadataList N/A x N/A N/A dataList N/A N/A N/A N/A N/A gridChildList append dataList N/A gridChildList N/A processGridChildMetadata N/A N/A metadataList childType N/A N/A N/A metadata N/A dict N/A gridChildList N/A splitGridChildMetadata metadataList N/A x N/A range N/A len gridChildList N/A N/A dataList N/A gridChildList N/A x N/A qstnNo N/A int N/A dataList N/A 0 N/A qstn_type N/A childType N/A N/A qstnNo 1 N/A N/A metadataList dummy N/A processMetadata N/A dataList N/A 1 qstn_type None 0 None N/A N/A metadata N/A qstnNo metadataList N/A metadata N/A processGridChildMetadataAll N/A N/A metadataList colCnt rowCnt qstn_code qstn_posn firstQstnInSection childType N/A N/A N/A metadata N/A dict N/A qstnMetadataList N/A processGridChildMetadata metadataList childType N/A offset N/A N/A qstn_posn firstQstnInSection 1 N/A x N/A range N/A colCnt rowCnt N/A N/A qCode N/A %s%d N/A qstn_code N/A x offset N/A qstnMetadata N/A N/A qstnMetadataList values N/A N/A N/A metadata N/A N/A str qCode qstnMetadata N/A metadata N/A processGridChildMetadataColumn N/A N/A metadataList colCnt rowCnt qstn_code qstn_posn firstQstnInSection childType N/A N/A N/A metadata N/A dict N/A qstnMetadataList N/A processGridChildMetadata metadataList childType N/A offset N/A qstn_posn firstQstnInSection N/A N/A posn qstnMetadata N/A N/A qstnMetadataList items N/A N/A x N/A range rowCnt N/A N/A qCode N/A %s%d N/A qstn_code N/A N/A N/A x colCnt posn offset N/A N/A metadata N/A N/A str qCode qstnMetadata N/A metadata N/A processGridChildMetadataElement N/A N/A metadataList qstn_code qstn_posn firstQstnInSection childType N/A N/A N/A metadata N/A dict N/A qstnMetadataList N/A processGridChildMetadata metadataList childType N/A offset N/A qstn_posn firstQstnInSection N/A N/A posn qstnMetadata N/A N/A qstnMetadataList items N/A N/A qCode N/A %s%d N/A qstn_code N/A posn offset N/A N/A metadata N/A N/A str qCode qstnMetadata N/A metadata N/A processMetadata N/A N/A metadataList qstn_type qstn_code qstn_posn firstQstnInSection N/A N/A N/A metadata N/A dict N/A next_qstn_posn N/A qstn_posn 1 N/A N/A qstn_type optionTypes N/A N/A posn 0 N/A value metadataList N/A N/A posn 1 N/A N/A value metadata N/A N/A metadata N/A processMetadata N/A metadataList N/A posn None None 0 None N/A N/A N/A metadata N/A N/A str posn N/A str value N/A N/A metadata N/A Length N/A str posn N/A N/A N/A qstn_type Grid N/A N/A colCnt 0 N/A rowCnt 0 N/A N/A metadata N/A QuestionNo N/A N/A qstn_posn firstQstnInSection 1 N/A end N/A len metadataList N/A x N/A range end N/A N/A value N/A metadataList N/A x N/A N/A value Subtitle N/A N/A x 1 N/A N/A metadata N/A Subtitle N/A str N/A metadataList N/A x N/A N/A N/A value Column count N/A N/A x 1 N/A colCnt N/A int N/A metadataList N/A x N/A N/A metadata N/A col-cnt N/A str colCnt N/A N/A N/A value Row  count N/A N/A x 1 N/A rowCnt N/A int N/A metadataList N/A x N/A N/A metadata N/A row-cnt N/A str rowCnt N/A N/A N/A value Column Headings N/A N/A colList N/A N/A y N/A range colCnt N/A N/A N/A N/A colList append N/A str N/A metadataList N/A N/A N/A x y 1 N/A N/A metadata N/A columns colList N/A x colCnt N/A N/A N/A value Row Questions N/A N/A rowList N/A N/A y N/A range rowCnt N/A N/A N/A N/A rowList append N/A str N/A metadataList N/A N/A N/A x y 1 N/A N/A metadata N/A rows rowList N/A x rowCnt N/A N/A N/A value Question Type N/A N/A rowList N/A N/A childType N/A N/A y N/A xrange N/A x 1 end N/A N/A value N/A metadataList N/A y N/A N/A value GridChild N/A N/A N/A N/A N/A N/A childType append N/A str value N/A N/A N/A len childType 1 N/A N/A colList N/A childType colCnt N/A rowList N/A N/A colList rowCnt N/A N/A metadata N/A data rowList N/A N/A N/A N/A len childType colCnt N/A N/A r N/A range rowCnt N/A N/A N/A N/A rowList append childType N/A N/A metadata N/A data rowList N/A N/A r N/A range rowCnt N/A N/A colList N/A N/A c N/A range colCnt N/A N/A N/A N/A colList append N/A childType N/A N/A N/A r colCnt c N/A N/A N/A rowList append colList N/A N/A metadata N/A data rowList N/A N/A value GridChild N/A N/A N/A N/A len childType 1 N/A N/A N/A N/A metadata update N/A processGridChildMetadataAll N/A metadataList N/A y colCnt rowCnt qstn_code qstn_posn firstQstnInSection childType N/A N/A N/A N/A len childType colCnt N/A N/A N/A N/A metadata update N/A processGridChildMetadataColumn N/A metadataList N/A y colCnt rowCnt qstn_code qstn_posn firstQstnInSection childType N/A N/A N/A N/A metadata update N/A processGridChildMetadataElement N/A metadataList N/A y qstn_code qstn_posn firstQstnInSection childType N/A N/A next_qstn_posn N/A qstn_posn N/A colCnt rowCnt N/A N/A N/A N/A metadata next_qstn_posn N/A getQstnMetadata N/A N/A sheetQ row qstn_type qstn_code qstn_posn firstQstnInSection N/A N/A N/A metadataList N/A N/A col N/A xrange 5 N/A sheetQ ncols N/A N/A value N/A N/A sheetQ cell_value row col N/A N/A value N/A N/A N/A N/A N/A metadataList append value N/A N/A metadata qstn_posn N/A processMetadata metadataList qstn_type qstn_code qstn_posn firstQstnInSection N/A N/A metadata qstn_posn N/A formatQuestionnaire N/A N/A sheetQ templateDetails sections N/A N/A N/A questionnaire N/A N/A questions N/A N/A theSection N/A sectionPosn 0 N/A firstQstnInSection 0 N/A next_qstn_posn 1 N/A line N/A N/A row N/A range N/A sheetQ nrows N/A N/A qstn_posn next_qstn_posn N/A line N/A templateDetails N/A N/A qstn_code N/A N/A sheetQ cell_value row 0 N/A section N/A N/A sheetQ cell_value row 1 N/A N/A section theSection N/A N/A theSection section N/A sectionPosn 1 N/A firstQstnInSection qstn_posn N/A question N/A N/A sheetQ cell_value row 2 N/A qstn_type N/A N/A sheetQ cell_value row 3 N/A qstn_notes N/A N/A sheetQ cell_value row 4 N/A N/A metadata next_qstn_posn N/A getQstnMetadata sheetQ row qstn_type qstn_code qstn_posn firstQstnInSection N/A N/A N/A questions append qstn_code N/A N/A N/A line append section N/A N/A N/A line append sectionPosn N/A N/A N/A line append question N/A N/A N/A line append qstn_type N/A N/A N/A line append qstn_notes N/A N/A N/A line append qstn_posn N/A N/A N/A line append qstn_code N/A N/A metadata N/A N/A N/A N/A N/A line append metadata N/A N/A N/A questionnaire append line N/A N/A questions questionnaire N/A processColumns N/A N/A sheetL questions rowStart rowEnd N/A N/A N/A columns N/A N/A col N/A xrange 1 N/A sheetL ncols N/A N/A colList N/A N/A row N/A xrange rowStart rowEnd N/A N/A value N/A N/A sheetL cell_value row col N/A N/A value N/A N/A N/A N/A value questions N/A N/A N/A N/A colList append N/A str value N/A N/A N/A layoutQuestions append value N/A N/A N/A N/A colList append N/A processLabel value N/A N/A colList N/A N/A N/A N/A N/A N/A columns append colList N/A N/A N/A columns columns N/A processRow N/A N/A sheetL questions row N/A N/A N/A rowList N/A N/A col N/A range N/A sheetL ncols N/A N/A value N/A N/A sheetL cell_value row col N/A N/A value questions N/A N/A N/A N/A rowList append N/A str value N/A N/A N/A layoutQuestions append value N/A rowList N/A processLabel N/A N/A value N/A N/A N/A N/A heading N/A str value N/A getLayoutRules N/A N/A sheetL questions rowStart rowEnd N/A N/A N/A colStart None N/A rules N/A N/A row N/A xrange rowStart rowEnd N/A N/A value N/A N/A sheetL cell_value row 0 N/A N/A value columns N/A N/A N/A colStart None N/A N/A N/A N/A rules append N/A processColumns sheetL questions colStart row N/A colStart row N/A N/A N/A value N/A N/A N/A N/A N/A value questions N/A N/A N/A colStart None N/A N/A N/A N/A rules append N/A processColumns sheetL questions colStart row N/A colStart None N/A N/A N/A rules append N/A processRow sheetL questions row N/A N/A N/A N/A rules append N/A processLabel value N/A N/A colStart None N/A N/A N/A N/A rules append N/A processColumns sheetL questions colStart rowEnd N/A rules N/A formatLayout N/A N/A sheetL template sections questions N/A N/A N/A layoutMethod 1 N/A layout N/A N/A sectionLength N/A len sections N/A rowStart rowEnd 0 N/A rowLimit N/A sheetL nrows N/A i N/A range sectionLength N/A N/A section N/A sections N/A i N/A N/A rowStart rowLimit N/A N/A N/A N/A N/A sheetL cell_value rowStart 0 section N/A N/A N/A N/A rowStart 1 N/A N/A N/A i 1 sectionLength N/A N/A rowEnd rowLimit N/A N/A nextSection N/A sections N/A N/A i 1 N/A N/A rowEnd rowLimit N/A N/A N/A N/A N/A sheetL cell_value rowEnd 0 nextSection N/A N/A N/A N/A rowEnd 1 N/A rule N/A repr N/A getLayoutRules sheetL questions N/A rowStart 1 rowEnd N/A N/A N/A layout append N/A template section N/A i 1 layoutMethod rule N/A layout N/A loadSpreadsheet N/A N/A name N/A N/A N/A workbook N/A N/A xlrd open_workbook filename name N/A sheetT N/A N/A workbook sheet_by_name Template N/A sheetS N/A N/A workbook sheet_by_name Sections N/A sheetQ N/A N/A workbook sheet_by_name Questions N/A sheetL N/A N/A workbook sheet_by_name Layout N/A templateDetails N/A N/A row N/A xrange 0 N/A sheetT nrows N/A N/A value N/A str N/A N/A sheetT cell_value row 0 N/A N/A N/A N/A sheetT ncols 1 N/A N/A sheetT cell_value row 1 N/A N/A value N/A value N/A col N/A xrange 1 N/A sheetT ncols N/A N/A N/A N/A sheetT cell_value row col N/A N/A N/A N/A value append N/A str N/A N/A sheetT cell_value row col N/A N/A N/A templateDetails append value N/A sections N/A N/A row N/A xrange 0 N/A sheetS nrows N/A N/A N/A N/A sections append N/A N/A sheetS cell_value row 0 N/A N/A questions questionnaire N/A formatQuestionnaire sheetQ templateDetails sections N/A layout N/A formatLayout sheetL N/A templateDetails N/A 0 sections questions N/A missing N/A N/A qstn questions N/A N/A N/A qstn layoutQuestions N/A N/A N/A N/A missing append qstn N/A N/A missing N/A N/A N/A N/A The following questions are missing from the layout: %s missing N/A N/A questionnaire layout N/A generateQuestionnaireCSV N/A N/A name questionnaire N/A N/A N/A csvName N/A %s.Question.csv name N/A headings N/A Template Template Description Complete Question Date Question Time Question Location Detail Priority Question Section Section Position Question Question Type Question Notes Question Position Question Code Meta Data N/A writer N/A N/A csv writer N/A open csvName w N/A N/A N/A writer writerows N/A headings N/A N/A N/A writer writerows questionnaire N/A generateLayoutCSV N/A N/A name layout N/A N/A N/A csvName N/A %s.Layout.csv name N/A headings N/A Template Section Posn Method Rules N/A writer N/A N/A csv writer N/A open csvName w N/A N/A N/A writer writerows N/A headings N/A N/A N/A writer writerows layout N/A _main N/A N/A N/A N/A N/A 
    Parse arguments and run checks generate the csv files
     N/A N/A N/A len N/A sys argv 1 N/A N/A Please add a spreadsheet to process N/A N/A spreadsheetName N/A N/A sys argv N/A 1 N/A N/A questionnaire layout N/A loadSpreadsheet spreadsheetName N/A N/A generateQuestionnaireCSV spreadsheetName questionnaire N/A N/A generateLayoutCSV spreadsheetName layout N/A N/A N/A __name__ __main__ N/A N/A N/A _main