Skip to content

Commit

Permalink
Update logs
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPhura committed Oct 30, 2024
1 parent 3064412 commit 7c2dc10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export class ImportMarkingsStrategy extends DBService implements CSVImportStrate
const rowsToValidate: Partial<CsvMarking>[] = [];

for (const row of rows) {
console.log(JSON.stringify(row, null, 2));
let critterId, captureId;

const alias = getColumnCell<string>(row, 'ALIAS');
Expand All @@ -124,16 +123,10 @@ export class ImportMarkingsStrategy extends DBService implements CSVImportStrate
const captureDate = getColumnCell(row, 'CAPTURE_DATE');
const captureTime = getColumnCell(row, 'CAPTURE_TIME');

console.log(JSON.stringify(captureDate, null, 2));
console.log(JSON.stringify(captureTime, null, 2));
const critter = critterAliasMap.get(alias.cell.toLowerCase());
if (critter) {
console.log(JSON.stringify(critter?.captures, null, 2));
console.log(JSON.stringify(captureDate.cell, null, 2));
console.log(JSON.stringify(captureTime.cell, null, 2));
// Find the capture_id from the date time columns
const captures = findCapturesFromDateTime(critter.captures, captureDate.cell, captureTime.cell);
console.log(JSON.stringify(captures, null, 2));
captureId = captures.length === 1 ? captures[0].capture_id : undefined;
critterId = critter.critter_id;
rowCritters.push(critter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,27 @@ export class ImportMeasurementsStrategy extends DBService implements CSVImportSt
row: Row,
critterAliasMap: Map<string, ICritterDetailed | undefined>
): { capture_id?: string; critter_id?: string; tsn?: string } {
console.log(JSON.stringify(row, null, 2));
const getColumnCell = generateColumnCellGetterFromColumnValidator(this.columnValidator);

const alias = getColumnCell<string>(row, 'ALIAS');
const captureDate = getColumnCell(row, 'CAPTURE_DATE');
const captureTime = getColumnCell(row, 'CAPTURE_TIME');

console.log(JSON.stringify(captureDate, null, 2));
console.log(JSON.stringify(captureTime, null, 2));

let capture_id, critter_id, tsn;

if (alias.cell) {
const critter = critterAliasMap.get(alias.cell.toLowerCase());

if (critter) {
console.log(JSON.stringify(critter?.captures, null, 2));
console.log(JSON.stringify(captureDate.cell, null, 2));
console.log(JSON.stringify(captureTime.cell, null, 2));
const captures = findCapturesFromDateTime(critter.captures, captureDate.cell, captureTime.cell);
console.log(JSON.stringify(captures, null, 2));
critter_id = critter.critter_id;
capture_id = captures.length === 1 ? captures[0].capture_id : undefined;
tsn = String(critter.itis_tsn); // Cast to string for convienience
Expand Down

0 comments on commit 7c2dc10

Please sign in to comment.