Merge pull request #651 from nowcommunity/species_export

Species export
This commit is contained in:
juhanikat
2025-01-12 11:04:07 +02:00
committed by GitHub
4 changed files with 359 additions and 81 deletions
+34 -9
View File
@@ -10,22 +10,47 @@ export const getAllSpecies = async () => {
const result = await nowDb.com_species.findMany({
select: {
species_id: true,
subclass_or_superorder_name: true,
order_name: true,
suborder_or_superfamily_name: true,
family_name: true,
subfamily_name: true,
genus_name: true,
species_name: true,
subclass_or_superorder_name: true,
suborder_or_superfamily_name: true,
subfamily_name: true,
unique_identifier: true,
taxonomic_status: true,
common_name: true,
sp_author: true,
strain: true,
gene: true,
sv_length: true,
body_mass: true,
brain_mass: true,
sp_status: true,
sd_size: true,
sd_display: true,
tshm: true,
tht: true,
horizodonty: true,
crowntype: true,
cusp_shape: true,
cusp_count_buccal: true,
cusp_count_lingual: true,
loph_count_lon: true,
loph_count_trs: true,
fct_al: true,
fct_ol: true,
fct_sf: true,
fct_ot: true,
fct_cm: true,
microwear: true,
mesowear: true,
mw_or_high: true,
mw_or_low: true,
mw_cs_sharp: true,
mw_cs_round: true,
mw_cs_blunt: true,
diet1: true,
diet2: true,
diet3: true,
locomo1: true,
locomo2: true,
locomo3: true,
sp_comment: true,
},
})
@@ -107,7 +107,7 @@ export const SpeciesTab = () => {
{
lid: editData.lid,
species_id: newSpecies.species_id,
com_species: { ...(newSpecies as SpeciesDetailsType) },
com_species: { ...(newSpecies as unknown as SpeciesDetailsType) },
rowState: 'new',
},
],
@@ -129,7 +129,7 @@ export const SpeciesTab = () => {
{
lid: editData.lid,
species_id: newSpecies.species_id,
com_species: { ...(newSpecies as SpeciesDetailsType) },
com_species: { ...(newSpecies as unknown as SpeciesDetailsType) },
rowState: 'new',
},
],
+285 -57
View File
@@ -14,13 +14,6 @@ export const SpeciesTable = ({ selectorFn }: { selectorFn?: (id: Species) => voi
size: 20,
enableColumnFilterModes: false,
},
{
id: 'subclass_or_superorder_name',
accessorFn: row => row.subclass_or_superorder_name || '',
header: 'Subclass or Superorder',
size: 20,
filterFn: 'contains',
},
{
id: 'order_name',
accessorFn: row => row.order_name || '',
@@ -28,13 +21,6 @@ export const SpeciesTable = ({ selectorFn }: { selectorFn?: (id: Species) => voi
size: 20,
filterFn: 'contains',
},
{
id: 'suborder_or_superfamily_name',
accessorFn: row => row.suborder_or_superfamily_name || '',
header: 'Suborder or Superfamily',
size: 20,
filterFn: 'contains',
},
{
id: 'family_name',
accessorFn: row => row.family_name || '',
@@ -42,13 +28,6 @@ export const SpeciesTable = ({ selectorFn }: { selectorFn?: (id: Species) => voi
size: 20,
filterFn: 'contains',
},
{
id: 'subfamily_name',
accessorFn: row => row.subfamily_name || '',
header: 'Subfamily or Tribe',
size: 20,
filterFn: 'contains',
},
{
id: 'genus_name',
accessorFn: row => row.genus_name || '',
@@ -65,6 +44,27 @@ export const SpeciesTable = ({ selectorFn }: { selectorFn?: (id: Species) => voi
enableHiding: false,
filterFn: 'contains',
},
{
id: 'subclass_or_superorder_name',
accessorFn: row => row.subclass_or_superorder_name || '',
header: 'Subclass or Superorder',
size: 20,
filterFn: 'contains',
},
{
id: 'suborder_or_superfamily_name',
accessorFn: row => row.suborder_or_superfamily_name || '',
header: 'Suborder or Superfamily',
size: 20,
filterFn: 'contains',
},
{
id: 'subfamily_name',
accessorFn: row => row.subfamily_name || '',
header: 'Subfamily or Tribe',
size: 20,
filterFn: 'contains',
},
{
id: 'unique_identifier',
accessorFn: row => row.unique_identifier || '',
@@ -80,62 +80,290 @@ export const SpeciesTable = ({ selectorFn }: { selectorFn?: (id: Species) => voi
filterFn: 'contains',
},
{
id: 'common_name',
accessorFn: row => row.common_name || '',
header: 'Common Name',
size: 20,
filterFn: 'contains',
},
{
id: 'sp_author',
accessorFn: row => row.sp_author || '',
header: 'Author',
size: 20,
filterFn: 'contains',
},
{
id: 'strain',
accessorFn: row => row.strain || '',
header: 'Strain',
size: 20,
filterFn: 'contains',
},
{
id: 'gene',
accessorFn: row => row.gene || '',
header: 'Gene',
size: 20,
id: 'sv_length',
accessorFn: row => row.sv_length || '',
header: 'Snout-Vent Length',
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'body_mass',
accessorFn: row => row.body_mass || '',
header: 'Body Mass',
size: 20,
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'brain_mass',
accessorFn: row => row.brain_mass || '',
header: 'Brain Mass',
size: 20,
id: 'sd_size',
accessorFn: row => row.sd_size || '',
header: 'Sexual Dimorphism - Size',
size: 10,
filterFn: 'contains',
},
{
id: 'sd_display',
accessorFn: row => row.sd_display || '',
header: 'Sexual Dimorphism - Display',
size: 10,
filterFn: 'contains',
},
{
id: 'tshm',
accessorFn: row => row.tshm || '',
header: 'Tooth Shape - Multicuspid',
size: 10,
filterFn: 'contains',
},
{
id: 'tht',
accessorFn: row => row.tht || '',
header: 'Hypsodonty',
size: 10,
filterFn: 'contains',
},
{
id: 'horizodonty',
accessorFn: row => row.horizodonty || '',
header: 'Horizodonty',
size: 10,
filterFn: 'contains',
},
{
id: 'crowntype',
accessorFn: row => row.crowntype || '',
header: 'Crown Type',
size: 10,
filterFn: 'contains',
},
{
id: 'crowntype',
accessorFn: row => row.crowntype || '',
header: 'Developmental Crown Type',
size: 10,
filterFn: 'contains',
},
{
id: 'cusp_shape',
accessorFn: row => row.cusp_shape || '',
header: 'Cusp shape',
size: 10,
filterFn: 'contains',
},
{
id: 'cusp_count_buccal',
accessorFn: row => row.cusp_count_buccal || '',
header: 'Buccal cusp count',
size: 10,
filterFn: 'contains',
},
{
id: 'cusp_count_lingual',
accessorFn: row => row.cusp_count_lingual || '',
header: 'Lingual cusp count',
size: 10,
filterFn: 'contains',
},
{
id: 'loph_count_lon',
accessorFn: row => row.loph_count_lon || '',
header: 'Longitudinal loph count',
size: 10,
filterFn: 'contains',
},
{
id: 'loph_count_trs',
accessorFn: row => row.loph_count_trs || '',
header: 'Transverse loph count',
size: 10,
filterFn: 'contains',
},
{
id: 'fct_al',
accessorFn: row => row.fct_al || '',
header: 'Presence of acute lophs (AL)',
size: 10,
filterFn: 'contains',
},
{
id: 'fct_ol',
accessorFn: row => row.fct_ol || '',
header: 'Presence of obtuse or basin-like lophs (OL)',
size: 10,
filterFn: 'contains',
},
{
id: 'fct_sf',
accessorFn: row => row.fct_sf || '',
header: 'Structural fortification of cusps (SF)',
size: 10,
filterFn: 'contains',
},
{
id: 'fct_ot',
accessorFn: row => row.fct_ot || '',
header: 'Occlusal topography (OT)',
size: 10,
filterFn: 'contains',
},
{
id: 'fct_cm',
accessorFn: row => row.fct_cm || '',
header: 'Coronal cementum (CM)',
size: 10,
filterFn: 'contains',
},
{
id: 'microwear',
accessorFn: row => row.microwear || '',
header: 'Microwear',
size: 10,
filterFn: 'contains',
},
{
id: 'mesowear',
accessorFn: row => row.mesowear || '',
header: 'Mesowear',
size: 10,
filterFn: 'contains',
},
{
id: 'mw_or_high',
accessorFn: row => row.mw_or_high || '',
header: 'Cusp Relief High (OR%)',
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'mw_or_low',
accessorFn: row => row.mw_or_low || '',
header: 'Cusp Relief Low (OR%)',
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'mw_cs_sharp',
accessorFn: row => row.mw_cs_sharp || '',
header: 'Cusp Shape Sharp (CS%)',
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'mw_cs_round',
accessorFn: row => row.mw_cs_round || '',
header: 'Cusp Shape Rounded (CS%)',
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'mw_cs_blunt',
accessorFn: row => row.mw_cs_blunt || '',
header: 'Cusp Shape Blunt (CS%)',
size: 10,
filterVariant: 'range',
enableColumnFilterModes: false,
},
{
id: 'diet1',
accessorFn: row => row.diet1 || '',
header: 'Diet 1',
size: 10,
filterFn: 'contains',
},
{
id: 'diet2',
accessorFn: row => row.diet2 || '',
header: 'Diet 2',
size: 10,
filterFn: 'contains',
},
{
id: 'diet3',
accessorFn: row => row.diet3 || '',
header: 'Diet 3',
size: 10,
filterFn: 'contains',
},
{
id: 'locomo1',
accessorFn: row => row.locomo1 || '',
header: 'Locomotion 1',
size: 10,
filterFn: 'contains',
},
{
id: 'locomo2',
accessorFn: row => row.locomo2 || '',
header: 'Locomotion 2',
size: 10,
filterFn: 'contains',
},
{
id: 'locomo3',
accessorFn: row => row.locomo3 || '',
header: 'Locomotion 3',
size: 10,
filterFn: 'contains',
},
{
id: 'sp_comment',
accessorFn: row => row.sp_comment || '',
header: 'Comment',
size: 10,
filterFn: 'contains',
},
],
[]
)
const visibleColumns = {
species_id: false,
unique_identifier: false,
order_name: true,
family_name: true,
genus_name: true,
species_name: true,
subclass_or_superorder_name: false,
suborder_or_superfamily_name: false,
subfamily_name: false,
unique_identifier: true,
taxonomic_status: false,
common_name: false,
sp_author: false,
strain: false,
gene: false,
sv_length: false,
body_mass: false,
brain_mass: false,
sd_size: false,
sd_display: false,
tshm: false,
tht: false,
horizodonty: false,
crowntype: false,
cusp_shape: false,
cusp_count_buccal: false,
cusp_count_lingual: false,
loph_count_lon: false,
loph_count_trs: false,
fct_al: false,
fct_ol: false,
fct_sf: false,
fct_ot: false,
fct_cm: false,
microwear: false,
mesowear: false,
mw_or_high: false,
mw_or_low: false,
mw_cs_sharp: false,
mw_cs_round: false,
mw_cs_blunt: false,
diet1: false,
diet2: false,
diet3: false,
locomo1: false,
locomo2: false,
locomo3: false,
sp_comment: false,
}
return (
+38 -13
View File
@@ -147,22 +147,47 @@ export type SpeciesDetailsType = Prisma.com_species & { now_ls: Array<SpeciesLoc
export type Species = {
species_id: number
order_name: string
family_name: string
order_name: string | null
family_name: string | null
genus_name: string | null
species_name: string | null
subclass_or_superorder_name: string | null
suborder_or_superfamily_name: string | null
subfamily_name: string | null
genus_name: string
species_name: string
unique_identifier: string
taxonomic_status: string
common_name: string | null
sp_author: string | null
strain: string | null
gene: string | null
body_mass: number | null
brain_mass: number | null
sp_status: boolean | null
unique_identifier: string | null
taxonomic_status: string | null
sv_length: string | null
body_mass: number
sd_size: string | null
sd_display: string | null
tshm: string | null
tht: string | null
horizodonty: string | null
crowntype: string | null
cusp_shape: string | null
cusp_count_buccal: string | null
cusp_count_lingual: string | null
loph_count_lon: string | null
loph_count_trs: string | null
fct_al: string | null
fct_ol: string | null
fct_sf: string | null
fct_ot: string | null
fct_cm: string | null
microwear: string | null
mesowear: string | null
mw_or_high: number
mw_or_low: number
mw_cs_sharp: number
mw_cs_round: number
mw_cs_blunt: number
diet1: string | null
diet2: string | null
diet3: string | null
locomo1: string | null
locomo2: string | null
locomo3: string | null
sp_comment: string | null
}
export type RegionDetails = Prisma.now_reg_coord & { now_reg_coord_people: Array<RegionCoordinator> } & {