Kansas City Police Department (KCPD) Connector
The KCPD connector connects to the KCPD Crime 2020 Dataset as the external data source and marshals the data into entities, links and properties. This dataset contains reports on the criminal incidents which the Kansas City Police Department of Missouri have recorded.
There are a number of fields in the dataset:
Column Name | Type |
---|---|
Report_No | Plain Text |
Reported_Date | Date & Time |
Reported_Time | Plain Text |
From_Date | Date & Time |
From_Time | Plain Text |
To_Date | Date & Time |
To_Time | Plain Text |
Offense | Plain Text |
IBRS | Plain Text |
Description | Plain Text |
Beat | Plain Text |
Address | Plain Text |
City | Plain Text |
Zip Code | Plain Text |
Rep_Dist | Plain Text |
Area | Plain Text |
DVFlag | Plain Text |
Involvement | Plain Text |
Race | Plain Text |
Sex | Plain Text |
Age | Number |
Firearm Used Flag | Checkbox |
Location | Location |
Data model
The KCPD schema models the KCPD Crime 2020 Dataset using its relevant fields. Each row of data can be represented by three entities (Report, Person and Location) and a number of appropriate links between them alongside properties extracted from each field.
The schema (and charting schemes) for the KCPD connector can be found in the schema
directory of this repository.
Where Property Type is the name of the schema property, Logical Type is the property's data type, and Derived From is the field of the external dataset where the property is derived from.
Entity: Report
Represents a report about a crime.
Property Type | Logical Type | Derived From |
---|---|---|
Report Number | SINGLE_LINE_STRING | Report_No |
Report Date | DATE | Reported_Date |
From Date | DATE | From_Date |
To Date | DATE | To_Date |
From Time | TIME | From_Time |
To Time | TIME | To_Time |
Offense | SINGLE_LINE_STRING | Offense |
Offense Description | SINGLE_LINE_STRING | Description |
Domestic Violence | BOOLEAN | DVFlag |
Entity: Person
Represents a person somehow involved in a reported crime.
Property Type | Logical Type | Derived From |
---|---|---|
Race | SINGLE_LINE_STRING | Race |
Sex | SUGGESTED_FROM | Sex |
Age | SUGGESTED_FROM | Age |
Entity: Location
Represents a location at which a reported crime occurred.
Property Type | Logical Type | Derived From |
---|---|---|
City | SINGLE_LINE_STRING | City |
Address | SINGLE_LINE_STRING | Address |
Zip Code | INTEGER | Zip Code |
Coordinates | GEOSPATIAL | Location |
Links
Establishes some connection between a Report, a Location and a Person. The KCPD Dataset's Involvement field is used to determine how a Person is linked to a Report.
Link Type | Link Ends |
---|---|
Located At | Report -> Location |
Suspect Of | Person -> Report |
Victim Of | Person -> Report |
Complicit In | Person -> Report |
Arrested | Person -> Report |
Charged | Person -> Report |
Setup
These instructions are for setting up and running the KCPD connector.
If you are not familiar with deploying i2 Analyze with the i2 Connect gateway or deploying i2 Analyze with the Information Store and the i2 Connect gateway and have not previously done so, you must do so now.
1. Add connector to topology
In your topology.xml
file in toolkit\configuration\environment
, add a new <connector-id>
element for the KCPD connector:
<wars>
<war ... >
...
<connector-ids>
<connector-id value="kcpd-connector"/>
</connector-ids>
...
</war>
</wars>
Additionally, add a new <connector>
element to the topology:
<ns1:topology ...>
...
<connectors>
<connector base-url="http://localhost:9083" name="KCPD Connector" id="kcpd-connector"/>
</connectors>
</ns1:topology>
Ensure that you are using the same port specified in the kcpd\kcpd-connector\src\main\resources\application.properties
file in this repository (9083
by default), and that the value of the id
attribute is the same as the value
attribute of its corresponding <connector-id>
.
2. Configure the schema
Choose whether you want to configure the KCPD schema as a connector schema or a gateway schema.
Connector schema
By default, your connector has the KCPD schema configured as a connector schema. schemaUrl
, chartingSchemesUrl
, and schemaShortName
are defined in the KCPD connector's config.json
file, in kcpd\kcpd-connector\src\main\resources
.
Additionally, ensure the following:
- The connector's
config.json
does not contain agatewaySchema
property; - The KCPD
<connector>
element in your i2 Analyze topology does not contain agateway-schema
attribute.
See for more information on configuring a connector schema.
Gateway schema
If you want to set up the KCPD schema as a gateway schema, follow the guidelines for configuring a gateway schema using the KCPD schema and charting scheme found in the schema
directory of this repository.
Additionally, ensure the following:
- The connector's
config.json
inkcpd\kcpd-connector\src\main\resources
does not contain theschemaUrl
,chartingSchemesUrl
andschemaShortName
properties. These properties exist on the configuration by default; if they are present, remove them. - The KCPD
<connector>
element in your i2 Analyze topology does not contain aschema-short-name
attribute.
3. Acquire Socrata token
In order to query the external data source, a Socrata app token is required. If you do not already have a Socrata app token, you will need to generate one. Instructions on how to generate this token can be found here.
In the KCPD connector's application.properties
file at connector\kcpd\kcpd-connector\src\main\resources
, add your token.
server.port=9083
socrata.url=https://data.kcmo.org/resource/vsgj-uufz.json
# API Token. Create a Socrata account and create an API Token. Paste it here
socrata.api.token=
3. Run the KCPD connector
To run the connector, navigate to connector\kcpd\kcpd-connector
in your terminal and run the application using the following command:
mvnw spring-boot:run
For more information on running this repository's Java connectors, see running example connectors in Java.
4. Deploy and start i2 Analyze
Deploy and start the Liberty server.
setup -t deployLiberty
setup -t startLiberty