Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ samples/fixture/ synthetic workbooks for tests/CI (committed)
- **Dates** a year outside their season (e.g. `2014-01-11` in 2014-15) are corrected by `fixSeasonYear` and logged. Seasons run Aug–Jul.
- 2013-14 `Shark log physioshark` / `Set Log physioshark` duplicate `Catch data` / `Set Log` and are skipped (#9). 2013-14 recaptures are grouped in its `Recaptures` sheet; 2014-15 `Recaptures` holds extra catches; 2015-16 stores recaptures as horizontal column blocks (`1st Recap Site`…).
- 2016-17 `Shark Log` has a date _value_ as its date header; 2021-22 `Set Log` has a garbled date header (`16(`). Both are handled.
- Species codes: `Cm` blacktip, `Na` sicklefin lemon, `Nf` tawny nurse shark. 2024-25 writes the nurse shark as `GF` / `Gf1` (`GF Log Juv`), probably from _Ginglymostoma_, the Atlantic nurse shark genus; it is read as `Nf` (confirmed by Jodie Rummer, #12).
- Individuals: union-find over tags (PIT 15-digit, `COFA 12345`, re-tags) plus recapture groups. Conflicting sex/species/shrinking length is logged, not fixed.
- Captures link to sets by season + set number (±1 day), then date + site, then a unique set that date.
- CPUE = max(set-log count, linked captures) / net-hours. 2013-14 has no set times (no CPUE).
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { SITE_DEFS } from './sites';
import { readWorkbook } from './xlsx';

/** Bump when import logic changes so existing caches rebuild on the next start. */
export const IMPORTER_VERSION = '4';
export const IMPORTER_VERSION = '5';

const MIGRATIONS = import.meta.glob('/drizzle/*.sql', {
query: '?raw',
Expand Down
3 changes: 1 addition & 2 deletions src/lib/server/import/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ function speciesFromSheetName(name: string): SpeciesCode | null {
const n = name.trim().toLowerCase();
if (/^cm|catch data cm/.test(n)) return 'Cm';
if (/^na|catch data na/.test(n)) return 'Na';
if (/^nf|^nurse/.test(n)) return 'Nf';
if (/^gf/.test(n)) return 'Gf';
if (/^nf|^nurse|^gf/.test(n)) return 'Nf'; // 'GF Log Juv' is tawny nurse sharks (#12)
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/import/normalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('cell parsers', () => {
expect(speciesOf('C. melanopterus')).toBe('Cm');
expect(speciesOf('NA')).toBe('Na');
expect(speciesOf('Nurse')).toBe('Nf');
expect(speciesOf('Gf1')).toBe('Gf');
expect(speciesOf('Gf1')).toBe('Nf');
expect(ageClassOf('Juvenile 1y')).toBe('juvenile');
expect(ageClassOf('neonate')).toBe('neonate');
});
Expand Down
5 changes: 3 additions & 2 deletions src/lib/server/import/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function sexOf(v: CellValue | undefined): 'M' | 'F' | null {
return null;
}

export type SpeciesCode = 'Cm' | 'Na' | 'Nf' | 'Gf' | 'Unknown';
export type SpeciesCode = 'Cm' | 'Na' | 'Nf' | 'Unknown';

export function speciesOf(v: CellValue | undefined): SpeciesCode | null {
const s = str(v)
Expand All @@ -139,7 +139,8 @@ export function speciesOf(v: CellValue | undefined): SpeciesCode | null {
if (s === 'na' || s.includes('acutidens') || s.includes('lemon')) return 'Na';
if (s === 'nf' || s.includes('nurse') || s.includes('ferrugineus') || s.includes('nebrius'))
return 'Nf';
if (s.startsWith('gf')) return 'Gf';
// 'GF' / 'Gf1' (2024-25) is the tawny nurse shark; G likely from Ginglymostoma, the Atlantic nurse shark genus (#12).
if (s.startsWith('gf')) return 'Nf';
if (s.includes('unknown') || s.includes('unknonw')) return 'Unknown';
return null;
}
Expand Down
6 changes: 0 additions & 6 deletions src/lib/species.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ export const SPECIES = {
latin: 'Nebrius ferrugineus',
color: 'var(--series-3)'
},
Gf: {
code: 'Gf',
common: 'Unidentified ("GF")',
latin: 'species code GF, see issue #12',
color: 'var(--series-4)'
},
Unknown: { code: 'Unknown', common: 'Unknown', latin: '', color: 'var(--muted)' }
} as const;

Expand Down
Loading