Changes between Version 3 and Version 4 of BluePrint/PrePopulate


Ignore:
Timestamp:
10/12/11 09:13:02 (13 years ago)
Author:
graeme
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BluePrint/PrePopulate

    v3 v4  
     1[[TOC]]
    12= Pre-Populate =
    23
    34== Introduction ==
    4 We need to
     5We need to be able to import data into a Sahana Eden instance for testing, demos and to help with getting up and running.
    56
    67== Types of Data ==
     
    1314
    1415== Methods ==
     16=== On First Run ===
     17In models/000_config.py their is a deployment setting to control prepopulate. This is a list of directory names and will import data from a number of CSV files. The directories must be in the private/prepopulate directory tree and must include a file called tasks.cfg.
     18
     19The tasks.cfg file comprises a list of import jobs. They can be of two distinct types:
     20 * Basic Importer Jobs
     21 * Special Import Jobs
     22The tasks.cfg file supports the # character on the first column as a comment.
     23==== Basic Importer Jobs ====
     24These will use the UI Importer to load in the data and requires the following information:
     25 * The controller
     26 * The function
     27 * The CSV
     28 * The XSL transform file
     29
     30For example:
     31{{{
     32"survey","question_list","questionnaire24H.csv","question_list.xsl"
     33}}}
     34Which will use the questionnaire24H.csv file, which in this case will be in the same directory as the tasks.cfg file, to import the data. Using the question_list.xsl transform file which will be the static/formats/s3csv/survey directory. The importer will then use the survey/question_list function to "manage" the import using any '''onvalidate''' or '''onaccept''' callbacks that are set up by this controller.
     35
     36The CSV file does not '''need''' to be in the same directory as the tasks.cfg file, if it is held in a different file then the full path needs to be given relative to the private/prepopulate directory.
     37
     38All transform files are stored in the static/formats/s3csv directory tree.
     39==== Special Import Jobs ====
     40For some import jobs it is easier to create a purpose built import function rather than use the Importer. These are created by using a asterisk at the start of the line in the tasks.cfg file, as follows:
     41{{{
     42*,gis_import_csv,USA_L1.csv
     43}}}
     44This uses the csv file '''USA_L1.csv''' and the function '''gis_import_csv''' to import, in this case, level 1 location data for the USA.
    1545=== URL Import ===
    1646Data can be imported using URL calls:
     
    3666Should we have a wrapper function for this which is easily accessed from the CLI?
    3767
    38 == Location for Pre-populate Data ==
    39 === Proposal ===
    40 /private/
    41  * transform (ALL xsl files. Any CSV should automatically use the xsl with the same name in the same directory in this folder. If multiple csv files need to use the same xsl transfor give the a "!__XXX" double underscore suffix, eg. {{{eric__complete.csv}}}, {{{eric__sample.csv}}} can both use  {{{supply/eric.xls}}} )
    42   * module 0
    43   * ...
    44   * module n
    45  * prepopulate
    46   * demo
    47    * module 0
    48    * ...
    49    * module n
    50   * regression
    51    * module 0
    52    * ...
    53    * module n
    54   * user (private prepopulate data - not shared in bzr branch)
    55    * module 0
    56    * ...
    57    * module n
    58   * drrpp (deployment with data which can be shared)
    59    * module 0
    60    * ...
    61    * module n
    62  * ... (other deployments with public data)
    63    * module 0
    64    * ...
    65    * module n
    6668
    67 /static/prepopulate /
    68  * templates (csv files with header row only)
    69   * module 0
    70   * ...
    71   * module n
    7269
    7370Rational: