Creating Specimen Hierarchies with Auto-Generated Labels
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Creating Specimen Hierarchies with Auto-Generated Labels

Unplanned specimens:

When using bulk import with auto-generated labels, you cannot create a full specimen hierarchy (e.g., New > Derived > Aliquots) in a single file.
Reason: To create a child specimen, you need the Parent Specimen Label. In the case of auto-generated labels, this is not known until the parent specimen has been created.

Planned specimens

This is not an issue with planned specimens, since you can use SR_CODE for both the parent and child specimens, which can be used to link the parent and child specimens.


How to create unplanned child specimens?

Option 1: Do not use auto-labels. (Recommended)

If it's okay that the specimens you create with bulk import don’t match the label format set in the system, follow the steps below.

  1. Disable the auto-label in CP

  2. Generate the labels in your CSV (via some script or Excel formulas).

  3. Import the file

  4. Enable the auto-labels in CP

Option 2: Import CSV in multiple steps

If you want OpenSpecimen-generated labels to maintain consistency, follow the steps below.

This would be a lot of work. Depending on the depth of the hierarchy you are trying to create, you will have to split the CSV into multiple files. Also, after every import, you have to download the labels and copy them into the CSV of the next hierarchy.
Example: If you want to create a 3-level hierarchy, i.e., New, Derived, and Aliquots, then you will have to split the information into 3 files, one for each level.

  1. Import a CSV file containing only the top-level specimens (e.g., the New specimens).

  2. Export Their Labels: Run a query to find the specimens you just imported (e.g., Lineage Equals New). Export the results, making sure to include the Specimen Label column.

    image-20250729-100639.png
    image-20250729-100918.png
  3. Create your next CSV file (for the Derived specimens, you can refer to Specimen Derivative CSV). Copy the labels from the export file and paste them into the Parent Specimen Label column for the correct child specimens.

  4. Import the Derived specimen CSV file.

  5. Repeat steps 2-4 for each subsequent level.
    For example, to add Aliquots (Specimen Aliquots CSV), you would first query for Derived specimens to get their labels, then use those labels in your Aliquot import file.

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com