PROJECT: Incident Management System

Overview

The Incident Management System is a desktop application used for managing incidents and dispatching vehicles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC.

Summary of contributions

  • Major enhancement : Implemented Vehicle Assignment Command

    • What it does: Dispatches nearby vehicles to newly created incidents.

    • Justification: Whenever new incidents are reported, vehicles in the area need to be dispatched to respond to the emergency.

    • Highlights: This enhancement supports both automatic and manual vehicle dispatchment to incident sites, resulting in a multitude of considerations in the algorithm design for both vehicle assignment command and its associated new command. It required an in-depth analysis of the nature of vehicle dispatchment and design alternatives. The implementation too was challenging as many validity checks have to be conducted to handle a range of exceptions.

  • Medium enhancement: Implemented Find Vehicles Command

    • What it does: Searches for vehicles by district number, vehicle type or vehicle number in the existing list of vehicles.

    • Justification: This feature helps operators check the status of vehicles present in a given district, both available and already dispatched. Searching by vehicle type also shows operators the vehicles of a specific type that are present, for them to make relevant judgements and decisions. Searching for vehicles by their vehicle numbers allows operators to locate a vehicle even if they only remember one character in its vehicle number.

    • Highlights: This enhancement significantly increases flexibility in vehicle searching beyond exact matches, which added complexity in the implementation.

  • Minor enhancement: Implemented the Vehicle Model and New Command, allowing for new incident creation and vehicle actions.

  • Code contributed: [View on RepoSense]

  • Other contributions:

    • Enhancements to existing features:

      • Detects irrelevant prefixes in user input (Pull request #270)

      • Allow for case insensitivity of vehicle searches (Pull request #260)

      • Removed repetitive prefixes (Pull request #286)

      • Wrote tests for existing features to increase coverage (Pull requests #178, #292)

    • Documentation:

      • Peer-reviewed and standardised formatting for Developer Guide and User Guide (Pull requests #280, #281)

Contributions to the Developer Guide

Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project.

Incident Draft Creation feature

Implementation

The incident draft creation mechanism is facilitated by the New Command. It creates a new draft incident report based on district of incident, optional automatic vehicle dispatchment. As of now, when there is no vehicle available in the district of incident, a new report cannot be generated.

If created successfully, the draft incident only has three fields filled: operator, district and vehicle dispatched.

There are two ways to use the New Command: 1. Auto dispatchment 2. Manual dispatchment, which requires user to provide a valid index that selects a vehicle

Automatic Vehicle Dispatchment:

Vehicle will be automatically assigned to the incident draft if any is available in the district. If no vehicle is available, an exception will be thrown.

Below is a sequence diagram of a successful case:

NewDraftSequenceDiagramAuto

Manual Vehicle Dispatchment:

User first obtains list of vehicles available in specified district with new dist/DISTRICT auto/n, which prompts user for index of vehicle to dispatch. Note that this list can only be obtained with the input new dist/DISTRICT auto/N, and not based on the list of vehicles currently displayed.

User then inputs the index of vehicle based on the list of available vehicle in given district to dispatch. If no index is provided, or the index is not valid, an exception will be thrown and user will be prompted to provide a valid index.

Below is an activity diagram illustrating the above:

DraftingActivityDiagram

Design Considerations

Aspect: How incident draft creation executes

For auto vehicle assignment:

  • Current Choice: Taking first vehicle on list of available vehicles in district.

    • Pros: Easy to implement

    • Cons: May not be the vehicle nearest to the incident site in real life, thus may not be optimal.

  • Alternative: Add details to location of vehicles to actually allocate the vehicle closest to the incident site.

    • Pros: Optimal efficiency in dispatching vehicles.

    • Cons: Difficult to implement; we do not have enough time.

Fro manual vehicle assignment:

  • Current Choice: Throw exception to prompt user to enter index of vehicle to dispatch.

    • Pros:

      • User need not key in the entire new command again, only need to add the relevant prefix and index.

      • Easy to implement.

    • Cons: May not seem logical to throw an exception for this.

  • Alternative: Show prompt message as a command result instead of exception message.

    • Pros: Logically seems to make more sense.

    • Cons: User has to retype the entire command, potentially a waste of time.

Vehicle Search feature

Implementation

The vehicle search mechanism features a set of different types of searches that a user could utilise.The types of searches are as listed:

  • Unfiltered - Displays all vehicles in Model.
    e.g. list-v

  • District - Displays all vehicles with District district in list of specified districts.
    e.g. find-v dist/1 2 3

  • Vehicle Number - Displays all vehicles with VehicleNumber vehicleNumberKeyword in Vehicle vehicle. Need not be exact matches.
    e.g. find-v vnum/2

  • Vehicle Type - Displays all vehicles with exact matches in VehicleType vehicleType in Vehicle vehicle.
    e.g. find-v vtype/patrol car

Further documentation on the commands available in this set can be found in the User Guide.

Design Considerations

Aspect: How vehicle search with keyword is inputted
  • Current choice: Parse user input after flag (eg. dist/ or vnum/)

    • Pros:

      • Easy to implement.

      • Reduce number of steps of input, more efficient.

    • Cons:

      • Have to parse keyword from command and flag, user has to follow style of flag for successful search.

      • User might have to remember too many flags.

  • Alternative: Prompt user for search input

    • Pros:

      • Separates command from keyword for ease of reading and parsing.

      • User need not remember flags and will not confuse flags, just key in information as prompted.

    • Cons:

      • Difficult to implement multi-command execution.

      • Requires multiple steps of input, slower and less efficient.

Aspect: How listing all vehicles is called
  • Current choice: Utilise separate command list-v

    • Pros:

      • Intuitive to user, as it contains clear action word.

      • Consistent with other list commands.

    • Cons:

      • Some users might find it more intuitive to simply call vehicles.

  • Alternative: Utilise separate command vehicles

    • Pros: Intuitive for some.

    • Cons: Appears separate from other list commands even though they are of the same nature and implemented similarly.

Contributions to the User Guide

Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users.

Create New Incident: new

When new incidents are reported, vehicles are to be dispatched to the incident site. As of now, when there is no vehicle available in the district of incident, a new report cannot be generated.

This command works in two ways:

1. auto/Y
Format: new dist/DISTRICT auto/Y

  • An available vehicle in the given district will be automatically dispatched to the incident site.

    • If no vehicle is available, the vehicle pane will be blank, and a relevant message is displayed.

  • After the new incident is successfully created, the vehicle pane will show all vehicles in the given district.

    • The draft incident only has three fields filled: operator, district and vehicle dispatched.

Valid district numbers are from 1 to 28!
  • Example usage:

newCommandAutoYBeforeSS
  • Expected outcome: In this case, there is no vehicle available in district 1.

newCommandAutoYAfterSS

2. auto/N
Format: new dist/DISTRICT auto/N v/INDEX

  • A list of available vehicles in the given district will be shown.

    • INDEX is the index of the chosen vehicle, based on the list of available vehicles in the district.

    • If v/INDEX is not included, a message will appear to prompt user to also include the index of the chosen vehicle.

    • If no vehicle is available, the vehicle pane will be blank, and a relevant message is displayed.

  • After the new incident is successfully created, the vehicle pane will show all vehicles in the given district.

For manual dispatchment of vehicle, the index of the chosen vehicle must be from the list of vehicles available in the given district, which is only displayed when new dist/DISTRICT auto/N is used.
  • Example usage:

newCommandAutoNPromptSS

Once user adds v/1, a new incident will be drafted.

If multiple flags of the same prefix is provided by user, the command will take the last valid parameter of each prefix.
For example new dist/1 dist/2 dist/3 auto/Y auto/N is equivalent to new dist/3 auto/N.
Rationale: user need not waste time backspacing if an input was keyed in wrongly.

Finding a Vehicle: find-v

Finds a vehicle by its district number, vehicle number or vehicle type.

The command works in three ways:

1. Find by district Format: find-v dist/DISTRICT [MORE DISTRICTS]

  • User can input multiple districts to search for vehicles in.

Example usage:

findVDsBeforeSS
findVDsAfterSS

2. Find by vehicle number Format: find-v vnum/NUMBER

  • The number need not be an exact match of any vehicle number; any vehicle with input number in its vehicle number will be returned.

Example usage:

findVVnumBeforeSS
findVVnumAfterSS

3. Find by vehicle type Format: find-v vtype/VEHICLE TYPE

  • The vehicle type keyword must match the actual vehicle type exactly.

Example usage:

findVVtypeBeforeSS
findVVtypeAfterSS