Skip to main content

Bulk Operations Tools for ParkPow

Stream CSV Upload​

Use this script to upload existing CSV files and images from Stream to ParkPow

Get Script​

  1. Download the script from GitHub,
  2. Open a terminal window on your operating system and navigate to parkpow/upload-csv folder then run below command to build the Docker image:

docker build --tag platerecognizer/stream-csv-upload .

Create and Run upload Container​

The script will use your Stream config to get camera IDs and ParkPow webhook details, so you need to mount your stream config.

docker run --rm --net=host -t -e LOGGING=DEBUG  -v /home/stream:/user-data platerecognizer/stream-csv-upload

If your CSV has only new data that might not already exist on the ParkPow server, save processing time by skipping checking for duplicates using -i option:

docker run --rm --net=host -t -e LOGGING=DEBUG  -v /home/stream:/user-data platerecognizer/stream-csv-upload -i
danger

The script requires $(camera) to have been used in defining path to CSV output to re-trace the camera ID

Enable DEBUG logging by adding -e LOGGING=DEBUG

Tags Updater​

Automatically edit or add new tags to vehicles in ParkPow based on a configuration file.

Use this script to update existing vehicle tags in your ParkPow account.

Get Script​

  1. Download the script from GitHub.
  2. Open a terminal window on your operating system and navigate to parkpow/tags-updater folder then run below command to build the Docker image:

docker build --tag platerecognizer/tags-updater .

Configuration​

Create a folder with a config.ini with these contents, remember to update the file with your relevant details.

config.ini

[settings]
parkpow_base_url = https://app.parkpow.com
parkpow_api_token = ...

[tag-update]
OLD = NEW
SILVER = SILVERPROC
NO_TAGS = NEWCLIENT

info

NO_TAGS will be added to vehicles without any tags

Build the server image​


cd parkpow/tags-updater # Navigate into the tags-updater folder
docker build --tag platerecognizer/parkpow-tag-updater .

Run Image​

Run the built image, assuming the configuration folder path is /home/user1/tags-updater, this would be the run command:


docker run --rm --net=host -i -v /home/user1/tags-updater:/user-data -p 3000:8001 platerecognizer/parkpow-tag-updater

info
  • The server listens on port 8001
  • For more verbose logging add -e LOGGING=DEBUG

Send alerts from ParkPow to the server​

Add http://DOCKER_HOST_IP:3000 as Webhook on ParkPow by visiting this page http://PARKPOW_IP/settings/webhook/list.

Use the Webhook to create Alerts on ParkPow by visiting this page http://PARKPOW_IP/settings/alert/create Make sure to select the previous Webhook and triggers.

Send detections to ParkPow to trigger the alerts, Check this link for more details

ParkPow should now be able to send alerts to the container which will perform the tag updates.

info

Any edits to the config.ini or addition of new vehicle tags to ParkPow require a container restart.

Validate Tag Updates​

Confirm that ParkPow is updated by visiting a vehicle details page. Example: https://app.parkpow.com/vehicle/1204911

Remove Old Visits​

You can remove old vehicle visits from the current date until 30 days (maximum).

Use this script to remove visits.

Script Parameters​

ParameterShort OptionLong OptionDescription
Token-t--tokenParkPow API Token. Refer to ParkPow API Token.
Max Age-m--max-ageNumber of previous days you want to remove (up to 30 days).
API URL-a--api-urlURL of your server API. For example: https://app.parkpow.com/api/v1/ or http://local-or-public-IP:8000/api/v1.

Script Execution Format and Examples​

Format​

python3 remove_old_visits.py --token <YOUR_API_TOKEN> --max-age <1_TO_30_NUMBER> --api-url https://<PARKPOW_URL>/api/v1/

Examples​


# Remove old visits, up to 30 days ParkPow API
python3 remove_old_visits.py --token <YOUR_API_TOKEN> --max-age 30 --api-url https://app.parkpow.com/api/v1/

# Remove old visits, up to 15 days on premise environment
python3 remove_old_visits.py --token <YOUR_API_TOKEN> --max-age 30 --api-url http://local-or-public-IP:8000/api/v1/

Results​

Once you run it, you should see logs entry listing the visit pages and the visits deleted one by one, i.e.:

Visit 59903596 successfully removed!
Deleting visit 59903902, date-time: 2024-03-19T15:28:46.330758Z
Visit 59903902 successfully removed!
Deleting visit 59902745, date-time: 2024-03-19T15:39:45.304952Z
Visit 59902745 successfully removed!
Deleting visit 59902233, date-time: 2024-03-19T15:40:09.305717Z
Visit 59902233 successfully removed!
Completed, 1877 of 1877 visits removed
Floating button icon
CTRL + .