Mass import

Mass import

If the software makes it possible to manually create samples or containers, the operation is often tedious and time consuming. To simplify the work, two import mechanisms are available.

The first, mass import, was created to initialize the database with a list of pre-existing samples, usually described in a spreadsheet. The second was designed to import samples from another database, allowing to associate the different reference tables (a 1-liter sample type can be associated, in the target database, with the type of sample bag 1L).

Regardless of the type of import, the application performs complex checks to limit the risk of database corruption. You will have to prefix each column (the first line of the file) by the name described in the import mask. If there are other columns than those described in the file, the check procedure will fail.

If anomalies are detected during checks, the import will not be possible, and you will have to start the whole operation again. A table showing the anomalies detected will be displayed.

After import, the generated UIDs are displayed (first – last).

Mass import


This module makes it possible to import samples or containers, and to create, if necessary, the input movements.
It only accepts files in CSV format. The header row must contain only the following columns :

  • sample_identifier : sample identifier (required)
  • collection_id : number of the collection (required)
  • sample_type_id : number of the sample type (required)
  • sample_status_id : number of the sample status (required)
  • sampling_place_id : computer number of the place where the sample was collected
  • wgs84_x : GPS longitude in WGS84 (decimal degrees)
  • wgs84_y : GPS latitude in WGS84 (decimal degrees)
  • sampling_date : date of creation / sampling of the sample, in the format yyyy-mm-dd
  • expiration_date : date of expiration / sampling of the sample, in the format yyyy-mm-dd
  • sample_location : the location of the sample in the container (free text)
  • sample_column : number of the storage column in the container
  • sample_line : number of the storage line in the container
  • sample_multiple_value : total number of sub-collections (or total volume, or percentage…) contained in the sample if the type of samples used allows it (numerical value, decimal point: point)
  • sample_parent_uid : sample parent UID  (creating attached samples)
  • sample_metadata_json : attached metadata to samples (json gormat, for example : {“taxon”:”Alosa alosa”})
  • it is also possible to define the metadata with one attribute per column. In this case, the column must be named md_nameAttribute, for example: md_taxon. The value of the md_xxx column will overwrites the value of the xxx attribute in the sample_metadata_json column
  • container_identifier : container identifier (required)
  • container_type_id : computer number of the container type (required)
  • container_status_id : computer number of the container status (required)
  • container_location : the location of the sample in the container (free text)
  • container_column : number of the storage column in the parent contenant
  • container_line : number of the storage line in the parent contenant
  • container_parent_uid : contenant parent UID

Computer codes can be viewed from the Settings menu

For additional identifiers :

  • find the codes in the settings menu > Types of IDs
  • you can only enter one code per line (but several types of possible codes)
  • they will be associated with the sample and container, if both are shown in the same line

The import will be realised in this way :

  • if sample_identifier is informed : sample creation
  • if container_identifier is informed : container creation
  • if container_identifier and container_parent_uid are informed : creation of the input movement of the container
  • if the sample and the container were created, creation of the sample input movement in the container
  • if the sample is created, if container_parent_uid is informed, and container_identifier is not filled, creation of the sample input movement in the indicated container

A sample file is available here : https://github.com/collec-science/collec-science/raw/master/database/import_data_structure.ods. Once the spreadsheet is complete, it must be saved in CSV format.

Transfer samples from a database to another


This module allows you to import samples from an external database from a CSV file. List of possible columns:

  • dbuid_origin (required) :  unique identifier in the original database with the format : code_base:id
  • identifier : identifier
  • sample_type_name (required) : type d’échantillon
  • collection_name (required) : name of the collection
  • object_status_name : object status
  • wgs84_x : GPS longitude in WGS84 (decimal degrees)
  • wgs84_y : GPS latitude in WGS84 (decimal degrees)
  • sample_creation_date : date of creation of the sample in the original database, in the format YYYY-MM-DD HH:MM:SS
  • sampling_date : sample date reference in the original database, in the format YYYY-MM-DD HH:MM:SS
  • expiration_date : date of expiration or end of validity of the sample
  • multiple_value : number or quantity of sub-samples available
  • sampling_place_name : place of sampling
  • metadata : list of associated metadata, in JSON format. It is also possible to define metadata in text format, respecting the following rules :
    • metadata field
    • each field must be prefixed by md_ to be recognized as such by the software
    • the field musn’t be in the metadata column le champ ne doit pas être présent dans la colonne metadata. Otherwise the value will be overwritten
  • identifiers : list of secondary identifiers, with the format : code1:val1,code2:val2
  • dbuid_parent : In the case of a derived sample, identifying the parent in the form base_code: identifier. This value is the dbuid_origin value of the parent sample. This must have been imported before the relationship can be created


Some complementary uses


How to update the metadata in a series of samples?

In a series of samples, you have defined metadata, one of which corresponds to the referent. You want to update the referent, following a change of assignment in your laboratory. This is easy by exporting the data and reimporting it after editing.

The metadata structure is  :

{"referent":"Jean Dupont","departement":"Doubs"}


Here are the operations to be performed :

  • select all the samples affected by the change;
  • export data in CSV format by cliking on the button Export vers une autre base ;
  • open the file with the spreahsheet (LibreOffice Calc, for example). Add a columnwhose name will be md_  followed by the attribute name. In our case : md_referent
  • in this column, correct the labels you want to edit
  • Once the file is saved in csv format, choose in Collec science, Objets > import d’échantillons externes
  • validate the different information, then launch the import: the samples will be updated with the information provided.
  • The metadata will be corrected taking into account the present value in the colmun md_referent.

You can easily use this method to modify all the samples informations.

Method originally described in the GITHUB forge by Alexandre Maindron.

Modification date : 15 May 2023 | Publication date : 22 March 2023 | Redactor : Éric Quinton