Wallets script update - matching documentation

This commit is contained in:
Philip Sargent 2020-03-16 00:45:33 +00:00
parent ca0b4cec62
commit 18a0bd4786
3 changed files with 120 additions and 61 deletions

10
handbook/survey/README Normal file
View File

@ -0,0 +1,10 @@
Add new folders of the form
2017#01 (where 01 is a serial number) for surveys with physical notes
or
2017#X01 (where 01 is a serial number) for surveys with only digital data
<html><body>
Dummy text to stop mistaken messages about broken links
from the linkchecker at
<a href="https://www.brokenlinkcheck.com/broken-links.php">brokenlinkcheck.com</a>
</body></html>

View File

@ -0,0 +1,89 @@
# Instructions
# 2019-03-02
# Philip Sargent
Wookey told me to sort out the contents.json files in expofiles/surveyscans/2018/
and these are my notes to remind myself what this entails.
This note was written during August 2018.
The job is to populate the contents.json file in each folder, e.g.
expofiles/surveyscans/2018/2018#03/contents.json
using the following input materials:
- the wallet 2018#03 and the papers inside it. This is in the 2018 lever-arch file.
- the folder in repo 'loser' holding the appropriate .svx files e.g.
"caves-1623/2017-cucc-24/gshclimb.svx"
- the script expofiles/surveyscans/2018/wallets.py (run by "python wallets.py")
the "wallets.py" script creates index.html files in each folder /2018/2018#nn/
and creates or updates a webpage for each person listed in any of the contents.json files
in the folder/2018/ e.g. "Becka Lawson.html".
The script wallets.py requires that the //loser// repo is populated on the machine that you
run the script on so that it can find the.svx files. Do not run this script on
the expo server itself as the loser repo is in the wrong place and all the .svx files
will be flagged as "not found" (Pauul Fox did this once).
wallets.py now (Feb.2019) takes a command-line argument for the location of the loser repo, e.g.
python wallets.py "/mnt/d/CUCC-Expo/loser/"
Before doing anything else, run wallets.py. This will create empty template contents.json
files in each folder.
You may need to create missing folders,e.g. I just had to create /2018/2018#30 to #32.
Every time you finish entering the data in contents.json in a folder,
run wallets.py to update the "person" html files and to
re-generate the index.html file for the 2018 folder as
a whole (surveyscans/2018/index.html).
But wallets.py does not delete old files which are not regenerated.
So it is a good idea to delete all the .html files
before running it.
The first difficulty is finding out which cave a wallet describes..
The wallet may say "radaghost to blitzkriek"
(or whatever) but without the name of the cave you can't find the .svx files
as you don't know that you need to look in e.g. loser/caves-1626/2018-dm-07/
Usually this is written by hand on the label of the wallet.
There are ambiguities about how the entries in the contents.json actually lead to
reminder instructions in the html files produced, and this is particularly
difficult for electronic caves where the topo files are missing
and for surface prospecting where it is not clear which of the actions
should be done and thus which products should be produced.
This needs to be documented.
For prospecting and surface surveying it is not clear whether the default folder
for the url link should be repo //loser// surface/1623/allplateau.svx
When there are more than one .svx file there seems to be no way of recording the list
in contents.json so it is impossible to tell what was done on that trip or whether
there is anything missing. This is especially true if it was electronic and the
.topo files are missing. Wookey confirms that this ios the case.
wallets.py will not overwrite any contents.json file, it only creates one where one
doesn't exist.
wallets.py also creates an index.html file inside each wallet folder dewcribing the status of this
folder. This is linked from the index.html file created in /2018/ by the script which
summarises everything for this year.
NAMING
The script detects if there are notesX.jpg planX.jpg and elevX.jpgfiles present, and
produces a reminder/warning if they are not,even if these have all been scanned
and given different names.
The job of the checker (perhaps on a second pass) if to rename files so that these
warnings disappear.
HINT
When there are a lot on wallets all with the same cave, make your own template
with the cave name and the right folder prefix for the svx folder
(in the loser repo) and copy it in to all those wallet folders - overwriting
the blank template produced by the wallets.py

View File

