a pythonic query language
Sign in or create a new account.

S(1@1) R(COD@1)
2093.0 Vehicle
10781.0 Gunshot
125.0 Beaten/Bludgeoned with instrument
14.0 None
69.0 Drowned
42.0 Drug overdose
34.0 Fell from a height
64.0 Undetermined
198.0 Medical emergency
134.0 Asphyxiated/Restrained
16.0 Stabbed
18.0 Chemical agent/Pepper spray
12.0 Burned/Smoke inhalation
13.0 Other
561.0 Tasered
5.0 Unknown
7.0 Asphyxiated
1.0 Pepper spray
4.0 Taser
4.0 Unreported
1.0 Beaten
1.0 Restraint
1.0 Restraint / Overdose
1.0 Jumped / Fell
1.0 Asphyxiation

Address, Age, CauseOfDeath, City, County, Date, DayOfMillenium, DayOfWeek, Description, ImageURL, LawEnforcementAgency, Month, Name, NewsURL, OfficialDisposition, Prace, Sex, State, SymptomsOfMentalIllness, Year, Zip

The PyQL query format is: fields @ conditions.
  fields is a field or a comma delimited list of fields.
 conditions is a condition or an and delimited list of conditions.

Both fields and conditions are made up of terms.
A term is a valid Python expression in a name space made up of: database parameters; any imported python modules; PyQL Aggregators such as Average (A), Sum (S), and Replace (R); and other domain specific terms.

About the Fatal Encounter DatabaseSample Queries
The Data

This database was download as a spreadsheet from FatalEncounters.org. Brian Burghart maintains this spreadsheet and welcomes your support. You can e-mail Brian d.brian [at] fatalencounters.org.

The first step in importing Brian's spreadsheet into a PyQL database involved taking non-alpha numberic characters out of headers and using them in CamelCase. For example, the spreadsheet header of 'law enforcement agency' becomes the database parameter 'LawEnforcementAgency'.

Agile Access to Database Parameters

The CamelCaseFormatting of database parameters is logical, readable, and verbose. With domain specific query languages you get to make the rules for parameter reference. And here we like: Access parameters by their capitalized letters and fill in lower case letters as needed to remove ambiguity. Like this for getting the the Date,Name,CauseOfDeath,OfficialDisposition, and the Prace (perceived race) for fatal encounters with law enforcement in Multnomah County:

To see the number of fatal encounters with law enforcement for each city in the database, use the PyQL: S(1),R(City)@City

This query form is handy for breakdown by any parameter. To see fatal encounters by state, use the PyQL: S(1),R(St)@St

And likewise for CauseOfDeath, use the PyQL: S(1),R(COD)@COD

And for Prace (perceived race), use the PyQL: S(1),R(P)@P

To see details of all fatal encounters in Portland, Oregon, use the PyQL: Name,Date,COD,OD,SOMI@City='Portland' and State='OR' s.