diff --git a/handbook/troggle/datamodel.html b/handbook/troggle/datamodel.html index ac0e5b93b..a84518bb6 100644 --- a/handbook/troggle/datamodel.html +++ b/handbook/troggle/datamodel.html @@ -5,7 +5,8 @@ Handbook Troggle Data Model - + +

CUCC Expedition Handbook - troggle

Troggle Data Model (python)

@@ -17,7 +18,55 @@ Auto-generated on 3 April 2020 with troggle$ python3 manage.py inspectdb. (Omitting all the 'Meta' sub-classes. )
Several classes have been edited out of this file between then and 14 September 2023 as they have been deleted as troggle has been tidied up.

All the classes below inherit from the django class (models.Model) and are thereby made persistent in the database. All persistent instance variables are defined with e.g. "models.BooleanField()" types which is why they look so strange to a normal python programmer. -

See the online auto-documentation for the current set of core objects and their instance variables and foreign keys (anything below with "models.ForeignKey" in the type field is a foreign key.
+

See the online auto-documentation for the current set of core objects and their instance variables and foreign keys (anything below with "models.ForeignKey" in the type field is a foreign key. + +

Culling unused fields

+

[This section to be moved elsewhere?] +

We have a "Django management command" to find any fields on the models which are unused fossils. Do a full database import locally on a development machine, then in the /troggle/ folder run: +

uv run manage.py find_empty_fields
+This provides a report of which fields in the database are unused across all records. It was entirely written by Google Gemini AI in October 2025. +
+
+🚀 Starting scan for empty or null fields across all models...
+
+
+🔍 Checking model: auth.Group
+  ✅ All fields contain data.
+
+🔍 Checking model: core.Expedition
+  ✅ All fields contain data.
+
+🔍 Checking model: core.Person
+  -> Field 'orderref' is completely empty or null.
+
+🔍 Checking model: core.PersonExpedition
+  -> Field 'slugfield' is completely empty or null.
+
+🔍 Checking model: core.QM
+  -> Field 'completion_date' is completely empty or null.
+
+🔍 Checking model: core.DrawingFile
+  -> Field 'dwgcontains' is completely empty or null.
+  -> Field 'survexfiles' is completely empty or null.
+
+🔍 Checking model: core.Cave
+  -> Field 'kataster_status' is completely empty or null.
+...
+
+The code for this is located in find_empty_fields.py: +
+troggle/
+└── core/
+    ├── __init__.py
+    ├── models/
+    ├── management/
+    │   ├── __init__.py
+    │   └── commands/
+    │       ├── __init__.py
+    │       └── find_empty_fields.py   <-- this file
+    └── views/
+
+

Troggle data architecture classes

This webpage is manually maintained and may be out of date.
# This is an auto-generated Django model module.
 # You'll have to do the following manually to clean this up:
 #   * Rearrange models' order
@@ -372,6 +421,5 @@ Return to: Troggle intro
Troggle index: Index of all troggle documents
-
- +
\ No newline at end of file