diff --git a/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotGeneticWorth.java b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotGeneticWorth.java index 872da14bb..9da5ec5db 100644 --- a/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotGeneticWorth.java +++ b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotGeneticWorth.java @@ -48,6 +48,12 @@ public class SeedlotGeneticWorth { @Column(name = "genetic_quality_value", precision = 4, scale = 1, nullable = false) private BigDecimal geneticQualityValue; + @Column(name = "tested_parent_tree_cont_pct", precision = 6, scale = 2) + private BigDecimal testedParentTreeContributionPercentage; + + @Column(name = "estimated_ind") + Boolean estimated; + @Embedded @NonNull private AuditInformation auditInformation; @Column(name = "revision_count", nullable = false) diff --git a/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotSeedPlanZoneEntity.java b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotSeedPlanZoneEntity.java new file mode 100644 index 000000000..2888d1fc5 --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/SeedlotSeedPlanZoneEntity.java @@ -0,0 +1,52 @@ +package ca.bc.gov.backendstartapi.entity; + +import ca.bc.gov.backendstartapi.entity.embeddable.AuditInformation; +import ca.bc.gov.backendstartapi.entity.seedlot.Seedlot; +import ca.bc.gov.backendstartapi.entity.seedlot.idclass.SeedlotSeedPlanZoneId; +import jakarta.persistence.Column; +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.IdClass; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.persistence.Version; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +/** This class represents a Seedlot Seed Plan Zone entity. */ +@Entity +@Table(name = "seedlot_smp_mix") +@IdClass(SeedlotSeedPlanZoneId.class) +@NoArgsConstructor(access = AccessLevel.PACKAGE) +@RequiredArgsConstructor +@Getter +@Setter +public class SeedlotSeedPlanZoneEntity { + + // region Identifier + @Id + @JoinColumn(name = "seedlot_number") + @ManyToOne + @NonNull + private Seedlot seedlot; + + @Id + @Column(name = "seed_plan_zone_code", length = 3, nullable = false) + @NonNull + private String seedPlanZoneCode; + + // endregion + + @Embedded private AuditInformation auditInformation; + + @Column(name = "revision_count", nullable = false) + @Version + @Setter(AccessLevel.NONE) + private int revisionCount; +} diff --git a/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/Seedlot.java b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/Seedlot.java index 89eb5c3d4..9498f3782 100644 --- a/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/Seedlot.java +++ b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/Seedlot.java @@ -119,6 +119,9 @@ public class Seedlot implements Serializable { @Column(name = "interm_facility_code", length = 3) private String interimStorageFacilityCode; + @Column(name = "interm_strg_locn", length = 55) + private String interimStorageLocationDescription; + // endregion // region Orchard @@ -159,12 +162,6 @@ public class Seedlot implements Serializable { @Column(name = "effective_pop_size", precision = 5, scale = 1) private BigDecimal effectivePopulationSize; - @Column(name = "tested_parent_tree_cont_pct", precision = 6, scale = 2) - private BigDecimal testedParentTreeContributionPercentage; - - @Column(name = "coancestry", precision = 20, scale = 10) - private BigDecimal coancestry; - @Column(name = "smp_parents_outside") private Integer parentsOutsideTheOrchardUsedInSmp; @@ -186,16 +183,16 @@ public class Seedlot implements Serializable { @Column(name = "extraction_end_date") private LocalDateTime extractionEndDate; - @Column(name = "storage_client_number", length = 8) + @Column(name = "temporary_strg_client_number", length = 8) private String storageClientNumber; - @Column(name = "storage_locn_code", length = 2) + @Column(name = "temporary_strg_locn_code", length = 2) private String storageLocationCode; - @Column(name = "temporary_storage_start_date") + @Column(name = "temporary_strg_start_date") private LocalDateTime temporaryStorageStartDate; - @Column(name = "temporary_storage_end_date") + @Column(name = "temporary_strg_end_date") private LocalDateTime temporaryStorageEndDate; // endregion diff --git a/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/idclass/SeedlotSeedPlanZoneId.java b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/idclass/SeedlotSeedPlanZoneId.java new file mode 100644 index 000000000..92f57c53d --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/backendstartapi/entity/seedlot/idclass/SeedlotSeedPlanZoneId.java @@ -0,0 +1,23 @@ +package ca.bc.gov.backendstartapi.entity.seedlot.idclass; + +import ca.bc.gov.backendstartapi.entity.SeedlotSeedPlanZoneEntity; +import lombok.AccessLevel; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +/** Composite key for {@link SeedlotSeedPlanZoneEntity}. */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +@RequiredArgsConstructor +@Getter +@Setter +@EqualsAndHashCode +public class SeedlotSeedPlanZoneId { + + @NonNull private String seedlot; + + @NonNull private String seedPlanZoneCode; +} diff --git a/backend/src/main/resources/db/migration/V21__pt_number_pt_tested_pct.sql b/backend/src/main/resources/db/migration/V21__pt_number_pt_tested_pct.sql new file mode 100644 index 000000000..b65e87023 --- /dev/null +++ b/backend/src/main/resources/db/migration/V21__pt_number_pt_tested_pct.sql @@ -0,0 +1,223 @@ +-- All tables in the script need to be recreated as there is no other way to add columns in a specific position. Once a table is being used by the application, it will only be possible to add columns at the end of the table. +-- Moving tested_parent_tree_cont_pct column from seedlot table to seedlot_genetic_worth table. +alter table spar.seedlot drop column tested_parent_tree_cont_pct; +alter table spar.seedlot drop column coancestry; + +alter table spar.seedlot rename column storage_client_number to temporary_strg_client_number; +alter table spar.seedlot rename column storage_locn_code to temporary_strg_locn_code; +alter table spar.seedlot rename column temporary_storage_start_date to temporary_strg_start_date; +alter table spar.seedlot rename column temporary_storage_end_date to temporary_strg_end_date; + +alter table spar.seedlot add column interm_strg_locn varchar(55); +comment on column spar.seedlot.interm_strg_locn is 'The location where the tree seed was stored during interim storage. Can be used if users did not enter a registered client data.'; + +drop table spar.seedlot_genetic_worth; + +create table spar.seedlot_genetic_worth ( + seedlot_number varchar(5) not null, + genetic_worth_code varchar(3) not null, + genetic_quality_value decimal(4, 1) not null, + tested_parent_tree_cont_pct decimal(6, 2), + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint seedlot_genetic_worth_pk + primary key(seedlot_number, genetic_worth_code), + constraint seedlot_genet_worth_seedlot_fk + foreign key(seedlot_number) references spar.seedlot(seedlot_number) +); + +comment on table spar.seedlot_genetic_worth is 'A subclassification of Genetic Quality for "A" class Seedlots.'; +comment on column spar.seedlot_genetic_worth.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.seedlot_genetic_worth.genetic_worth_code is 'A code which represents a subclassification of Genetic Quality for "A" class seedlots.'; +comment on column spar.seedlot_genetic_worth.genetic_quality_value is 'The rating for a subclassification of Genetic Quality for "A" class seedlots.'; +comment on column spar.seedlot_genetic_worth.tested_parent_tree_cont_pct is 'Percentage of parent trees that were tested for the trait and contributed to the seedlot'; +comment on column spar.seedlot_genetic_worth.entry_userid is 'The userid of the individual that entered the Seedlot Genetic Worth.'; +comment on column spar.seedlot_genetic_worth.entry_timestamp is 'The time and date a Seedlot Genetic Worth was entered onto the system.'; +comment on column spar.seedlot_genetic_worth.update_userid is 'The userid of the individual that changed the Seedlot Genetic Worth.'; +comment on column spar.seedlot_genetic_worth.update_timestamp is 'The time and date a Seedlot Genetic Worth was last updated on the system.'; +comment on column spar.seedlot_genetic_worth.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; + +-- Adding parent_tree_number to seedlot_parent_tree table. Need to recreate the tables that references seedlot_parent_tree (seedlot_parent_tree_smp_mix and seedlot_parent_tree_gen_qlty). +drop table spar.seedlot_parent_tree_smp_mix; +drop table spar.seedlot_parent_tree_gen_qlty; +drop table spar.seedlot_parent_tree; + +create table spar.seedlot_parent_tree ( + seedlot_number varchar(5) not null, + parent_tree_id int not null, + parent_tree_number varchar(5) not null, + cone_count decimal(20, 10) not null, + pollen_count decimal(20, 10) not null, + smp_success_pct int, + non_orchard_pollen_contam_pct int, + total_genetic_worth_contrib decimal(15, 11), + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint seedlot_parent_tree_pk + primary key(seedlot_number, parent_tree_id), + constraint seedlot_parent_tree_seedlot_fk + foreign key(seedlot_number) references spar.seedlot(seedlot_number) +); + +comment on table spar.seedlot_parent_tree is 'The contribution of Parent Trees (with their cone and pollen quantity of each Parent Tree) to an Orchard Seedlot (Genetic Class = "A")'; +comment on column spar.seedlot_parent_tree.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.seedlot_parent_tree.parent_tree_id is 'A unique identifier for each Parent Tree.'; +comment on column spar.seedlot_parent_tree.parent_tree_number is 'The original registration number given to a Parent Tree in conjunction with a Species Code.'; +comment on column spar.seedlot_parent_tree.cone_count is 'The number of cones counted or estimated from each Parent Tree for a Seedlot.'; +comment on column spar.seedlot_parent_tree.pollen_count is 'The amount of pollen counted or estimated for each Parent Tree in the Seedlot.'; +comment on column spar.seedlot_parent_tree.smp_success_pct is 'The estimated success (percent) of the supplemental mass pollination mix on the Parent Trees in the Orchard.'; +comment on column spar.seedlot_parent_tree.non_orchard_pollen_contam_pct is 'Non-orchard pollen contamination (%).'; +comment on column spar.seedlot_parent_tree.total_genetic_worth_contrib is 'Total Parent (seed) genetic worth contribution to seedlot'; +comment on column spar.seedlot_parent_tree.entry_userid is 'The userid of the individual that entered the Seedlot Parent Tree.'; +comment on column spar.seedlot_parent_tree.entry_timestamp is 'The time and date a Seedlot Parent Tree was entered onto the system.'; +comment on column spar.seedlot_parent_tree.update_userid is 'The userid of the individual that changed the Seedlot Parent Tree.'; +comment on column spar.seedlot_parent_tree.update_timestamp is 'The time and date a Seedlot Parent Tree was last updated on the system.'; +comment on column spar.seedlot_parent_tree.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; + + +create table spar.seedlot_parent_tree_gen_qlty ( + seedlot_number varchar(5) not null, + parent_tree_id int not null, + genetic_type_code varchar(2) not null, + genetic_worth_code varchar(3) not null, + genetic_quality_value decimal(4, 1) not null, + estimated_ind boolean, + untested_ind boolean, + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int, + constraint seedlot_parent_tree_gen_qlt_pk + primary key(seedlot_number, parent_tree_id, genetic_type_code, genetic_worth_code), + constraint sl_ptree_genqly_sl_ptree_fk + foreign key(seedlot_number, parent_tree_id) references spar.seedlot_parent_tree(seedlot_number, parent_tree_id) +); + +comment on table spar.seedlot_parent_tree_gen_qlty is 'The Genetic Worth value(s) for an Orchard Seedlot (Genetic Class = "A") calculated from the Genetic Quality (Breeding Values) of the Parent Trees contributing to the Seedlot.'; +comment on column spar.seedlot_parent_tree_gen_qlty.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.seedlot_parent_tree_gen_qlty.parent_tree_id is 'A unique identifier for each Parent Tree.'; +comment on column spar.seedlot_parent_tree_gen_qlty.genetic_type_code is 'Describes the comparative measure of genetic value for a specific genetic trait of a Parent Tree. Examples are BV (Breeding Value) and CV (Clonal Value).'; +comment on column spar.seedlot_parent_tree_gen_qlty.genetic_worth_code is 'A code describing various Genetic Worths.'; +comment on column spar.seedlot_parent_tree_gen_qlty.genetic_quality_value is 'The Genetic Quality value based on the test assessment for a Parent Tree from a test no. and series.'; +comment on column spar.seedlot_parent_tree_gen_qlty.estimated_ind is 'Indicates whether or not the test result was estimated. A Genetic Quality value of 2.0 is estimated for Untested Parent Trees (i.e. Parent Trees without an Area of Use) or for Tested Parent Trees (i.e. Parent Trees with an Area of Use) without a Genetic.'; +comment on column spar.seedlot_parent_tree_gen_qlty.untested_ind is 'Indicates whether or not the test result was estimated for an untested Parent Tree.'; +comment on column spar.seedlot_parent_tree_gen_qlty.entry_userid is 'The userid of the individual that entered the Seedlot Parent Tree Genetic Quality.'; +comment on column spar.seedlot_parent_tree_gen_qlty.entry_timestamp is 'The time and date a Seedlot Parent Tree Genetic Quality was entered onto the system.'; +comment on column spar.seedlot_parent_tree_gen_qlty.update_userid is 'The userid of the individual that changed the Seedlot Parent Tree Genetic Quality.'; +comment on column spar.seedlot_parent_tree_gen_qlty.update_timestamp is 'The time and date a Seedlot Parent Tree Genetic Quality was last updated on the system.'; +comment on column spar.seedlot_parent_tree_gen_qlty.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; + +create table spar.seedlot_parent_tree_smp_mix ( + seedlot_number varchar(5) not null, + parent_tree_id int not null, + genetic_type_code varchar(2) not null, + genetic_worth_code varchar(3) not null, + genetic_quality_value decimal(4, 1) not null, + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint seedlot_parent_tree_smp_mix_pk + primary key(seedlot_number, parent_tree_id, genetic_type_code, genetic_worth_code), + constraint sl_ptree_smp_mix_sl_ptree_fk + foreign key(seedlot_number, parent_tree_id) references spar.seedlot_parent_tree(seedlot_number, parent_tree_id) +); + +comment on table spar.seedlot_parent_tree_smp_mix is 'Supplemental Mass Polination for a given Seedlot, Parent Tree, Genetic Type and Genetic worth combination.'; +comment on column spar.seedlot_parent_tree_smp_mix.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.seedlot_parent_tree_smp_mix.parent_tree_id is 'A unique identifier for each Parent Tree.'; +comment on column spar.seedlot_parent_tree_smp_mix.genetic_type_code is 'Describes the comparative measure of genetic value for a specific genetic trait of a Parent Tree. Examples are BV (Breeding Value) and CV (Clonal Value).';; +comment on column spar.seedlot_parent_tree_smp_mix.genetic_worth_code is 'A code describing various Genetic Worths.';; +comment on column spar.seedlot_parent_tree_smp_mix.genetic_quality_value is 'The Genetic Quality value based on the test assessment for a Parent Tree from a test no. and series.'; +comment on column spar.seedlot_parent_tree_smp_mix.entry_userid is 'The userid of the individual that entered the Parent Tree SMP mix'; +comment on column spar.seedlot_parent_tree_smp_mix.entry_timestamp is 'The time and date a Parent Tree SMP mix was entered onto the system.'; +comment on column spar.seedlot_parent_tree_smp_mix.update_userid is 'The userid of the individual that changed the Parent Tree SMP mix.'; +comment on column spar.seedlot_parent_tree_smp_mix.update_timestamp is 'The time and date a Parent Tree SMP mix was last updated on the system.'; +comment on column spar.seedlot_parent_tree_smp_mix.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; + +-- Adding parent_tree_number to seedlot_parent_tree table. Need to recreate the table that references smp_mix (smp_mix_gen_qlty). +drop table spar.smp_mix_gen_qlty; +drop table spar.smp_mix; + +create table spar.smp_mix ( + seedlot_number varchar(5) not null, + parent_tree_id int not null, + parent_tree_number varchar(5) not null, + amount_of_material int not null, + proportion decimal(20,10), + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint smp_mix_pk + primary key(seedlot_number, parent_tree_id), + constraint smp_mix_seedlot_fk + foreign key(seedlot_number) references spar.seedlot(seedlot_number) +); + +comment on table spar.smp_mix is 'A table listing the individual Parent Trees that contributed to the Supplemental Mass Pollination mix of an Orchard Seedlot (Genetic Class = "A").'; +comment on column spar.smp_mix.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.smp_mix.parent_tree_id is 'A unique identifier for each Parent Tree.'; +comment on column spar.smp_mix.parent_tree_number is 'The original registration number given to a Parent Tree in conjunction with a Species Code.'; +comment on column spar.smp_mix.amount_of_material is 'The amount of Parent Tree material used for calculating the proportion of mix. Usually a volume recorded in mL.'; +comment on column spar.smp_mix.proportion is 'The proportion of each Parent Tree material used for calculating SMP mix.'; +comment on column spar.smp_mix.entry_userid is 'The userid of the individual that entered the SMP mix.'; +comment on column spar.smp_mix.entry_timestamp is 'The time and date a SMP mix was entered onto the system.'; +comment on column spar.smp_mix.update_userid is 'The userid of the individual that changed the SMP mix.'; +comment on column spar.smp_mix.update_timestamp is 'The time and date a SMP mix was last updated on the system.'; +comment on column spar.smp_mix.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; + + +create table spar.smp_mix_gen_qlty ( + seedlot_number varchar(5) not null, + parent_tree_id int not null, + genetic_type_code varchar(2) not null, + genetic_worth_code varchar(3) not null, + genetic_quality_value decimal(4, 1) not null, + estimated_ind boolean, + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint smp_mix_gen_qlty_pk + primary key(seedlot_number, parent_tree_id, genetic_type_code, genetic_worth_code), + constraint smp_mix_gen_qlty_smp_mix_pk + foreign key(seedlot_number, parent_tree_id) references spar.smp_mix(seedlot_number, parent_tree_id) +); + +comment on table spar.smp_mix_gen_qlty is 'The calculated Genetic Worth value(s) for the Supplemental Mass Pollination mix that contributed to an Orchard Seedlot (Genetic Class = "A") the Parent Trees contributing to a Seedlot.'; +comment on column spar.smp_mix_gen_qlty.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.smp_mix_gen_qlty.parent_tree_id is 'A unique identifier for each Parent Tree.'; +comment on column spar.smp_mix_gen_qlty.genetic_type_code is 'Describes the comparative measure of genetic value for a specific genetic trait of a Parent Tree. Examples are BV (Breeding Value) and CV (Clonal Value).'; +comment on column spar.smp_mix_gen_qlty.genetic_worth_code is 'A code describing various Genetic Worths.'; +comment on column spar.smp_mix_gen_qlty.genetic_quality_value is 'The Genetic Quality value based on the test assessment for a Parent Tree from a test no. and series.'; +comment on column spar.smp_mix_gen_qlty.entry_userid is 'The userid of the individual that entered the SMP mix Genetic Quality.'; +comment on column spar.smp_mix_gen_qlty.entry_timestamp is 'The time and date a SMP mix Genetic Quality was entered onto the system.'; +comment on column spar.smp_mix_gen_qlty.update_userid is 'The userid of the individual that changed the SMP mix Genetic Quality.'; +comment on column spar.smp_mix_gen_qlty.update_timestamp is 'The time and date a SMP mix Genetic Quality was last updated on the system.'; +comment on column spar.smp_mix_gen_qlty.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; + +create table spar.seedlot_smp_mix ( + seedlot_number varchar(5) not null, + genetic_worth_code varchar(3) not null, + genetic_quality_value decimal(4, 1) not null, + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint seedlot_smp_mix_pk + primary key(seedlot_number, genetic_worth_code), + constraint seedlot_smp_mix_seedlot_fk + foreign key(seedlot_number) references spar.seedlot(seedlot_number) +); \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V22__area_of_use.sql b/backend/src/main/resources/db/migration/V22__area_of_use.sql new file mode 100644 index 000000000..a458db644 --- /dev/null +++ b/backend/src/main/resources/db/migration/V22__area_of_use.sql @@ -0,0 +1,103 @@ +-- Geographic data columns +alter table spar.seedlot + add column seed_plan_unit_id smallint, + add column bgc_zone_code varchar(4), + add column bgc_subzone_code varchar(3), + add column variant varchar(1), + add column bec_version_id smallint, + add column elevation smallint, + add column latitude_degrees smallint, + add column latitude_minutes smallint, + add column latitude_seconds smallint, + add column longitude_degrees smallint, + add column longitude_minutes smallint, + add column longitude_seconds smallint, + add column collection_elevation smallint, + add column collection_elevation_min smallint, + add column collection_elevation_max smallint, + add column collection_latitude_deg smallint, + add column collection_latitude_min smallint, + add column collection_latitude_sec smallint, + add column collection_latitude_code varchar(1), + add column collection_longitude_deg smallint, + add column collection_longitude_min smallint, + add column collection_longitude_sec smallint, + add column collection_longitude_code varchar(1), + add column elevation_min smallint, + add column elevation_max smallint, + add column latitude_deg_min smallint, + add column latitude_min_min smallint, + add column latitude_sec_min smallint, + add column latitude_deg_max smallint, + add column latitude_min_max smallint, + add column latitude_sec_max smallint, + add column longitude_deg_min smallint, + add column longitude_min_min smallint, + add column longitude_sec_min smallint, + add column longitude_deg_max smallint, + add column longitude_min_max smallint, + add column longitude_sec_max smallint, + add column smp_mean_bv_growth decimal(4, 1), + add column area_of_use_comment varchar(2000); + +comment on column spar.seedlot.seed_plan_unit_id is 'A unique identifier which is assigned to a Seed Planning Unit.'; +comment on column spar.seedlot.bgc_zone_code is 'The Biogeoclimatic Zone of the Seedlot collection area.'; +comment on column spar.seedlot.bgc_subzone_code is 'The Biogeoclimatic Subzone of the Seedlot collection area.'; +comment on column spar.seedlot.variant is 'A division of biogeoclimatic information, with multiple variants in a BGC Subzone.'; +comment on column spar.seedlot.bec_version_id is 'A sequence generated identifier for each BEC version.'; +comment on column spar.seedlot.elevation is 'The representative elevation in meters where the seed lot originated, which is also the mean area of use elevation for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source elevations.'; +comment on column spar.seedlot.latitude_degrees is 'The representative latitude (degrees) where the seed lot originated, which is also the mean area of use latitude for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source latitudes.'; +comment on column spar.seedlot.latitude_minutes is 'The representative latitude (minutes) where the seed lot originated, which is also the mean area of use latitude for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source latitudes.'; +comment on column spar.seedlot.latitude_seconds is 'The representative latitude (seconds) where the seed lot originated, which is also the mean area of use latitude for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source latitudes.'; +comment on column spar.seedlot.longitude_degrees is 'The representative longitude (degrees) where the seed lot originated, which is also the mean area of use longitude for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source longitudes.'; +comment on column spar.seedlot.longitude_minutes is 'The representative longitude (minutes) where the seed lot originated, which is also the mean area of use longitude for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source longitudes.'; +comment on column spar.seedlot.longitude_seconds is 'The representative longitude (seconds) where the seed lot originated, which is also the mean area of use longitude for natural stand lots. For orchard seed lots it is a weighted average of the contributing parent trees source longitudes.'; +comment on column spar.seedlot.collection_elevation is 'The representative elevation in meters of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source elevations.'; +comment on column spar.seedlot.collection_elevation_min is 'The representative minimum elevation in meters of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source elevations.'; +comment on column spar.seedlot.collection_elevation_max is 'The representative maximum elevation in meters of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source elevations.'; +comment on column spar.seedlot.collection_latitude_deg is 'The representative latitude (degrees) of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source latitude.'; +comment on column spar.seedlot.collection_latitude_min is 'The representative latitude (minutes) of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source latitude.'; +comment on column spar.seedlot.collection_latitude_sec is 'The representative latitude (seconds) of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source latitude.'; +comment on column spar.seedlot.collection_latitude_code is 'A code which specifies whether the exotic origin latitude is north (N) or south (S).'; +comment on column spar.seedlot.collection_longitude_deg is 'The representative longitude (degrees) of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source longitude.'; +comment on column spar.seedlot.collection_longitude_min is 'The representative longitude (minutes) of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source longitude.'; +comment on column spar.seedlot.collection_longitude_sec is 'The representative longitude (seconds) of the Seedlot collection area. For orchard seedlots it is a weighted average of the contributing parent trees source longitude.'; +comment on column spar.seedlot.collection_longitude_code is 'A code which specifies whether the exotic origin longitude is east (E) or west (W).'; +comment on column spar.seedlot.elevation_min is 'The minimum elevation of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.elevation_max is 'The maximum elevation of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.latitude_deg_min is 'The minimum latitude (degrees) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.latitude_min_min is 'The minimum latitude (minutes) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.latitude_sec_min is 'The minimum latitude (seconds) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.latitude_deg_max is 'The maximum latitude (degrees) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.latitude_min_max is 'The maximum latitude (minutes) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.latitude_sec_max is 'The maximum latitude (seconds) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.longitude_deg_min is 'The minimum longitude (degrees) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.longitude_min_min is 'The minimum longitude (minutes) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.longitude_sec_min is 'The minimum longitude (seconds) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.longitude_deg_max is 'The maximum longitude (degrees) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.longitude_min_max is 'The maximum longitude (minutes) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.longitude_sec_max is 'The maximum longitude (seconds) of the seedlot area of use. For lots from natural stands, this is calculated using the transfer limits. For lots from tested parent trees (orchards) either use Seed Planning Unit minimum or the collection latitude.'; +comment on column spar.seedlot.smp_mean_bv_growth is 'The breeding value for the Growth trait calculated from the supplemental mass pollination mix applied to parent trees.'; +comment on column spar.seedlot.area_of_use_comment is 'Comments on Seedlot area of use.'; + +create table spar.seedlot_seed_plan_zone ( + seedlot_number varchar(5) not null, + seed_plan_zone_code varchar(3) not null, + entry_userid varchar(30) not null, + entry_timestamp timestamp not null, + update_userid varchar(30) not null, + update_timestamp timestamp not null, + revision_count int not null, + constraint seedlot_seed_plan_zone_pk + primary key(seedlot_number, seed_plan_zone_code), + constraint seedlot_seedplan_zn_seedlot_fk + foreign key(seedlot_number) references spar.seedlot(seedlot_number) +); + +comment on column spar.seedlot_seed_plan_zone.seedlot_number is 'The unique number (key) assigned to a quantity of seed of a particular species and quality from a given location collected at a given time.'; +comment on column spar.seedlot_seed_plan_zone.seed_plan_zone_code is 'A code describing various Seed Planning Zones.'; +comment on column spar.seedlot_seed_plan_zone.entry_userid is 'The userid of the individual that entered the Seedlot collection method.'; +comment on column spar.seedlot_seed_plan_zone.entry_timestamp is 'The time and date a Seedlot collection method was entered onto the system.'; +comment on column spar.seedlot_seed_plan_zone.update_userid is 'The userid of the individual that changed the Seedlot collection method.'; +comment on column spar.seedlot_seed_plan_zone.update_timestamp is 'The time and date a Seedlot collection method was last updated on the system.'; +comment on column spar.seedlot_seed_plan_zone.revision_count is 'A counter used to ensure data integrity. This item should be incremented during each update.'; diff --git a/backend/src/test/java/ca/bc/gov/backendstartapi/repository/seedlot/SeedlotEntityRelationalTest.java b/backend/src/test/java/ca/bc/gov/backendstartapi/repository/seedlot/SeedlotEntityRelationalTest.java index 5b329b337..2a5186555 100644 --- a/backend/src/test/java/ca/bc/gov/backendstartapi/repository/seedlot/SeedlotEntityRelationalTest.java +++ b/backend/src/test/java/ca/bc/gov/backendstartapi/repository/seedlot/SeedlotEntityRelationalTest.java @@ -87,8 +87,6 @@ protected Seedlot createSeedlot(String id) { seedlot.setTotalParentTrees(10); seedlot.setSmpSuccessPercentage(70); seedlot.setEffectivePopulationSize(new BigDecimal(300)); - seedlot.setTestedParentTreeContributionPercentage(new BigDecimal(80)); - seedlot.setCoancestry(new BigDecimal(30)); seedlot.setParentsOutsideTheOrchardUsedInSmp(20); seedlot.setNonOrchardPollenContaminationPercentage(50);