Import backup inventories from SGSV
Add an admin function to import information on backups in SGSV as new inventories of existing accessions.
Recycle code from our 2016 implementation of the SGSVUpdate
at https://gitlab.croptrust.org/genesys-pgr/genesys-server/-/blob/master/src/main/java/org/genesys2/server/service/worker/SGSVUpdate.java
The CSV file from SGSV contains:
institute_code | deposit_box_number | collection_name | accession_number | full_scientific_name | country_of_collection_or_source | number_of_seeds | regeneration_month_and_year | other_accession_designations | provider_institute_code | accession_url | country_code | country_name | continent_name | seeds | genus | species_epithet | species | taxon_name | date_of_deposit | date_of_dataset | sgsv_template_id | box_id |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PAK001 | 02-PK/GB | Genebank | 6536 | Oryza sativa | Pakistan (PAK) | 500 | 2006 | PAK001 | PAK | Pakistan | Asia | 500 | Oryza | sativa | Oryza sativa | Oryza sativa | 17/06/2009 | 21/05/2009 | 1092 | |||
PAK001 | 02-PK/GB | Genebank | 6538 | Oryza sativa | Pakistan (PAK) | 500 | 2006 | PAK001 | PAK | Pakistan | Asia | 500 | Oryza | sativa | Oryza sativa | Oryza sativa | 17/06/2009 | 21/05/2009 | 1092 | |||
PAK001 | 02-PK/GB | Genebank | 6553 | Oryza sativa | Pakistan (PAK) | 500 | 2006 | PAK001 | PAK | Pakistan | Asia | 500 | Oryza | sativa | Oryza sativa | Oryza sativa | 17/06/2009 | 21/05/2009 | 1092 | |||
PAK001 | 02-PK/GB | Genebank | 6582 | Oryza sativa | Pakistan (PAK) | 500 | 2006 | PAK001 | PAK | Pakistan | Asia | 500 | Oryza | sativa | Oryza sativa | Oryza sativa | 17/06/2009 | 21/05/2009 | 1092 |
And some additional fields...
In GG-CE, the code has to:
- Filter SGSV data by admin-provided
String instCode
. - Find the matching
Accession
record by
accession_number === trim(a.accessionNumberPart1 + ' ')
+ (a.accessionNumberPart2 == null ? '' : a.accessionNumberPart2)
+ trim(' ' + a.accessionNumberPart3)
- If no match, skip.
- Create an
Inventory
for the accession with-
inventoryNumberPart1
<--"SGSV"
-
inventoryNumberPart2
<--sgsv_id
-
inventoryNumberPart3
<--null
-
formTypeCode
<--"SD"
- Check if such inventory exists and skip if it does.
-
site
<-- findSite
by WIEWS CODE NOR051 -
inventoryMaintenancePolicy
<-- find by name Backup Svalbard -
quantityOnHand
<-number_of_seeds
-
quantityOnHandUnitCode
<-"SD"
-
storageLocation1
<--year(date_of_deposit)
-
storageLocation2
<--deposit_box_number
-
???
<--date_of_deposit
-