tp

User Guide

Contents

Introduction

parKING is a desktop app that helps drivers choose the best place to park via the Command Line Interface (CLI). parKING allows users to search, save and look at carpark availability information at a glance, while interfacing with LTA’s real-time API. Whenever you launch parKING, it automatically gets the latest carpark availability and updates the local data immediately. The best part about parKING is that it can be used offline (based on the data you have saved the last time you are connected to the internet).

With parKING, you can plan your parking destination in advance or simply check lot availability before you leave. We strive to become your driving companion, keeping you at ease while ensuring that your vehicle will always get a parking lot when you arrive at your destination. We got you and your loved ones parked!

Disclaimer regarding use of API key for the purposes of NUS CS2113

We understand that an API key is something personal and should not be shared with everyone. However, for the purpose of NUS CS2113, we have provided a default API key for testing purposes. This default API key will be removed at the end of module in Q4 2022.

Quick Start

  1. Ensure that you have Java 11 or above installed.
  2. Download the latest version of parKING from here.
  3. [Recommended] For continued usage of the application, do sign up for your personal API key through LTA.
  4. Use the command java -jar parKING.jar to start the program!
  5. Note that the program will automatically create a directory called resources to store local data files.
  6. Here are some simple commands to get you started.
    1. To authenticate using your personal API key, use the command auth API_KEY.
    2. To get detailed information on a carpark using its ID, use the command find CARPARK_ID.
    3. To get the list of carpark by address keyword, use the command filter QUERY.
    4. Use favourite CARPARK_ID/unfavourite CARPARK_ID to add / remove certain carparks into your favourite list.

See more details in the Features Section below.

Features

Notes about the command format:

Command Shortcuts Description
auth API_KEY a API_KEY Authenticate API using user’s API key
auth default a default Authenticate API using default key
auth status a status Authentication status
find CARPARK_ID fin CARPARK_ID Find number of lots available by carpark ID
filter QUERY fil QUERY Filter carparks based on address
filter -id QUERY fil -id QUERY Filter carparks based on carpark ID
list l Get a list of available carparks on the app
update u Update data from API
favourite CARPARK_ID fav CARPARK_ID Favourite carparks by carpark ID
unfavourite CARPARK_ID ufav CARPARK_ID Unfavourite carparks by carpark ID
favourite list fav list List lot availability of favourite carparks
help h List all possible commands
exit e Exiting the program

Authenticate user API

Authenticate and subscribe to the API Service (LTA Data Mall) using the user’s API key.

Format : auth API_KEY or a API_KEY

Example of usage:

Input (assuming 12345678 is a valid API key)

auth 12345678

Output

2316 rows of carpark data received from LTA!
Authenticated successfully.

Authenticate default

Authenticate using the default API key.

Format: auth default or a default

Example of usage:

Input

auth default

Output

2316 rows of carpark data received from LTA!
Authenticated successfully using default API Key.

Authentication status

Get the status of the API key authentication status.

Format: auth status or a status

Example of usage:

Input

auth status

Output

You have authenticated your API key successfully. API key stored in the local file 
is ********
You have not authenticated your personal API key. Currently you have access to the 
API but you are using our default key!

Find number of lots by carpark ID

Returns detailed information about the carpark that the user has chosen to find.

Format: find CARPARK_ID or fin CARPARK_ID

Example of usage:

Input:

find a9

Output:

===========================================
BLK 202/203 ANG MO KIO STREET 22
===========================================
Carpark code: A9
Favourited: No
Number of available lots (total): 52
  Cars: 52 lots
  Motorcycles: 0 lots
  Heavy Vehicles: 0 lots
Last Updated: 04-11-2022 19:28:10
===========================================

Filter carparks based on address

Shows a summarised list of carparks that match a given query based on its address.

Format: filter QUERY, fil QUERY (dashed argument -address optional)

Note: The filter command allows for dashed arguments -address and -id to switch modes, but if none is provided it defaults to address mode above.

Related: Filter carparks based on carpark ID

Example of usage:

Input:

filter clem ave 2

Output:

CarparkID C28M at BLK 208 CLEMENTI AVE 6
--> 233 available lots total
CarparkID C5 at BLK 358-360,362-363,366-367 CLEMENTI AVE 2
--> 173 available lots total
CarparkID C6 at BLK 328-334 CLEMENTI AVE 2
--> 129 available lots total
CarparkID C7 at BLK 349-355 CLEMENTI AVE 2
--> 223 available lots total
CarparkID C8 at BLK 335/338 CLEMENTI AVE 2
--> 240 available lots total

