Problem
The --spreadsheets phase of load.py uses an exact match to look up missions in the database (~line 1827):
mission = Mission.objects.get(name=f"{parent_dir}/{row['Mission']}")
This means the spreadsheet entry must exactly match the full DB path. For example, if the spreadsheet has:
2026/20260716d1
...but the DB stores:
2026/OctopusGarden_LASS_2026/20260716d1/multibeam
2026/OctopusGarden_LASS_2026/20260716d1/lidar
...the script logs Not found in database and skips the row entirely, so no metadata (vehicle name, quality, region, etc.) is ever populated.
This was discovered with the July 2026 Octopus Garden / LASS surveys. Jenny had added them to the survey tally spreadsheet using the short form, but none of the metadata loaded.
Proposed Fix
In update_db_from_df(), after the Mission.DoesNotExist exception, add a fallback partial-path match:
⚠️
⚠️ Superseded — see correction in comments below.
⚠️
except Mission.DoesNotExist:
# Fallback: try partial path match
# e.g. spreadsheet has "20260716d1", DB has "2026/OctopusGarden_LASS_2026/20260716d1/multibeam"
candidates = Mission.objects.filter(name__contains=f"/{row['Mission']}/")
if candidates.count() == 1:
mission = candidates.first()
self.logger.info(f"Partial path match for {row['Mission']}: {mission.name}")
elif candidates.count() > 1:
self.logger.warning(
f"Ambiguous partial match for {row['Mission']}: {[m.name for m in candidates]} — skipping"
)
continue
else:
self.logger.warning(f"Not found in database: {parent_dir}/{row['Mission']}")
continue
Notes
The fallback should only trigger when the exact match fails, preserving current behaviour for well-formed entries.
If multiple candidates match (e.g. both multibeam and lidar subdirectories), the script should warn and skip rather than silently pick one — or alternatively apply the metadata update to all candidates.
This should also fix similar mismatches for other missions buried in project subdirectories.
Workaround (until fix is merged)
Jenny updates the survey tally spreadsheet to use the full DB path (e.g. 2026/OctopusGarden_LASS_2026/20260716d1/multibeam), one row per subdirectory.
Problem
The --spreadsheets phase of load.py uses an exact match to look up missions in the database (~line 1827):
mission = Mission.objects.get(name=f"{parent_dir}/{row['Mission']}")This means the spreadsheet entry must exactly match the full DB path. For example, if the spreadsheet has:
2026/20260716d1
...but the DB stores:
2026/OctopusGarden_LASS_2026/20260716d1/multibeam
2026/OctopusGarden_LASS_2026/20260716d1/lidar
...the script logs
Not foundin database and skips the row entirely, so no metadata (vehicle name, quality, region, etc.) is ever populated.This was discovered with the July 2026 Octopus Garden / LASS surveys. Jenny had added them to the survey tally spreadsheet using the short form, but none of the metadata loaded.
Proposed FixIn update_db_from_df(), after the Mission.DoesNotExist exception, add a fallback partial-path match:NotesThe fallback should only trigger when the exact match fails, preserving current behaviour for well-formed entries.If multiple candidates match (e.g. both multibeam and lidar subdirectories), the script should warn and skip rather than silently pick one — or alternatively apply the metadata update to all candidates.This should also fix similar mismatches for other missions buried in project subdirectories.Workaround (until fix is merged)Jenny updates the survey tally spreadsheet to use the full DB path (e.g. 2026/OctopusGarden_LASS_2026/20260716d1/multibeam), one row per subdirectory.