culling unused fields - online edit of handbook/troggle/datamodel.html - on dev machine 'SnowWhite'

This commit is contained in:
2025-10-11 19:32:31 +01:00
parent ee5380e29a
commit d3f37cc99d

View File

@@ -5,7 +5,8 @@
<title>Handbook Troggle Data Model</title>
<link rel="stylesheet" type="text/css" href="/css/main2.css" />
</head>
<body><style>body { background: #fff url(/images/style/bg-system.png) repeat-x 0 0 }</style>
<body>
<style>body { background: #fff url(/images/style/bg-system.png) repeat-x 0 0 }</style>
<h2 id="tophead">CUCC Expedition Handbook - troggle</h2>
<h1>Troggle Data Model (python)</h1>
@@ -17,7 +18,55 @@
Auto-generated on 3 April 2020 with <var>troggle$ python3 manage.py inspectdb</var>. (Omitting all the 'Meta' sub-classes. )<br>
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.
<p>All the classes below inherit from the django class (models.Model) and are thereby made persistent in the database. All <a href="https://docs.djangoproject.com/en/1.11/ref/models/fields/">persistent instance variables</a> are defined with e.g. "models.BooleanField()" types which is why they look so strange to a normal python programmer.
<p>See <a href="/admin/doc/models/">the online auto-documentation</a> 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. <br>
<p>See <a href="/admin/doc/models/">the online auto-documentation</a> 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.
<h4>Culling unused fields</h4>
<p>[This section to be moved elsewhere?]
<p>We have a "<a href="https://docs.djangoproject.com/en/5.2/howto/custom-management-commands/">Django management command</a>" 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:
<pre><code>uv run manage.py find_empty_fields</code></pre>
This provides a report of which fields in the database are unused across all records. It was <em>entirely</em> written by Google Gemini AI in October 2025.
<pre>
🚀 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.
...
</pre>
The code for this is located in <var>find_empty_fields.py</var>:
<pre>
troggle/
└── core/
├── __init__.py
├── models/
├── management/
│ ├── __init__.py
│ └── commands/
│ ├── __init__.py
│ └── find_empty_fields.py <-- this file
views/
</pre>
<h3>Troggle data architecture classes</h3>
This webpage is manually maintained and may be out of date.<code><pre><span style="color: green"># 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: <a href="trogintro.html">Troggle intro</a><br />
Troggle index:
<a href="trogindex.html">Index of all troggle documents</a><br />
<hr />
</body>
<hr /></body>
</html>