diff --git a/handbook/i/trogpkg.jpg b/handbook/i/trogpkg.jpg new file mode 100644 index 000000000..8831e7b7e Binary files /dev/null and b/handbook/i/trogpkg.jpg differ diff --git a/handbook/i/troggle-tables-small.jpg b/handbook/t/troggle-tables-small.jpg similarity index 100% rename from handbook/i/troggle-tables-small.jpg rename to handbook/t/troggle-tables-small.jpg diff --git a/handbook/t/trogpkg-small.jpg b/handbook/t/trogpkg-small.jpg new file mode 100644 index 000000000..b6c31970b Binary files /dev/null and b/handbook/t/trogpkg-small.jpg differ diff --git a/handbook/troggle/datamodel.html b/handbook/troggle/datamodel.html index a3aee257b..93cb456ea 100644 --- a/handbook/troggle/datamodel.html +++ b/handbook/troggle/datamodel.html @@ -10,7 +10,8 @@

Troggle Data Model (python)

Troggle data architecture

-Auto-generated on 3 April 2020. (Omitting all the 'Meta' sub-classes.)

+Auto-generated on 3 April 2020. (Omitting all the 'Meta' sub-classes.)
+DPhoto object removed 15 May 2020

 # This is an auto-generated Django model module.
 # You'll have to do the following manually to clean this up:
 #   * Rearrange models' order
@@ -116,26 +117,6 @@ from django.db import models
     message = models.CharField(max_length=400, blank=True)
 
 
-class CoreDphoto(models.Model):
-    id = models.IntegerField(primary_key =True)  # AutoField? 
-    new_since_parsing = models.BooleanField()
-    caption = models.CharField(max_length=1000, blank=True)
-    contains_logbookentry = models.ForeignKey ('CoreLogbookentry', blank=True, null=True)
-    file = models.CharField(max_length=100)
-    is_mugshot = models.BooleanField()
-    contains_cave = models.ForeignKey (CoreCave, blank=True, null=True)
-    contains_entrance = models.ForeignKey ('CoreEntrance', blank=True, null=True)
-    nearest_qm = models.ForeignKey ('CoreQm', db_column='nearest_QM_id', blank=True, null=True)  # Field name made lowercase. 
-    lon_utm = models.FloatField(blank=True, null=True)
-    lat_utm = models.FloatField(blank=True, null=True)
-
-
-class CoreDphotoContainsPerson(models.Model):
-    id = models.IntegerField(primary_key =True)  # AutoField? 
-    dphoto_id = models.IntegerField()
-    person = models.ForeignKey ('CorePerson')
-
-
 class CoreEntrance(models.Model):
     id = models.IntegerField(primary_key =True)  # AutoField? 
     new_since_parsing = models.BooleanField()
diff --git a/handbook/troggle/trogarch.html b/handbook/troggle/trogarch.html
index e8823c3ea..b480f8e7c 100644
--- a/handbook/troggle/trogarch.html
+++ b/handbook/troggle/trogarch.html
@@ -12,28 +12,37 @@
 

Troggle data architecture

The core of troggle is the data architecture: the set of tables into which all the cave survey and expo data is poured and stored. These tables are what enables us to produce a large number of different but consistent reports and views. - + +

+
- - + +
Tables (Objects)
- +
+
+
+ + +
Packages +
+

Architecture description

-

Read the proposal: "Troggle: a novel system for cave exploration information management", by Aaron Curtis. But remember that this paper is an over-ambitious proposal. Only the core data management features have been built. We have none of the person management features and only two forms in use: for entering cave and cave entrance data. +

Read the proposal: "Troggle: a novel system for cave exploration information management", by Aaron Curtis. But remember that this paper is an over-ambitious proposal. Only the core data management features have been built. We have none of the "person management" features, none of the "wallet progress" stuff and only two forms in use: for entering cave and cave entrance data.

-ALSO there have been tables added to the core representation which are not anticipated in that document of this diagram, e.g. Scannedimage, Survexdirectory, Survexscansfolder, Survexscansingle, Tunnelfile, TunnelfileSurvexscansfolders, Survey. See Troggle data model python code (3 April 2020). +ALSO there have been tables added to the core representation which are not anticipated in that document of this diagram, e.g. Scannedimage, Survexdirectory, Survexscansfolder, Survexscansingle, Tunnelfile, TunnelfileSurvexscansfolders, Survey. See Troggle data model python code (15 May 2020).

Troggle parsers and input files

