Cave re-labelling from unofficial identifier to official Kataster number

Cave 1623-2023-mg-03 'Kalte Salamanderhöhle'

This cave needs to be "katastered". If you have the new number issued by the Austrians, we can do it now.

Rename the .html files in expoweb

cave_data/1623-2023-mg-03.html
   <kataster_number></kataster_number>
    → <kataster_number>9999</kataster_number>
   <survex_file>caves-1623/2023-mg-03/2023-mg-03.svx </survex_file>
    → <survex_file>caves-1623/9999/9999.svx </survex_file>

entrance_data/1623-2023-mg-03d.html
entrance_data/1623-2023-mg-03a.html
entrance_data/1623-2023-mg-03b.html
entrance_data/1623-2023-mg-03c.html

Rename the cave description directory in expoweb


Rename the survex directory in loser

caves-1623/2023-mg-03/

   2023-mg-03.svx
   2023-mg-03.3d
   2023-mg-03.log

Here are all the survex files which are involved with this cave, the first one on this list should be the same as the one shown above. Any others will need fixing manually:
caves-1623/2023-mg-03/2023-mg-03.svx

Sort out the *fix point(s) in both loser and in expoweb

Without fully parsing the entire survex *include tree (which this code does not do), it is impossible to find the *fix declaration file from the 'station' fields in the entrance_data files. However we conventionally store the *fix in a "known" place, so we try.

Edit these Entrance files:

entrance_data/1623-2023-mg-03a.html
   
tag_station: 1623.2023-mg-03.tag
entrance_data/1623-2023-mg-03b.html
   
other_station: 1623.2023-mg-03.11
entrance_data/1623-2023-mg-03c.html
   
other_station: 1623.2023-mg-03.9

Check the wallet links to survex files in drawings

Edit these Wallet files

and if any of them are any of these survex files:
caves-1623/2023-mg-03/2023-mg-03.svx
then the wallet needs editing: do this online (click on the wallet id link above) before you run any of the katastering script. Doing it online will also do all the git commit stuff for you.

If doing this manually, it is much easier to do this using the online wallet edit form than to mess with the raw format of the JSON files, which we never touch and so will be unfamiliar to everyone.

Set the historic alias forwarder in expoweb

This will cause lots of errors until the cave "1623-9999" has been created by a full database reset OR we can do an online rename of the "Cave" object in the database [code yet to be written] by pressing this button [button not yet implemented].

Finally

Ideal scenario

Ideally you do this renumbering on a standalone instance of troggle running on a troggle development laptop and you don't push any of the git commits to the server until you have got all the niggles out of the conversion, i.e. the databaseReset runs locally without any warnings or errors introduced by your renaming and 'cavern' runs without any new survex errors.

Copy this script and edit it to match the directory names on your PC