Skip to content
@safe-route

Safe Route

Safe route project
  • Indonesia

Háedir

Project documents, central documentation and artifacts.

Table of Contents

Team C22-PS305

  • M2002F0101 - Christopher Chandrasaputra
  • M2006F0613 - Hanif Adam Al Abraar
  • A2183F1771 - Fillah Akbar Firdausyah
  • A2009J0968 - Ikhsan Cahya Mardika
  • C2009F0967 - I Putu Cahya Adi Ganesha
  • C2306G2617 - Muhammad Anggi Wirahmat

Overview

This is the central project visibility repository, providing you with a high-level overview of the project safe route. For a deeper overview of the project please refer to the respective project in the group.

How to navigate

  1. To see the product backlog in GitLab go to issues in the side bar and choose board to see the Kanban Board
  2. Keep scrolling this view to find the link to various project artifacts (open with Bangkit Academy Organization Account)

Project Artifacts

Documentation

Central repository documentation for each learning path.

Android Path

Safe route android app build with kotlin to comunicate with our technology

Overview

Library

in this app we use library such as:

Installation

Note: Before installing this project to your machine make sure minimum you have installed Android Studio Bumblebee (2021.1.1) Stable

git clone https://gitlab.com/safe-route/android-app.git

then sync the Graddle or Build > Rebuild Project

Structure

No definite structure for this project, this is just basic Android Project Structure. go to mainpackage. to access the google maps service, Edit AndroidManifest.xml and then place your Google Map Api Key. and also place your Google Map Api Key to this line code buildConfigField("String", "API_KEY", '"PlAcEYouRAPIkeYHeRE"') in the Graddle file.

MVVM Architecture Pattern

mvvm This project use mvvm patern for easly to maintain and organizing code.

Room Database

For costumize the database go to mainpackage/database/DataRoomDatabase.kt @Database(entities = [DataTraining::class, DataPredict::class], version = 1) and update the version

Api

Note: To use your API go to the folder mainpackage/api then customize according to your needs

Feature

  • Statistic alt text alt text

  • Map alt text centroid routing

  • Report report crime

Known Issue

  • Handle background service efficiently
  • Versioning Roomdatabase
  • UI/UX

Reference

Cloud Computing Path

For a Bird Eye View of the API Docs Go Here

Overview

  1. calculate_trigger_function.
  2. cloud-shell-script.
  3. clustering-from-bq
  4. clustering-job
  5. front-facing-website
  6. get_subdistrict_stat
  7. json-to-firestore
  8. parse-to-bigquery-table
  9. return_all_subdistrict_coord
  10. saferoute-jwt-express
  11. service-composer
  12. valhalla-server
  13. web-app-sandbox

Machine Learning Path

Overview

Clustering

Model Description

Clustering model is produced using scikit-learn DBScan class. Centroid comes from the average of each cluster with the range is the maximum distance of centroid to one of cluster members.

Model generation

  • Model : Use create_model() method
  • Statistic : Use generate_area_statistic(data) with data being the DataFrame of csv file

Centroid

JSON File Format

{
    "centroids": [
        {
            "id": ... (int),
            "latitude": ... (float),
            "longitude": ... (float),
            "range": ... (float),
            "crime_info": {
                <crime_type>(string): ... (int),
                ...
            }
        },
        ...
    ]
}

Statistic

JSON File Format

{
    "statistic": [
        "subdistrict": ... (string),
        "total_crime": ... (int),
        "crime_info": {
            <crime_type>(string): ... (int),
            ...
        }
        "coordinates": ... (list of* float)
    ]
}

Statistic JSON File Note:

  • coordinates list order is latitude, longitude
  • list may contain another list
  • please take a look at area_statistic.json before use

Habit Tracker

Model Description

Habit tracker model is created for each user that use the application, it utilize LSTM mechanics to predict multivariate multilabel time series data. Model will be fed with multiple inputs which is date, time, and location. The model will give location (latitude and longitude) as output.

Model Generation

User's model will be generated when the endpoint /create called with username as URL parameters*.

* further endpoint detail will be given below

Model

Model: "sequential"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 lstm (LSTM)                 (None, 15, 64)            18176     
                                                                 
 lstm_1 (LSTM)               (None, 15, 32)            12416     
                                                                 
 lstm_2 (LSTM)               (None, 16)                3136      
                                                                 
 flatten (Flatten)           (None, 16)                0         
                                                                 
 dense (Dense)               (None, 16)                272       
                                                                 
 dense_1 (Dense)             (None, 8)                 136       
                                                                 
 dense_2 (Dense)             (None, 2)                 18        
                                                                 
=================================================================
Total params: 34,154
Trainable params: 34,154
Non-trainable params: 0
_________________________________________________________________
  • Model input shape=(15, 6)
  • Model input data columns:
column type range description
year integer * year timestamp
month integer 1 - 12 month timestamp
day_of_week integer 1 - 7 day of week
time integer 0 - 1440 cumulative minute of day
latitude float -90.0 - 90.0 latitude
longitude float -180.0 - 180.0 longitude
  • Model output:
column type range description
latitude float -90.0 - 90.0 latitude
longitude float -180.0 - 180.0 longitude

Flask

url: https://model-ck44nnq7hq-as.a.run.app

endpoint url_param body method
/create username(string) - GET
/train username(string) json-object-1* POST
/forecast username(string) json-object-2* POST

* refer to the format below

  • json-object-1
{
	"username": ...,
	"data": [
	        {
	            "datetime": ...,
	            "latitude": ...,
	            "longitude": ...
	        },
	        ...
	        {
	            "datetime": ...,
	            "latitude": ...,
	            "longitude": ...
	        }
	    ]
}
  • json-object-2
{
	"username": ...,
    "email": ...,
    "latitude": ...,
	"longitude": ...,
	"data": [
	        {
	            "datetime": ...,
	            "latitude": ...,
	            "longitude": ...
	        },
	        ...
	        {
	            "datetime": ...,
	            "latitude": ...,
	            "longitude": ...
	        }
	    ]
}
  • json key-value description
key value range
username string -
email string -
latitude float -90.0 - 90.0
longitude float -180.0 - 180.0
data json-array-of-object -
datetime timestamp %yyyy/%mm/%dd %hh:%MM:%ss

Known Issues

  • Clustering - Require real data from local authorities
  • Habit Tracker - Model architecture has not yet been optimized
  • Habit Tracker - Costly data and model pipelining
  • Habit Tracker - Require a lots of data to create optimum model

Research and Paper Source

  • E. Eck, Chainey, G. Cameron, Leitner, E. Wilson. "Mapping Crime: Understanding Hot Spots". NIJ Special Report (2005): 0-77.

Pinned Loading

  1. machine-learning machine-learning Public

    Machine learning repository

    Python

  2. CC-gcp-endpoints CC-gcp-endpoints Public

  3. android-app android-app Public

    Kotlin

  4. haedir haedir Public

Repositories

Showing 10 of 20 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…