|Version 6 (modified by 11 years ago) ( diff ),|
Update Detection during Imports
Data imports can do both - create new records in the database and update existing ones.
If Sahana Eden can identify an import item with an existing record, this record will be updated rather than a new record being created.
In order to identify the import item, Eden uses a cascade of rules:
- Identification by UUID
- Identification by other unique keys
- Identification by table-specific rules
Identification by UUID
Every record in the Sahana Eden database has a UUID field (universally unique identifier), see UUID.
If an import item contains a UUID and it matches an existing database record, this record will be updated rather than creating a new record.
Identification by Other Unique Keys
Some database tables use additional unique keys, e.g. the "name" field in organisations. These keys can be used instead of UUIDs to indicate updates.
Note: if there is also a UUID present in the import item, then only the UUID will be used to identify the record to update.
Table-Specific Identification Rules
For many database tables, Sahana Eden has additional table-specific rules to identify records in cases where no match can be found by unique keys:
Person records are primarily identified by:
- an exact match of first name and last name (if both are present in the import item), or
- alternatively, an exact match of the initials (if present in the import item)
If any matching records can be found, they will be ranked by:
- an exact match of the first name (+2/-2 points)
- an exact match of the last name (+2/-2 points)
- an exact match of the date of birth (+2/-2 point)
- an exact match of the email address (+1/-1 point)
- an exact match of the mobile phone number (+1/-1 point)
- an exact match of the initials (+1/-1 point)
If any of the criteria is missing from either the existing record or the import item, the test will not be performed (0 points).
If the sum of the points is less than 0, the record will not be regarded as a match.
The highest ranking match will be used to identify the record to update.