Comment 0 for bug 1226517

Revision history for this message
Michele Simionato (michele-simionato) wrote :

Editing XML files directly is a pain. The plan is to develop some desktop tools to generate the files needed for the engine starting from pre-existing .CSV files. This is possible if the user supplements the .CSV file with a .mdata file containing the additional info to generale the NRML file needed by the engine.
For instance, an exposure CSV file for population could be the following:

$ cat exposure_pop.csv
id,taxonomy,lon,lat,number
asset_01,IT-PV,9.15000,45.16667,7
asset_02,IT-CE,9.15333,45.12200,7

If we supplement it with the following file

$ cat exposure_pop.mdata
<?xml version="1.0" encoding="utf-8"?>
<exposureModel
category="population"
id="my_exposure_model_for_population"
taxonomySource="fake population datasource"
>
    <description>
        Sample population
    </description>
    <assets />
</exposureModel>

It is possible to generate a NRML files where the node <assets> is filled with the data from the CSV. The mechanism must work iteratively (i.e. do not keep the entire tree in memory). Moreover, it must be able to collect group of CSV files. This is needed for vulnerability and fragility models, where there is a .CSV file for each set of functions, and all the sets belongs to the same model. A simple idea is to use a command prefix. For instance the two pairs

  vulnerability-model__0.mdata
  vulnerability-model__0.csv
  vulnerability-model__1.mdata
  vulnerability-model__1.csv

can describe two vulnerability sets belonging to the same vulnerability model. The tool must be able to convert the four files into a single file named vulnerability-model.xml. This is the default output name. It must also be possible to specify a different output name, for instance to generate the output into a different directory.