Filter carparks based on carpark ID

Shows a summarised list of carparks that match a given query.

Format: filter -id QUERY or fil -id QUERY

Note: To use the filter command in ID mode, a dashed argument -id is required.

Related: Filter carparks based on address

Example of usage:

Input:

filter -id 7a 8a

Output:

CarparkID B7A at BLK 216/218 BEDOK NORTH ST 1
--> 0 available lots total
CarparkID C18A at BLK 426/427 CLEMENTI AVE 3
--> 25 available lots total
CarparkID CK8A at BLK 203A CHOA CHU KANG AVE 1/CENTRAL
--> 297 available lots total
CarparkID T47A at BLK 864B TAMPINES STREET 83
--> 123 available lots total

Get a list of carparks on the app

Returns a list of all the available carparks stored in parKING.

Format: list or l

Example of usage:

Input:

list

Output:

CarparkID T0129 at TANJONG KATONG COMPLEX
   182 available lots total
CarparkID KU1 at BLK 301/305-306/311-318 UBI AVENUE 1
   376 available lots total
CarparkID SAM2 at BLK 61 STRATHMORE AVENUE
   302 available lots total
CarparkID HG80 at BLK 941A HOUGANG STREET 92
   730 available lots total

Update data from API

Fetches the most updated availability data and stores it locally.

Format: update or u

Note: Tampering with the .json files generated can result in the data fetched from the update command to be skipped and not loaded in. For more information see ltaResponse.json and ltaResponseSample.json JSON files from the API

Example of usage:

Input

update

Output

2316 rows of carpark data received from LTA!
Update Successful.

Favourite carparks by carpark ID

Saves the carpark to a list of favourited carparks for easy subsequent access.

Format: favourite CARPARK_ID or fav CARPARK_ID

Example of usage:

Input (assuming carpark ID 1 is not favourited):

favourite 1

Output:

Added Carpark 1 to favourites!

Input (assuming carpark ID J8 is already favourited):

favourite J8

Output:

Carpark already in list.
Nothing to add to favourites!

Input:

favourite not_a_carpark_ID

Output:

No carpark was found.

For advanced users:

Unfavourite carparks by carpark ID

Removes the carpark from a list of favourited carparks.

Format: unfavourite CARPARK_ID or ufav CARPARK_ID

Example of usage:

Input (assuming carpark ID 1 is favourited):

unfavourite 1

Output:

Removed Carpark 1 from favourites!

Input (assuming carpark ID M32 is not favourited):

unfavourite M32

Output:

Some carparks not found in favourite list! Skipping...
Nothing to remove from favourites!

For advanced users:

List lot availability of favourite carparks

Displays the name, ID and total lot availability of all favourite carparks.

Format: favourite list or fav list

Example of usage:

Input:

favourite list

Output:

CarparkID D0006 at DUXTON HILL OFF STREET: 104 lots available
===========================================
CarparkID CKM6 at BLK 462A CHOA CHU KANG AVE 4: 1606 lots available
===========================================
CarparkID A9 at BLK 202/203 ANG MO KIO STREET 22: 102 lots available
===========================================
CarparkID J8 at BLK 232/240 JURONG EAST ST 21: 318 lots available
===========================================

List all possible commands

Returns a list of all the available command of the program.

Format : help or h

Example of usage:

Input:

help

Output

Here are the list of available commands to use! Refer to the user guide at 
https://ay2223s1-cs2113-t17-4.github.io/tp/UserGuide.html for more information.
`help` or `h` 	: To display all possible commands.
`exit` or `e` 	: To quit parKING.
`list` or `l` 	: List the carparks and its details.
`auth API_KEY` or `a API_KEY` 	: To authenticate your personal API key.
`auth default` or `a default` 	: To authenticate using the default key provided 
by parKING.
`auth status` or `a status` 	: To get the authentication status.
`update` or `u` 	: To fetch the latest data from LTA.
`filter QUERY` or `fil QUERY`	: Filter carparks based on Carpark information.
`filter -address QUERY` or `fil -add QUERY` 	: Filter carparks based on its 
Carpark address.
`filter -id QUERY` or `fil -id QUERY` 	: Filter carparks based on its Carpark ID.
`find CARPARK_ID` or `fin CARPARK_ID` 	: Display information about the specific 
queried carpark based on carpark ID.
`favourite list` or `fav list` 	: To get the list of favourited carparks.
`favourite CARPARK_ID` or `fav CARPARK_ID` 	: Favourite carpark by its ID.
`unfavourite CARPARK_ID` or `ufav CARPARK_ID` 	: Unfavourite carpark by its ID.

