Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
stylenone

Introduction

This document provides instructions for using two Python scripts that interact with the OpenSpecimen API to reserve and unreserve specimens. These scripts accept a CSV input file and perform the necessary actions using OpenSpecimen’s API endpoints.

...

  • reserveSpecimens.py: Reserves the specimens based on the information in the CSV file.

  • unreserveSpecimens.py: Unreserves the specimens based on the information in the CSV file.

Prerequisites

Before running the scripts, ensure that you have the following:

  • Python 3.x installed on your system.

  • The required Python libraries (e.g., requests) installed.

  • Access to the OpenSpecimen API with admin credentials.

  • A valid CSV input file with the distribution protocol and specimen ID to be reserved or unreserved.

Parameters

The scripts accept four parameters:

...

To generate the CSV file you can create use a OpenSpecimen Query module.

Steps to create a parametrized query to get distribution protocol short title and specimen identifier are:
A. Login to OpenSpeicmen → Navigate To → Query → Create
B. Select Specimen → Label → ALL as shown in the below image.

Screenshot from 2024-12-17 19-29-41.png

C. Click on View Records → Actions → Columns → Select Only Needed Columns → Done
Output:

Screenshot from 2024-12-17 19-32-42.png

...