batches

0 rows


Description

Information about batches of seedlings at nurseries.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id int8 19 null
batch_details_history.batch_id batch_details_history_batch_id_fkeyC
batch_photos.batch_id batch_photos_batch_id_fkeyR
batch_quantity_history.batch_id batch_quantity_history_batch_id_fkeyC
batch_sub_locations.batch_id batch_sub_locations_facility_id_batch_id_fkeyR
batch_withdrawals.batch_id batch_withdrawals_batch_id_fkeyC
batch_withdrawals.destination_batch_id batch_withdrawals_destination_batch_id_fkeyN
batches.initial_batch_id batches_initial_batch_id_fkeyN
withdrawals.batch_id withdrawals_batch_id_fkeyN

Globally-unique internal identifier for the batch. Not typically presented to end users; “batch_number” is the user-facing identifier.

version int4 10 null

Increases by 1 each time the batch is modified. Used to detect when clients have stale data about batches.

organization_id int8 19 null
organizations.id batches_organization_id_fkeyC

Which organization owns the nursery where this batch is located.

facility_id int8 19 null
batch_sub_locations.facility_id batch_sub_locations_facility_id_batch_id_fkeyR
facilities.id batches_facility_id_fkeyC

Which nursery contains the batch. Facility must be of type “Nursery” and under the same organization as the species ID (enforced in application code).

species_id int8 19 null
species.id batches_species_id_fkeyR

Species of the batch’s plants. Must be under the same organization as the facility ID (enforced in application code).

batch_number text 2147483647 null

User-friendly unique (per organization) identifier for the batch. Not used internally or in API; “id” is the internal identifier.

added_date date 13 null

User-supplied date the batch was added to the nursery’s inventory.

germinating_quantity int4 10 null

Number of germinating seedlings currently available in inventory. Withdrawals cause this to decrease.

not_ready_quantity int4 10 null

Number of not-ready-for-planting seedlings currently available in inventory. Withdrawals cause this to decrease.

ready_quantity int4 10 null

Number of ready-for-planting seedlings currently available in inventory. Withdrawals cause this to decrease.

latest_observed_germinating_quantity int4 10 null

Latest user-observed number of germinating seedlings currently available in inventory. Withdrawals do not cause this to decrease.

latest_observed_not_ready_quantity int4 10 null

Latest user-observed number of not-ready-for-planting seedlings currently available in inventory. Withdrawals do not cause this to decrease.

latest_observed_ready_quantity int4 10 null

Latest user-observed number of ready-for-planting seedlings currently available in inventory. Withdrawals do not cause this to decrease.

latest_observed_time timestamptz 35,6 null

When the latest user observation of seedling quantities took place.

created_by int8 19 null
users.id batches_created_by_fkeyR

Which user initially created the batch.

created_time timestamptz 35,6 null

When the batch was initially created.

modified_by int8 19 null
users.id batches_modified_by_fkeyR

Which user most recently modified the batch, either directly or by creating a withdrawal.

modified_time timestamptz 35,6 null

When the batch was most recently modified, either directly or by creating a withdrawal.

notes text 2147483647 null

User-supplied freeform notes about batch.

ready_by_date date 13 null

User-supplied estimate of when the batch will be ready for planting.

accession_id int8 19 null
accessions.id batches_accession_id_fkeyN

If the batch was created by a nursery transfer from a seed bank, the originating accession ID.

project_id int8 19 null
projects.id batches_project_id_fkeyN
substrate_id int4 10 null
batch_substrates.id batches_substrate_id_fkeyR
substrate_notes text 2147483647 null
treatment_id int4 10 null
seed_treatments.id batches_treatment_id_fkeyR
treatment_notes text 2147483647 null
germination_rate int4 10 null
loss_rate int4 10 null
initial_batch_id int8 19 null
batches.id batches_initial_batch_id_fkeyN
total_germinated int4 10 null

Total number of seedlings that have moved from Germinating to Not Ready status over the lifetime of the batch. This is the numerator for the germination rate calculation.

total_germination_candidates int4 10 null

Total number of seedlings that have been candidates for moving from Germinating to Not Ready status. This includes seedlings that are already germinated and germinating seedlings that were withdrawn as Dead, but does not include germinating seedlings that were withdrawn for other reasons. This is the denominator for the germination rate calculation.

total_lost int4 10 null

Total number of non-germinating (Not Ready and Ready) seedlings that have been withdrawn as Dead. This is the numerator for the loss rate calculation.

total_loss_candidates int4 10 null

Total number of non-germinating (Not Ready and Ready) seedlings that have been candidates for being withdrawn as dead. This includes seedlings that are still in the batch, seedlings that were withdrawn for outplanting, and seedlings that were already withdrawn as dead, but does not include germinating seedlings or seedlings that were withdrawn for other reasons. This is the denominator for the loss rate calculation.

Indexes

Constraint Name Type Sort Column(s)
batches_pkey Primary key Asc id
batches__species_id_ix Performance Asc species_id
batches_facility_id_id_key Must be unique Asc/Asc facility_id + id
batches_initial_batch_id_idx Performance Asc initial_batch_id
batches_organization_id_batch_number_key Must be unique Asc/Asc organization_id + batch_number
batches_organization_id_species_id_idx Performance Asc/Asc organization_id + species_id
batches_project_id_idx Performance Asc project_id

Check Constraints

Constraint Name Constraint
batches_germinating_quantity_check ((germinating_quantity >= 0))
batches_latest_observed_germinating_quantity_check ((latest_observed_germinating_quantity >= 0))
batches_not_ready_quantity_check ((not_ready_quantity >= 0))
batches_notes_check ((notes !~ similar_to_escape(' *'::text)))
batches_ready_quantity_check ((ready_quantity >= 0))
batches_version_check ((version > 0))
batches_latest_observed_not_ready_quantity_check ((latest_observed_not_ready_quantity >= 0))
batches_latest_observed_ready_quantity_check ((latest_observed_ready_quantity >= 0))

Relationships