Exiting the program

Terminates the program.

Format: exit or e

Input:

exit

Output

Exiting program.
Goodbye.

Editing Files

Advanced users may want to enter data more efficiently, or customise the data in ways currently not possible through the CLI. For example, you may want to enter favourites without the need to run the program in a command prompt, or edit the names of carparks for convenient finding. Below are the various files generated by parKING.

NOTE: Please do not tamper with the files with permissions settings, e.g. making them read-only or hidden. For parKING to function it must be able to read and write to all files it generates.

How files are generated

If no files exist at the time of running the program, the necessary files and directories will be created within the directory that the .jar file was run from.

favourites.txt Favourites list

Location: .\resources\api\favourite\favourite.txt

How files are saved and loaded

Supported editing behaviour

secret.txt Access token file

Location: .\resources\api\secret.txt

How files are saved and loaded

Supported editing behaviour

carparkList.txt Carparks list

Location: .\resources\carparkList.txt

How files are saved and loaded

Supported editing behaviour

Each row corresponds to one carpark, and fields can be edited and retained to be updated. For example, a carpark with a development of BLK 309 CLEMENTI AVE 1 can be renamed to Mum's place, and future updates to this file will retain that information for easy tracking and use within the program.

The carparkList.txt file is only loaded at initialisation, and should only be edited while the program is not open. Editing the carparkList.txt file while the program is running will result in your changes being overwritten.

Any files with invalid format will be erased and written over with a valid format from within the program. Please make sure that the format is strictly adhered to or risk losing all your data.

Note: Updating this file requires both the incoming carpark data and the existing data to have the same Carpark ID. Changing the Carpark ID is not recommended, and files with duplicate Carpark ID will be discarded and regenerated.

Format of one row in the carparkList.txt file is shown below:

1 || Marina || Suntec City || 1.29375 103.85718 || 1051 || 1051 0 0 || false || 
LTA || 04-11-2022 19:28:10 

ltaResponse.json and ltaResponseSample.json JSON files from the API

WARNING: These are raw files generated from data fetched from the API, and are not recommended to be edited. Any files with formatting errors will be deleted completely and will not be loaded in to the program. As such, editing these files is unsupported.

ltaResponse.json is a file with data generated by the API over the internet, fetched whenever update is used or on initialisation of the program. If the program fails to fetch data from the API, or it is in an incorrect format, this file will be skipped and not loaded in.

ltaResponseSample.json is backup data generated from the program internally, meant as a “demo mode” to test and use parKING’s features offline if there isn’t an internet connection. If the program fails to load properly the data from ltaResponse.json, data from ltaResponseSample.json is loaded in instead.

If both .json files produce errors, a valid ltaResponseSample.json file is regenerated from within the program and then loaded in.

Do not edit these files unless you know what you are doing. Edit the carpark.txt file instead if you would like to change details about the carparks.

FAQ

Q: How is the data for the carparks stored? Can I change or edit this data?

A: The carpark data is first fetched in a .json format, under .\resources\api\ltaResponse.json. Then, this carpark data is written to a .txt file at .\resources\carparkList.txt. If you wish to manually edit any carpark data, you can do so as long as the format is maintained. These changes will be reflected when you restart the program.

Command Summary

Command Shortcuts Description
auth API_KEY a API_KEY Authenticate API using user’s API key
auth default a default Authenticate API using default key
auth status a status Authentication status
find CARPARK_ID fin CARPARK_ID Find number of lots by carpark ID
filter QUERY fil QUERY Filter carparks based on address
filter -id QUERY fil -id QUERY Filter carparks based on carpark ID
list l Get a list of available carparks on the app
update u Update data from API
favourite CARPARK_ID fav CARPARK_ID Favourite carparks by carpark ID
unfavourite CARPARK_ID ufav CARPARK_ID Unfavourite carparks by carpark ID
favourite list fav list List lot availability of favourite carparks
help h Lists all possible commands
exit e Exiting the program