-[describe which files they read and which tables they write to. Also say what error messages are likely on import and what to do about them.] -
    logbooks -
  • surveyscans -
  • survex files (caves) +

    To understand how troggle imports the data from the survex files, tunnel files, logbooks etc., see the troggle import (databaseReset.py) documentation. +

    The following separate import operations are managed by the import utility (databaseReset.py): +

      +
    • expo logbooks
    • folk (people) -
    • QMs -
    • subcaves -
    • entrances -
    • drawings (tunnel) +
    • wallets of notes & scans (surveyscans) +
    • cave survey data - survex files +
    • QMs - question marks +
    • drawings - tunnel & therion files
    @@ -42,7 +51,11 @@ ALSO there have been tables added to the core representation which are not antic

    There are only two places where this happens. This is where online forms are used to create cave entrance records and cave records. These are created in the database but also exported as files so that when troggle is rebuilt and data reimported the new cave data is there.

    Helpful tools and scripts

    -[ALSO talk about useful tools, such as those which interrogate MySQL or sqlite databases directly so that one can see the internals chnage as data is imported] + + +

    The public server uses a MariaDB SQL database and development is usually done using a single-user sqlite database which is a standard django option. +

    +You will find it very useful to see what is going on if you look directly at the data in the database (just a single file in the sqlite case) and browse the data in the tables. A light-weight, simple db browser is DB Browser for SQLite. Connecting directly the the MariaDB database with a control panel or workbench gives even more tools and documentation capabilities.


    Go on to: Troggle uncategorised notes to be edited
    diff --git a/handbook/troggle/trogimport.html b/handbook/troggle/trogimport.html new file mode 100644 index 000000000..5c3136771 --- /dev/null +++ b/handbook/troggle/trogimport.html @@ -0,0 +1,75 @@ + + + + +Handbook Troggle Data Import + + + +

    CUCC Expedition Handbook

    +

    Troggle Data Import

    + +

    Troggle - Reset and import data

    +

    +The python stand-alone script databaseRest.py imports data from files into the troggle database (sqlite or MariaDB). It is separate from the process which runs troggle and serves the data as webpages (via apache), but it is plugged in to the same hierarchy of django python files. +

    In the :troggle: directory: +

    $ python databaseReset.py
    +
    +Usage is 'python databaseReset.py <command> [runlabel]'
    +             where command is:
    +             reset     - normal usage: clear database and reread everything from files - time-consuming
    +             caves     - read in the caves
    +             logbooks  - read in the logbooks
    +             people    - read in the people from folk.csv
    +             QMs       - read in the QM csv files (older caves only)
    +             reinit    - clear database (delete everything) and make empty tables. Import nothing.
    +             scans     - the survey scans in all the wallets
    +             survex    - read in the survex files - all the survex blocks but not the x/y/z positions
    +             survexpos - just the x/y/z Pos out of the survex files
    +
    +             tunnel    - read in the Tunnel files - which scans the survey scans too
    +             profile   - print the profile from previous runs. Import nothing.
    +
    +             test         - testing...
    +
    +             and [runlabel] is an optional string identifying this run of the script
    +             in the stored profiling data 'import-profile.json'
    +             if [runlabel] is absent or begins with "F-" then it will skip the :memory: pass
    +
    +             caves and logbooks must be run on an empty db before the others as they
    +             set up db tables used by the others.
    +
    +

    On a clean computer with 16GB of memory and using sqlite a complete import takes about 20 minutes if nothing else is running. +On the shared expo server it can take a couple of hours if the server is in use +(we have only a share of it). On your +own computer, the first in-memory sqlite pass takes only about 6 minutes. +We do this so that typos and data-entry errors +are found quickly. +

    Here is an example of the output after it runs, showing which options were used recently and how long +each option took (in seconds) +

    +--   troggle.sqlite django.db.backends.sqlite3
    +** Running job  Profile
    +** Ended job Profile -  0.0 seconds total.
    +     days ago     -4.28    -4.13    -4.10   -3.03    -3.00
    +  runlabel (s)      svx      NULL   RESET    svx2    RESET2
    +    reinit (s)       -       1.9      1.9      -       1.8
    +     caves (s)       -        -      39.1      -      32.2
    +    people (s)       -        -      35.0      -      24.4
    +  logbooks (s)       -        -      86.5      -      67.3
    +       QMs (s)       -        -      19.3      -       0.0
    +survexblks (s)   1153.1       -    3917.0  1464.1   1252.9
    + survexpos (s)    397.3       -     491.9   453.6    455.0
    +    tunnel (s)       -        -      25.5      -      23.1
    +     scans (s)       -        -      52.5      -      45.9
    +
    +

    The 'survexblks' option loads all the survex files recursively following the *include +statements. It can take a long time if memory is low and the operating system has to page a lot. +

    (That value of 0 seconds for QMs looks suspicious..) +

    The file import_profile.json holds these historic times. Delete it to get +a clean slate. +


    +Return to: Troggle data model in python code
    +
    + +