-
Notifications
You must be signed in to change notification settings - Fork 1
manage_04_deleting_property_templates
This is done with delete_pts.py
This script:
- Accepts an RT id as input
- Iterates through each prop_set and removes implementation_set elements containing that id
Note: This script only deletes property templates from prop_set files. If you are trying to delete an RT completely, deleting RT serializations from sinopia_maps must be done manually. RTs can be deleted from Sinopia environments using 002_delete_loaded_RTs_resources.py.
Installing Python packages may require pip
in place of pip3
for some systems
- Python for Windows or WSL (recommend v3.8 or above)
-
lxml.etree
$ pip3 install lxml
- Java
Running scripts with certain Python versions may require python
in place of python3
for some systems
Run the script from the map_storage top-level folder
$ python3 py/delete_pts.py
Enter the id of the resource template you wish to remove from the prop_set files when prompted.
This will be in the format UWSINOPIA_Institution_Resource_Format_User
This script:
- Creates a tree out of each prop_set file
- Iterates through the tree to find each sinopia element
- Uses
check_sinopia()
function to determine if the implementation_set element(s) within the sinopia element contain more than one RT id (and are therefore used in more than one resource template) - Calls
remove_single_id()
orremove_multi_id()
functions to remove the matching implementation_sets from the prop_set tree - Writes the updated tree to the prop_set file
This function:
- Is called if there is only one instance of each RT id element within the implementation_set
- Determines if the implementation_set id elements match the given RT id
- If it is a match and the implementation_set is the only implementation_set within the sinopia element, the entire sinopia element is deleted
- If it is a match but there are multiple implementation_set elements within this sinopia element, only the matching implementation_set is deleted, along with any specific guidance for this RT using the
check_guidance()
function
This function:
- Is called if there is more than one instance of any of the id elements within the implementation_set (institution, resource, format, and user)
- Determines if the implementation_set id elements match the given RT id
- If there is a match, removes the matching id element if there are multiple id elements of that type (e.g. if there are two resource elements, it will remove the resource element that matches the RT id) and any specific guidance for this RT using the
check_guidance()
function
🏠 uwlib-cams Sinopia resource template index
ℹ map_storage + map_storage wiki ℹ sinopia_maps + sinopia_maps wiki ℹ
🚧 DRAFT documentation - please provide documentation feedback here 🚧