OpenPolice Package's File & Folder Layout

Laravel is a Model View Controller (MVC), and the OpenPolice package is installed on top. SurvLoop was built for this project, and it has separate layout documentation. Below is a general map of the OpenPolice package.

If you're new to Laravel, this gets installed here: /root-folder/vendor/flexyourrights/openpolice

flexyourrights/openpolice

  • composer.json: Defines more packages required by OpenPolice, as well as easier references to some packages.
  • src: Repository's main source code.
    • OpenPoliceServiceProvider.php: OpenPoliceServiceProvider manages which package files and folders need to be copied to elsewhere in the system. This mostly just runs after installation, and perhaps of some other code updates.
    • routes.php: All of OpenPolice's custom routing happens here, passing a url request to the right Controller.
    • Controllers: Most of the PHP algorithms and logic which process and manipulate data, and call Views to output the proper results.
    • Database: Includes migration and seeder files which Laravel can use to install OpenPolice.
    • Models: Copies of all the Eloquent Models used by this package, generated by this same OpenPolice installation.
    • Public: Contains images and photos in OpenPolice's public media gallery — to be merged into Uploads folder.
    • Uploads: Contains images and photos in OpenPolice's public media gallery.
    • Views: Includes Blade Templates which are called by controllers, and where most of OpenPolice's HTML, Javascript, and CSS can be found. Templates for...
      • admin: general OpenPolice admin interfaces
        • db: customize database admin tools
      • ajax: printing results of specific jQuery/AJAX requests custom to OpenPolice
      • nodes: printing hard-coded nodes which appear within OpenPolice surveys or web content pages
      • volun: printing hard-coded interfaces for volunteers' research of police department policies
  • tests: Holding place to remind me to add as much unit testing as possible and appropriate.

flexyourrights/openpolice-departments

  • src/OpenPoliceDeptSeeder.php: database import for 18,000+ police departments and complaint policies.


Structure of OpenPolice Classes & Objects

This section provides a top-level map of the Controllers folder, and how its most influential classes and objects relate to each other.

Some of these long chains of extensions were simply steps toward breaking up long files. I hope to keep splitting out functions which don't need to load in some thick trunks.


OpenPolice is the primary encompassing class for this software.

  • extends OpenInitExtras
    • extends OpenPartners
      • extends OpenVolunteers
        • instantiates VolunteerLeaderboard
        • extends OpenDevelopment
          • extends OpenReportToolsAdmin
            • extends OpenReportToolsOversight
              • extends OpenReportTools
                • extends OpenReport
                  • extends OpenDepts
                    • extends OpenListing
                      • extends OpenAjax
                        • extends OpenComplaintSaves
                          • extends OpenComplaintConditions
                            • extends OpenSessDataOverride
                              • extends OpenComplaintPrints
                                • extends OpenComplaintEmails
                                  • extends OpenPoliceEvents
                                    • extends OpenPoliceAllegations
                                      • extends OpenPolicePeople
                                        • extends OpenPoliceUtils
                                          • instantiates DepartmentScores
                                          • extends OpenPoliceVars
                                            • extends SurvLoopControllersTreeTreeSurvForm
                                              • instantiates OpenPoliceSearcher
                                                • extends SurvLoopControllersSearcher

OpenPoliceAdmin provides some additional customizations to SurvLoop defaults when users are logged in.

  • extends OpenInitExtras
    • extends SurvLoopControllersAdminAdminController
      • instantiates OpenPoliceAdminMenu
        • extends SurvLoopControllersAdminAdminMenu

Roadmap for Codebase

Current plans for improving the organization and structures of the codebase...

  • Add list of officers with complaints to department pages.
  • Complete MVP staff tools for managing complaints.
  • Require MFA for staff logins.
  • Start adding unit tests to functions and ideally whole files.
  • Break off any independent components from being within the OpenPolice extension of SurvLoop's Tree Trunk, which can instead instantiate side-classes when on demand.
  • Adding comments to the remaining functions.

Updated October 25, 2019