Importing and exporting tree observations

This article provides some detail about the Import and Export of tree observation data to csv files, including:

    1. Changes to Observations introduced in Truffle Grower version 1.6
    2. Export of observation data to a csv file
    3. Import of observation data from csv files
    4. Importing ‘legacy’ observation files
Observation changes

In Truffle Grower version 1.6, some changes have been made to the organisation of observation data associated with trees.  These changes impact the format of csv data exported from the Truffle Grower application:

    1. The observation’s ‘Observation date’ field has been extended to include the time, with a precision of one second
    2. New observations for a tree must have a unique date and time
    3. Unwanted observations can be deleted during an import operation

Note:  Truffle Grower will continue to support the import of data files that were created using the earlier versions of Truffle Grower.  In some cases, these files may need to be edited to conform to the new requirement for unique ‘Observation date’ values for a tree’s observations.  Please see the section Importing ‘legacy’ observation files for more details.

Observations properties include time

From version 1.6, Truffle Grower will store the time at which an observation was created together with the date.  The date and time are stored with one second precision.

The time value is visible within Truffle Grower from the observation detail view:

New observations for a tree must have a unique date time

When creating new observations for a tree, TruffleGrower now enforces a unique ‘Observation date’ value.  This means it will not be possible to create a new observation for a tree with the same date and time as an existing observation.

Note:  Because earlier versions of Truffle Grower did not enforce this rule, it is possible that some existing orchards may already include multiple observations for the same tree recorded with the same ‘Observation date’ value.  These existing observations will not be automatically modified or deleted by Truffle Grower when upgrading to version 1.6.

Unwanted observations can be deleted during an import

Previously, observations had to be deleted manually by using the tree detail views within Truffle Grower.  While this operation is still supported, it is now also possible to perform a bulk delete of observations during an import operation.

When previewing changes that would result from an import of observation records, the user has an option to ‘Delete missing records‘.  By setting this option before performing the import operation, the user will cause Truffle Grower to delete any observation records in the target orchard that do not match the tree name, date and time with one of the records in the file being imported.

The recommended procedure to delete a large number of unwanted observations is:

    1. Export all observations for an orchard to a csv file
    2. Delete unwanted observations from the csv file
    3. Import the modified csv file, setting the ‘Delete missing records‘ option

 

Exporting observations

Observations for all trees in an orchard block can be exported from the map view of a truffle block.  To do this, select the ‘actions’ toolbar icon, choose “Export observations” and pick a destination for the exported csv file:

Note:  All observations in the orchard are exported, including any that might have duplicate date/time property values for the same tree.

Observation fields include the following properties:

Name Name of the tree associated with the observation
Observation date Date and time the observation was recorded, with precision of one second.  This field has a format “yyyy-MM-dd HH:mm:ss“, for example:

2018-12-15 13:27:01

Height Height of the tree (m)
Health Health of the tree, this is a value from the set:

{ dead, critical, average, good, excellent }

Brule Indicates if a brûlé was observed about the tree:

{ true, false }

Insect damage, Structural damage, Cholorsis, Water stress, Powdery mildew These fields each record aspects of the tree’s health.

Each field may have a numeric integer value from 0 to 100

Notes Notes are stored as text associated with the observation

 

Note:  Observation csv files created using an earlier version of Truffle Grower (before 1.6) do not include “time” as part of the ‘Observation date’ field.  However, these older files can still be imported into the current version of Truffle Grower.  Where a time is not specified in the file, a time value of 00:00:00 will be assumed.

Importing observations

Observation data in csv files can be imported.  To do this, open the csv file in Truffle Grower, and select an existing orchard as the target of the import operation:

    1. Send the csv file to your iOS device (for example, as an email attachment)
    2. Press on the attachment and select ‘Copy to TruffleGrower’
    3. Select the target orchard
    4. Optionally choose to ‘Delete missing records
    5. Press ‘Import’ to complete the operation

Observation records in the imported file will be copied into the target orchard.  Truffle Grower applies the following rules when importing observations:

    • ⚠  Important: if an input file includes more than one observation for a tree with the same ‘Name’ and ‘Observation date’ value, an error message will be displayed and the import is not allowed
    • if records being imported do not match an existing tree ‘Name’, then those records will be ignored during the import.  A warning message will indicate how many records will be ignored during the import
    • if a record’s ‘Name’ and ‘Observation date’ match an existing observation’s tree, date, and time, the existing observation will be updated with the record’s data
    • ⚠  Important: if more than one existing observation matches the ‘Name’ and ‘Observation date’ (to the second), only one of the existing records will be updated
    • if a record’s ‘Name’ matches a tree in the target orchard, but the ‘Observation date’ does not match an existing record, then a new observation will be created from the record’s data
    • if the ‘Delete missing records‘ option is selected, when the csv file is imported any existing observations that do not match one of the records being imported will be deleted
Importing ‘legacy’ observation files

There are two important things to consider when working with ‘legacy’ observation files.  These are the change in date/time format used in the record, and the new requirement for a tree’s observations to have unique date/time values.

Observations properties include time

Prior to version 1.6, the observation date was stored in a field named ‘Observation date’ with format ‘d MMMM yyyy‘, for example:   12 January 2013.

Truffle Grower continues to recognise dates in this format, and will import the records into observations with the correct date.  However, as no time information is present, observations being imported will have the time component of their ‘Observation date’ set to 00:00:00.

This may mean that Truffle Grower may not correctly match an observation being imported by the csv file with the original observation record in the App.

Ensuring a unique date/time

In earlier versions of Truffle Grower, it was possible to create more than one observation for a tree with the same ‘Observation date’ value.  While these records can be exported to a csv file, when the file is re-imported the application will not be able to identify the observations corresponding to each record.  As a result, from version 1.6, Truffle Grower will not allow an observation file to be imported if it contains multiple records with matching values for ‘Name’ and ‘Observation date’.

In order to import an observation csv file that contains records with duplicate ‘Name’ and ‘Observation date’ values, modify the file to ensure each tree’s observations have a unique ‘Observation date’ before importing.

The following steps can be taken to modify Truffle Grower’s on-line database to ensure there are no observations for a tree with duplicate date and time:

    1. Export all observations for the orchard to a csv file
    2. Edit the ‘Observation date’ value for any records with duplicate name and date/time values.  Use the new format ‘yyyy-MM-dd HH:mm:ss‘.  Assign a unique time to each observation with matching name and date.  The times can vary by as little as one second.
    3. Import the modified csv file, setting the ‘Delete missing records‘ option

This procedure will create new versions of the observation records with unique values for ‘Name’ and ‘Observation date’.  The old records with duplicated values will be deleted, as they will not have corresponding records in the csv file

Leave a Reply

Your email address will not be published. Required fields are marked *