Warrant builder application

Last Updated: 05/09/2025

Creative names aside – I took it upon myself recently to attempt to streamline the warrant writing process at my agency. This endeavor took place over many months and several iterations as I stumbled forward learning Python and some pertinent libraries. Moving from quality of life automations based on command line inputs for myself, I began to learn to put together a GUI based application to modify a .docx template file. Features piled up in my brain faster than I could accomplish them through code but eventually I have gotten to a stage where the program is functional enough to share.

The basic premise of the application is to provide a patrol officer with a window in which to input the specifics of their investigation so that a consistent warrant can be produced, avoiding the “thumb drive Frankenstein templates” that seem to float around every agency. Relying on these TDFTs as an agency results in inconsistent formatting, structure and verbiage.

The program is currently built using Python and leveraging the libraries PyQT6, docxtpl and pyinstaller. There are future plans in motion, but this post is about the current release. The basic structure of the program takes the input from the user, builds a dictionary form the inputs and then applies the values from the dictionary to the .docx template file. Simple, right?

Well, it was very simple at first. When I introduced the concept of template verbiage, things got a bit more complicated. I wanted a simple way for officers to select “canned” verbiage like “Indicia of occupancy or residency to include identification card, utility bills, keys…” etc. etc. I also wanted to allow for updating that verbiage on the fly, since many of the digital forensic examples I had seen were including things like tape drives, tapes, floppy diskettes etc., even though the vast majority of cases did not warrant the inclusion of such items. To that end, I created a supplemental source file, which consisted of topical lists:

list1 = [
 "List 1 Title",
 "List one item one",
 "List one item two"
]
list2 = [
 "List 2 Title",
 "List two item one",
 "List two item two"
]

By making this supplementary file, the person deploying this warrant builder can modify any verbiage they find appropriate for their particular agency or mission, without having to overhaul the entire program. The program will reach out and ingest this supplemental file and produce selectable pieces of template verbiage for the end user to include in their warrant. The first value in each of the lists will be the text that is printed into the “button” to expand or contract that particular topic.

Because each individual writing a warrant is also expected to define their own qualifications, the program also has the ability to accept user input to save their training and experience to a source text file which is reusable for future iterations through the program.

And finally, because some cases necessitate several warrants with much the same information, I implemented a feature by which the user can select from previously submitted warrants to automagically repopulate the builder program with the same user inputs as that previously generated warrant. The program accomplishes this by creating JSON output at the same time as the .docx warrant which can later be brought back into the program. The program also allows for selective removal of any one JSON history file or the wholesale clearing of the folder containing the JSON history files.

Finally, PyInstaller is used to encapsulate the program as well as the dependencies to make operation of the program painless for the end user. No expectation of python knowledge etc. for the “boots on the ground”, just a straightforward assistant in getting a repeatable, consistent product. Minor changes are still happening with the program, but it is available here:

https://github.com/Whee30/warrantBuilder

If you try it out, please let me know what you think!

Update 05/09/2025:

I changed up the function a bit to make modifications simpler and to remove some inefficiency in the code. The supplemental “common verbiage” file was converted from a .py whose whole job was to hold lists into a JSON which accomplishes the same task in a simpler manner. I added another JSON (settings.json) in order to make the dynamic changing and loading of agency/location/court/rank variables far simpler. Because the agency specific values are no longer housed within the script itself, the script can be containerized into an executable via pyinstaller and changes can still be made to the effective output of the program. The new JSON is simple and to the point:

{
    "county_options": [
        "County 1",
        "County 2",
        "County 3"
    ],
    "court_options": [
        "Magistrate Court",
        "City Court",
        "County Court",
        "Superior Court"
    ],
    "rank_options": [
        "Ofc.",
        "Det.",
        "Cpl.",
        "Sgt.",
        "Lt."
    ],
    "state_name":"Arizona",
    "agency_name":"Anytown Police Department"
}

By changing the quantity, order and/or content of the lists/variables in this JSON, the drop-down options within the program will be changed. The default value will be the first in the list and the court drop down will remain editable within the program itself for cases in which a new court needs to be referenced on the fly.

x64 and ARM executables are now available for the program, it should actually be usable for people now, assuming they can modify the warrant .docx template to their liking.

Leave a Reply

Your email address will not be published. Required fields are marked *

Digital Forensics and general nerdery. Learning bit by bit (heh) and fighting off imposter syndrome. Learning python, adapting it to my work and overcomplicating simple processes most of the time.