Data initialization in DigiAgriApp#

Load data#

Before entering new information, load default data saved in JSON format provided by DigiAgriApp to populate the database and be compliant with all the other DigiAgriApp instances.

If you run DigiAgriApp with Podman or Docker run

podman/docker exec django python3 src/manage.py loaddata default

Instead if you run DigiAgriApp with native installation from the main DigiAgriApp source code folder run

python3 src/manage.py loaddata default

Generic data#

If you want to add generic data we suggest you to add them first in the DigiAgriApp source code opening a new merge request for the JSON file of the application where you want to add data. This is important to maintain compatibility between different DigiAgriApp instances.

In the core application you can find

  • Country: table with all the World countries. It is possible to add countries using the mapping.py script inside src/DigiAgriApp; run python mapping.py -w to import Sovereignty countries downloaded from Natural Earth.

  • Region: a tables to store administrative boundaries, this could be counties or special regions like protected designation of origin (PDO). The country_id values come from Country table.

  • Municipality: the municipality with their boundary, these have to be uploaded following a different approach that countries

  • Brands: general table with all the brands; it can be used for hardwares or machinery; it can also be an institute if the prototype is developed in its own laboratory.

  • Device types: the type of instrument that send data (drone, microcontroller, prototype name)

  • Farm type: the typology of farms or other organization

  • Status: the status of a plant or a different objects

  • Units: the unit of measurement of the acquired data

  • Value types: the names of the measured variables

In plant application you can find

  • Family: the list family of the possible plants

  • Genus: the genus of the plants this is connected to the Family table

  • Species: the table with all the possible species

In the observation application there is

  • Measure type: the type of the collected measures

In the remotesensing application there is

  • Remote sensing band: the type of band of a remote sensing, included images, data

In the treatment application you can find

  • Adversity type: the macroclasses type of adversity

  • Adversity agent: the list of possible adversity’s agents

  • Adversity: the list of possible adversities

  • Treatment type: the table with all the possible type of treatments

Specific data#

  • Variety, Clones, Rootstock and Rootstock clone since these date are really a lot, they are divided in several files inside the plant/fixtures folder; you can add what is useful for your DigiAgriApp instance user. These information are used to create the Material object to be assigned to a Field, Subfield, Row or Plant objects.

  • Treatment Products are different from country to country so

Geographical data with foreign key#

To upload geographical date like Region or Municipality you need to use a tool to import the geodata into a PostgreSQL data. This could be QGIS or a command line tool like ogr2ogr. You input data needs to have the same structure of the table you want to import. In the next example we are going to import a GeoJSON file (/tmp/regions.geojson) into Region table (named general_region)

ogr2ogr -update -append -f PostgreSQL PG:"dbname='digiagri'" /tmp/regions.geojson -nln general_region

Other data entry#

Once completed all the steps described in the previous section, proceed by adding data in the application. Open the app and login with admin account. You will see a screen like the one below.

  • Farms: farms are the main feature where all other element are connected to

  • Organizations: consortia, associations or institutes

Here you can modify your data by adding applications, devices, sensors, and so on.

Field and other data#

Finally, you can start to create other data, you can use the admin panel, but we suggest to use the app or QGIS plugin.