@ -17,7 +17,7 @@
</ol> </ol>
<h3>The scanned pages</h3> <h3>The scanned pages</h3>
<p>These are simply the scanned imaages (or digital photographs) of each page of the original survey notes. <p>These are simply the scanned images (or digital photographs) of each page of the original survey notes.
They should be named <em><span style="font-family:monospace">notesXXX.jpg</span></em> where "XXX" can be They should be named <em><span style="font-family:monospace">notesXXX.jpg</span></em> where "XXX" can be
anything you like. Typically we have the scanned pages called notes1.jpg, notes2.jpg, notes3.jpg. anything you like. Typically we have the scanned pages called notes1.jpg, notes2.jpg, notes3.jpg.
<p>It is important that you use use the .jpg (JPEG) file format, and definitely not PNG (very voluminous) <p>It is important that you use use the .jpg (JPEG) file format, and definitely not PNG (very voluminous)
@ -25,7 +25,7 @@ or PDF (very hard to re-use elsewhere). Set the scanner at 300 dpi and adjust th
by using photo-editing software to enhance the writing. Also please crop each image to just the area containing by using photo-editing software to enhance the writing. Also please crop each image to just the area containing
the survey data. the survey data.
<p>As soon as the notes have been scanned you should (a) copy them to a USB stick or email them to someone, (b) upload the entire online wallet to the expo server in Cambridge <p>As soon as the notes have been scanned you should (a) copy them to a USB stick or email them to someone, (b) upload the entire online wallet to the expo server in Cambridge
<span style="font-family:monospace">expo.survex.com</span>. This is so that these precious files are backed-up as soon as possible. <span style="font-family:monospace">expo.survex.com</span>. This is so that these precious files are backed-up as soon as possible. (Assuming you have done the <a href="../computing/keyexchange.html">key-pair procedure</a>, do the upload by <a href="../uploading.html">sFTP</a> as you do for photos, but to the directory described in the <a href="newwallet.html">introduction to online wallets</a>.)
<h3>The other files and online index <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span></h3> <h3>The other files and online index <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span></h3>
<p>All the other files are part of the multi-step process of producing the cave survey - see <a href="newcave.html"> <p>All the other files are part of the multi-step process of producing the cave survey - see <a href="newcave.html">
@ -51,7 +51,7 @@ have a different Austrian Kataster number issued for it in due course).
*ref 2018#06 *ref 2018#06
; the #number is on the clear pocket containing the original notes ; the #number is on the clear pocket containing the original notes
</pre> </pre>
But sometime in mid-Expo 2015 everyone stopped using the survex template file and so this information was not recorded since then. This will be fixed by hand-editing indue course. But sometime in mid-Expo 2015 everyone stopped using the survex template file and so this information was not recorded since then. This will be fixed by hand-editing in due course.
(Note that many old .svx files were processed with an older version of survex which did not suppport this feature and so a comment was used instead.) (Note that many old .svx files were processed with an older version of survex which did not suppport this feature and so a comment was used instead.)
<p>Troggle produces very useful auto-generated reports of the status of the wallets and the survex files <p>Troggle produces very useful auto-generated reports of the status of the wallets and the survex files
@ -127,17 +127,21 @@ in filenames on Windows computers.
</pre> </pre>
will, after the appropriate magic has happened, contain a file will, after the appropriate magic has happened, contain a file
<p> <p>
<span style="font-family:monospace; size=x-small; background-color: lightgray">index.html</span> <span style="font-family:monospace; size=x-small; background-color: lightgray">walletindex.html</span>
<p> <p>
which lists all the wallets which have uncompleted tasks, and lists all the people responsible for completing them. which lists all the wallets which have uncompleted tasks, and lists all the people responsible for completing them.
You can see <a href="http://expo.survex.com/expofiles/surveyscans/2018/">the index.html for 2018</a> . Also there will be a linked file for each individual You can see <a href="http://expo.survex.com/expofiles/surveyscans/2018/walletindex.html">the walletindex.html for 2018</a> . Also there will be a linked file for each individual
for their personal to-do list, and each online wallet contains its own for their personal to-do list, and each online wallet contains its own
<span style="font-family:monospace">index.html</span> file which describes the survey production status for all the wallets. <span style="font-family:monospace">index.html</span> file which describes the survey production status for all the wallets.
<p>The magic creates index.html files in each folder /2018/2018#nn/ <p>The magic also creates walletindex.html files in each folder /2018/2018#nn/
and creates or updates a webpage for each person listed in any of the contents.json files and creates or updates a webpage for each person listed in any of the contents.json files
in the folder/2018/ e.g. <a href="http://expo.survex.com/expofiles/surveyscans/2018/Becka%20Lawson.html">Becka Lawson.html</a>. in the folder/2018/ e.g. <a href="http://expo.survex.com/expofiles/surveyscans/2018/Becka%20Lawson.html">Becka Lawson.html</a>.
<p>If you want to see what the files are in each online wallet then look at <br>
<a href="http://expo.survex.com/expofiles/surveyscans/2018/">expo.survex.com/expofiles/surveyscans/2018/</a> <br>
and you can navigate to the individual wallet folders too and look directly at the files there.
<p>All this magic is created by a script <span style="font-family:monospace; size=x-small; background-color: lightgray">wallets.py</span>. <p>All this magic is created by a script <span style="font-family:monospace; size=x-small; background-color: lightgray">wallets.py</span>.
<h3>Setting up the online wallets</h3> <h3>Setting up the online wallets</h3>
@ -153,8 +157,8 @@ new trip surveys.
<span style="font-family:monospace; size=x-small; background-color: lightgray">python wallets.py</span> <span style="font-family:monospace; size=x-small; background-color: lightgray">python wallets.py</span>
<br> <br>
<p>This will create a default <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> and <p>This will create a default <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> and
<span style="font-family:monospace; size=x-small; background-color: lightgray">index.html</span> in each online wallet subfolder and also a <span style="font-family:monospace; size=x-small; background-color: lightgray">walletindex.html</span> in each online wallet subfolder and also a
<span style="font-family:monospace; size=x-small; background-color: lightgray">index.html</span> in the <span style="font-family:monospace; size=x-small; background-color: lightgray">/2018/</span> folder. <span style="font-family:monospace; size=x-small; background-color: lightgray">walletindex.html</span> in the <span style="font-family:monospace; size=x-small; background-color: lightgray">/2018/</span> folder.
<p>This script works fine on Linux (Debian, Xubuntu, etc.) and also now works fine in the <a href="https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/">Windows 10 bash system</a>. <p>This script works fine on Linux (Debian, Xubuntu, etc.) and also now works fine in the <a href="https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/">Windows 10 bash system</a>.
@ -177,7 +181,7 @@ You will run
<span style="font-family:monospace; size=x-small; background-color: lightgray">python wallets.py</span> <span style="font-family:monospace; size=x-small; background-color: lightgray">python wallets.py</span>
<p> <p>
regularly, after every batch of survey data is entered or scanned. regularly, after every batch of survey data is entered or scanned.
<p>This will always overwrite all the <span style="font-family:monospace">index.html</span> files but it will never touch <p>This will always overwrite all the <span style="font-family:monospace">walletindex.html</span> files but it will never touch
the <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> files. the <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> files.
<p>You will also regularly synchronise your laptop <p>You will also regularly synchronise your laptop
and the expo laptop with <br /> and the expo laptop with <br />
@ -206,7 +210,7 @@ As all this is not under version control the timestamps of the files are really
<p> <p>
So script <span style="font-family:monospace; size=x-small; background-color: lightgray">wallets.py</span> has been fixed so that So script <span style="font-family:monospace; size=x-small; background-color: lightgray">wallets.py</span> has been fixed so that
<ul> <ul>
<li>the generated <span style="font-family:monospace; size=x-small; background-color: lightgray">index.html</span> file in each wallet folder is given the same timestamp as the <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> file there, <em>not the time of when the script is run</em>. This is unusual but intentional and in practice very helpful. <li>the generated <span style="font-family:monospace; size=x-small; background-color: lightgray">walletindex.html</span> file in each wallet folder is given the same timestamp as the <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> file there, <em>not the time of when the script is run</em>. This is unusual but intentional and in practice very helpful.
<li>the script no longer overwrites the <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> files every time it runs. It only changes that file's timestamp if it actually changes anything in the contents.json file. <li>the script no longer overwrites the <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> files every time it runs. It only changes that file's timestamp if it actually changes anything in the contents.json file.
</ul> </ul>
@ -221,9 +225,11 @@ different formats. It also
<ul> <ul>
<li>checks whether the .svx files listed are actually present <br>in the <a href="http://expo.survex.com/repositories/home/expo">::loser::</a> repository <li>checks whether the .svx files listed are actually present <br>in the <a href="http://expo.survex.com/repositories/home/expo">::loser::</a> repository
<li>checks for the presence of notesXXX.jpg, planXXX.jpg and elevXXX.jpg files <li>checks for the presence of notesXXX.jpg, planXXX.jpg and elevXXX.jpg files
<li>checks for the presence of XXXnotes.jpg, XXXplan.jpg and XXXelev.jpg files
<li>creates a template <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> in any wallet which does not have one. <li>creates a template <span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span> in any wallet which does not have one.
<li>creates helpful URL links to the existing online survey documentation for the cave being surveyed <li>creates helpful URL links to the existing online survey documentation for the cave being surveyed
<li>creates helpful URL links to the working files you are managing on your own laptop <li>creates helpful URL links to the working files you are managing on your own laptop
<li>Inserts the date & time into each generated file so that anyone can see when it was last updated
</ul> </ul>
<p>Things it might do in future (if someone gets around to it) include: <br> <p>Things it might do in future (if someone gets around to it) include: <br>
@ -237,60 +243,14 @@ different formats. It also
- checking the date is in the recent past etc.<br><br> - checking the date is in the recent past etc.<br><br>
<h3>How <em><span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span></em> fields match <h3>How <em><span style="font-family:monospace; size=x-small; background-color: lightgray">contents.json</span></em> fields match
<em><span style="font-family:monospace; size=x-small; background-color: lightgray">index.html</span></em> reports</h3> <em><span style="font-family:monospace; size=x-small; background-color: lightgray">walletindex.html</span></em> reports</h3>
<p> <p>
<em>to be written...</em> <em>to be written...</em>
<hr> <hr>
Old notes, being turned into real documentation... Old notes, being turned into real documentation...
<pre> <pre>
# Instructions
# 2018-08-14
# Philip Sargent
Wookey told me to sort out the contents.json files in expofiles/surveyscans/2018/
and these are my notes to remind myself what this entails.
The job is to populate the contents.json file in each folder, e.g.
expofiles/surveyscans/2018/2018#03/contents.json
using the following input materials:
- the wallet 2018#03 and the papers inside it. This is in the 2018 lever-arch file.
- the folder in repo 'loser' holding the appropriate .svx files e.g.
"caves-1623/2017-cucc-24/gshclimb.svx"
- the script expofiles/surveyscans/2018/wallets.py (run by "python wallets.py")
the "wallets.py" script creates index.html files in each folder /2018/2018#nn/
and creates or updates a webpage for each person listed in any of the contents.json files
in the folder/2018/.
The script wallets.py requires that the //loser// repo is populated on the machine that you
run the script on so that it can find the.svx files.
If your machine has the ::loser:: repo in a different place from that expected by the script, you can just
put the path on the command line:
python wallets.py "/mnt/d/CUCC-Expo/loser/"
Before doing anything else, run wallets.py. This will create empty template contents.json
files in each folder.
You may need to create missing folders,e.g. I just had to create /2018/2018#30 to #32.
Every time you finish entering the data in contents.json in a folder,
run wallets.py to update the "person" html files and to
re-generate the index.html file for the 2018 folder as
a whole (surveyscans/2018/index.html).
There are ambiguities about how the entries in the contents.json actually lead to
reminder instructions in the html files produced, and this is particularly
difficult for electronic caves where the topo files are missing
and for surface prospecting where it is not clear which of the actions
should be done and thus which products should be produced.
This needs to be documented.
For prospecting and surface surveying it is not clear whether the default folder For prospecting and surface surveying it is not clear whether the default folder
for the url link should be repo ::loser:: surface/1623/allplateau.svx for the url link should be repo ::loser:: surface/1623/allplateau.svx
@ -309,14 +269,14 @@ the blank template produced by the wallets.py
# Update March 2019 # Update March 2019
a consolidated to-do list of the last 3 years on the server: a consolidated to-do list of the last 3 years on the server:
http://expo.survex.com/expofiles/surveyscans/2016-18/index.html http://expo.survex.com/expofiles/surveyscans/2016-18/walletindex.html
This is a hand-done kludge and only the first level of links works - which is to the individual person's page. This is a hand-done kludge and only the first level of links works - which is to the individual person's page.
the lists for the last 3 years individually and all the links are working for each wallet page: the lists for the last 3 years individually and all the links are working for each wallet page:
both local links to your PC and to the right location of the .svx files on the troggle server. both local links to your PC and to the right location of the .svx files on the troggle server.
http://expo.survex.com/expofiles/surveyscans/2016/index.html http://expo.survex.com/expofiles/surveyscans/2016/walletindex.html
http://expo.survex.com/expofiles/surveyscans/2017/index.html http://expo.survex.com/expofiles/surveyscans/2017/walletindex.html
http://expo.survex.com/expofiles/surveyscans/2018/index.html http://expo.survex.com/expofiles/surveyscans/2018/walletindex.html
and all the names of people have been hand-edited in the .json files to be consistent and identical. and all the names of people have been hand-edited in the .json files to be consistent and identical.
2015 has now been done stand-alone but there is no consolidated report for 2015-18 yet. 2015 has now been done stand-alone but there is no consolidated report for 2015-18 yet.