Skip to content

Commit

Permalink
v1.5.1 public release
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-Hill-i2 committed Sep 16, 2022
1 parent b18460a commit d92f503
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public class SocrataResponseData {
public LocalDate complaintEndDate;

@JsonProperty("cmplnt_fr_tm")
public LocalTime complaintStartTime;
public String complaintStartTime;

@JsonProperty("cmplnt_to_tm")
public LocalTime complaintEndTime;
public String complaintEndTime;

@JsonProperty("crm_atpt_cptd_cd")
public String crimeStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.springframework.core.io.Resource;

import java.io.IOException;
import java.time.LocalTime;
import java.util.HashMap;

/** Used to generate entity and link objects */
Expand All @@ -52,8 +53,8 @@ public EntityData createComplaint(SocrataResponseData entry) {
properties.put("PT1", entry.complaintNum);
properties.put("PT2", entry.complaintStartDate);
properties.put("PT3", entry.complaintEndDate);
properties.put("PT4", entry.complaintStartTime);
properties.put("PT5", entry.complaintEndTime);
properties.put("PT4", parseStringToTime(entry.complaintStartTime));
properties.put("PT5", parseStringToTime(entry.complaintEndTime));
properties.put("PT6", entry.crimeStatus);
properties.put("PT7", entry.jurisdictionCode);
properties.put("PT8", entry.jurisdictionDesc);
Expand All @@ -74,6 +75,13 @@ public EntityData createComplaint(SocrataResponseData entry) {
return complaint;
}

private LocalTime parseStringToTime(String time) {
if (time.equals("(null)")) {
return null;
}
return LocalTime.parse(time);
}

/**
* Creates location from a single record of data.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def __init__(self, entry):
'PT1': entry.get('cmplnt_num'),
'PT2': entry.get('cmplnt_fr_dt')[:10] if entry.get('cmplnt_fr_dt') else None,
'PT3': entry.get('cmplnt_to_dt')[:10] if entry.get('cmplnt_to_dt') else None,
'PT4': entry.get('cmplnt_fr_tm'),
'PT5': entry.get('cmplnt_to_tm') if entry.get('cmplnt_to_tm') else None,
'PT4': sanitizeTime(entry.get('cmplnt_fr_tm')),
'PT5': sanitizeTime(entry.get('cmplnt_to_tm')) if entry.get('cmplnt_to_tm') else None,
'PT6': entry.get('crm_atpt_cptd_cd'),
'PT7': int(float(entry.get('jurisdiction_code'))) if entry.get('jurisdiction_code') else None,
'PT8': entry.get('juris_desc'),
Expand Down Expand Up @@ -183,6 +183,10 @@ def __init__(self, entry):
id = get_id("SO", entry)
super().__init__("SO" + id, type_ids['suspect_of'], None, generate_source_ref(entry.get('cmplnt_num')))

def sanitizeTime(time):
if time.__eq__("(null)"):
return None

def get_id(base, entry):
id = int(entry.get('cmplnt_num'))
return base + str(id)
Expand Down
32 changes: 28 additions & 4 deletions connector/nypd/python/sample-solution/nypd-connector/setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
@echo off
@REM i2, i2 Group, the i2 Group logo, and i2group.com are trademarks of N.Harris Computer Corporation.
@REM © N.Harris Computer Corporation (2022)
setlocal

IF NOT DEFINED SHELL_PATH (
SET SHELL_PATH=%PROGRAMFILES%\Git\bin\sh.exe
echo Checking if Python is installed...
python -V
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "tokens=2" %%a in ('python -V') do set version=%%a

set VERSION=%version%
echo Detected Python v%VERSION%.

set NUMBER=%VERSION%/Python

echo Installing pipenv...
pip install pipenv

echo Checking pipenv version...
pipenv --version
if %errorlevel% neq 0 (
echo:
echo Update the PATH variable in your environment to include the locations of both the Python application and its scripts directory.
exit /b %errorlevel%
)

"%SHELL_PATH%" "%~dp0setup.sh" %*
echo Running Python...
pipenv --python %NUMBER%

echo Creating Piplock.file...
pipenv lock

echo Syncing dependencies...
pipenv sync
32 changes: 28 additions & 4 deletions connector/nypd/python/stage1/nypd-connector/setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
@echo off
@REM i2, i2 Group, the i2 Group logo, and i2group.com are trademarks of N.Harris Computer Corporation.
@REM © N.Harris Computer Corporation (2022)
setlocal

IF NOT DEFINED SHELL_PATH (
SET SHELL_PATH=%PROGRAMFILES%\Git\bin\sh.exe
echo Checking if Python is installed...
python -V
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "tokens=2" %%a in ('python -V') do set version=%%a

set VERSION=%version%
echo Detected Python v%VERSION%.

set NUMBER=%VERSION%/Python

echo Installing pipenv...
pip install pipenv

echo Checking pipenv version...
pipenv --version
if %errorlevel% neq 0 (
echo:
echo Update the PATH variable in your environment to include the locations of both the Python application and its scripts directory.
exit /b %errorlevel%
)

"%SHELL_PATH%" "%~dp0setup.sh" %*
echo Running Python...
pipenv --python %NUMBER%

echo Creating Piplock.file...
pipenv lock

echo Syncing dependencies...
pipenv sync
32 changes: 28 additions & 4 deletions connector/nypd/python/stage2/nypd-connector/setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
@echo off
@REM i2, i2 Group, the i2 Group logo, and i2group.com are trademarks of N.Harris Computer Corporation.
@REM © N.Harris Computer Corporation (2022)
setlocal

IF NOT DEFINED SHELL_PATH (
SET SHELL_PATH=%PROGRAMFILES%\Git\bin\sh.exe
echo Checking if Python is installed...
python -V
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "tokens=2" %%a in ('python -V') do set version=%%a

set VERSION=%version%
echo Detected Python v%VERSION%.

set NUMBER=%VERSION%/Python

echo Installing pipenv...
pip install pipenv

echo Checking pipenv version...
pipenv --version
if %errorlevel% neq 0 (
echo:
echo Update the PATH variable in your environment to include the locations of both the Python application and its scripts directory.
exit /b %errorlevel%
)

"%SHELL_PATH%" "%~dp0setup.sh" %*
echo Running Python...
pipenv --python %NUMBER%

echo Creating Piplock.file...
pipenv lock

echo Syncing dependencies...
pipenv sync
32 changes: 28 additions & 4 deletions connector/nypd/python/stage3/nypd-connector/setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
@echo off
@REM i2, i2 Group, the i2 Group logo, and i2group.com are trademarks of N.Harris Computer Corporation.
@REM © N.Harris Computer Corporation (2022)
setlocal

IF NOT DEFINED SHELL_PATH (
SET SHELL_PATH=%PROGRAMFILES%\Git\bin\sh.exe
echo Checking if Python is installed...
python -V
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "tokens=2" %%a in ('python -V') do set version=%%a

set VERSION=%version%
echo Detected Python v%VERSION%.

set NUMBER=%VERSION%/Python

echo Installing pipenv...
pip install pipenv

echo Checking pipenv version...
pipenv --version
if %errorlevel% neq 0 (
echo:
echo Update the PATH variable in your environment to include the locations of both the Python application and its scripts directory.
exit /b %errorlevel%
)

"%SHELL_PATH%" "%~dp0setup.sh" %*
echo Running Python...
pipenv --python %NUMBER%

echo Creating Piplock.file...
pipenv lock

echo Syncing dependencies...
pipenv sync
32 changes: 28 additions & 4 deletions connector/nypd/python/stage4/nypd-connector/setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
@echo off
@REM i2, i2 Group, the i2 Group logo, and i2group.com are trademarks of N.Harris Computer Corporation.
@REM © N.Harris Computer Corporation (2022)
setlocal

IF NOT DEFINED SHELL_PATH (
SET SHELL_PATH=%PROGRAMFILES%\Git\bin\sh.exe
echo Checking if Python is installed...
python -V
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "tokens=2" %%a in ('python -V') do set version=%%a

set VERSION=%version%
echo Detected Python v%VERSION%.

set NUMBER=%VERSION%/Python

echo Installing pipenv...
pip install pipenv

echo Checking pipenv version...
pipenv --version
if %errorlevel% neq 0 (
echo:
echo Update the PATH variable in your environment to include the locations of both the Python application and its scripts directory.
exit /b %errorlevel%
)

"%SHELL_PATH%" "%~dp0setup.sh" %*
echo Running Python...
pipenv --python %NUMBER%

echo Creating Piplock.file...
pipenv lock

echo Syncing dependencies...
pipenv sync
32 changes: 28 additions & 4 deletions connector/nypd/python/stage5/nypd-connector/setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
@echo off
@REM i2, i2 Group, the i2 Group logo, and i2group.com are trademarks of N.Harris Computer Corporation.
@REM © N.Harris Computer Corporation (2022)
setlocal

IF NOT DEFINED SHELL_PATH (
SET SHELL_PATH=%PROGRAMFILES%\Git\bin\sh.exe
echo Checking if Python is installed...
python -V
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "tokens=2" %%a in ('python -V') do set version=%%a

set VERSION=%version%
echo Detected Python v%VERSION%.

set NUMBER=%VERSION%/Python

echo Installing pipenv...
pip install pipenv

echo Checking pipenv version...
pipenv --version
if %errorlevel% neq 0 (
echo:
echo Update the PATH variable in your environment to include the locations of both the Python application and its scripts directory.
exit /b %errorlevel%
)

"%SHELL_PATH%" "%~dp0setup.sh" %*
echo Running Python...
pipenv --python %NUMBER%

echo Creating Piplock.file...
pipenv lock

echo Syncing dependencies...
pipenv sync

0 comments on commit d92f503

Please sign in to comment.