Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AY2324S2-CS2103T-F10-1/tp
Browse files Browse the repository at this point in the history
…into branch-update-help-command
  • Loading branch information
iamtr committed Apr 8, 2024
2 parents bff0f34 + 976cbdd commit 9b19699
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 33 deletions.
56 changes: 35 additions & 21 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: User Guide
nav_order : 2
---
# Nursing Address Book (NAB)
Nursing Address Book (NAB) is a desktop application tailored for ward nurses, optimizing patient contact management via a Command Line Interface (CLI) while incorporating a Graphical User Interface (GUI) for ease of use.
Nursing Address Book (NAB) is a desktop application tailored for ward nurses in Singapore, optimizing patient contact management via a Command Line Interface (CLI) while incorporating a Graphical User Interface (GUI) for ease of use.
Designed for efficiency, NAB enables quick access to patient records, streamlined contact management, and simplified logging of care details, proving to be a valuable tool for fast typists and those who prefer the precision of CLI operations.

## Table of Contents
Expand Down Expand Up @@ -78,7 +78,7 @@ Designed for efficiency, NAB enables quick access to patient records, streamline

### Adding a patient: `add`

Adds a new patient's information to the address book.
Allows you to add a new patient's information to the address book.

Format: `add n\NAME ic\IC_NUMBER dob\DATE_OF_BIRTH ad\ADMISSION_DATE w\WARD [r\REMARK] [t\TAG]…​`

Expand Down Expand Up @@ -115,15 +115,14 @@ You now have 1 patient(s) in your address book.

### Listing patients : `list`

Displays a list of patients in NAB.
Allows you to view a list of patients in NAB. With no optional parameters, you will be able to list all patients.

By using list with optional parameters, you will be able to list all patients.

Optionally, you can filter by ward or tags to list only patients in a specific ward or with specific tags.
You may also filter by ward and/or tags to list only patients in a specific ward and/or with specific tags.

Format: `list [w\WARD] [t\TAG]...`

* WARD: Must only list at most 1 ward.
* If multiple tags are provided, only patients with tags that encompass all the provided tags will be listed.

(For the below commands for list, we assume the list contains 2 people, John Doe and Jane Doe)

Expand All @@ -142,10 +141,10 @@ Tags: FallRisk, Diabetes
2. Jane Doe
IC: T1234765P
DOB: 22 Apr 2000
Ward: A2
Ward: B4
Admission Date: 3 Feb 2022
Remarks: Likes to read
Tags: FallRisk, Diabetes
Tags: FallRisk, SevereAllergies
```


Expand All @@ -159,20 +158,20 @@ Ward: B4
1. Jane Doe
IC: T1234765P
DOB: 22 Apr 2000
Ward: A2
Ward: B4
Admission Date: 3 Feb 2022
Remarks: Likes to read
Tags: FallRisk, Diabetes
Tags: FallRisk, SevereAllergies
```

### Editing a patient's details : `edit`

Edits an existing patient's details in the address book.
Allows you to edit an existing patient's details in the address book.

Format: `edit INDEX [n\NAME] [ic\IC_NUMBER] [dob\DATE_OF_BIRTH] [ad\ADMISSION_DATE] [w\WARD] [r\REMARK] [t\TAG]…​`

* Edits the patient details at the specified `INDEX`. The index refers to the index number shown in the displayed list. The index **must be a positive integer** 1, 2, 3, …​
* At least one of the optional fields must be provided.
* You must provide at least one of the optional fields.
* Existing values will be updated to the input values.
* When editing tags, the existing tags of the patient will be removed i.e adding of tags is not cumulative.
* You can remove all the patient’s tags by typing `t\ ` without
Expand Down Expand Up @@ -209,7 +208,7 @@ Tags:

### Locating patients either by name or by IC: `find`

You can find patients whose names or IC contain any of the given keywords.
Allows you to find patients whose names or IC contain any of the given keywords.

Format: `find n\NAME [MORE_NAMES] OR find ic\IC_NUMBER`

Expand All @@ -228,7 +227,7 @@ Examples:

### Deleting a patient : `delete`

Deletes the specified patient from the address book.
Allows you to delete the specified patient from the address book.

Format: `delete INDEX`

Expand All @@ -250,7 +249,7 @@ Tags: SevereAllergies
```
### Viewing help : `help`

Shows a message explaining the available commands and their usage.
Allows you to view a message explaining the available commands and their usage.

Format: `help`

Expand Down Expand Up @@ -293,13 +292,16 @@ For more detailed information on each command, please refer to the User Guide.

### Clearing all entries : `clear`

Clears all entries from the address book.
Allows you to clear all entries from the address book.

:exclamation: **Caution:** This action is irreversible.


Format: `clear`

### Exiting the program : `exit`

Exits the program.
Allows you to exit the program.

Format: `exit`

Expand All @@ -316,10 +318,6 @@ If your changes to the data file makes its format invalid, Nursing Address Book
Furthermore, certain edits can cause the Nursing Address Book to behave in unexpected ways (e.g., if a value entered is outside of the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly.
</div>

### Viewing help : `help`

Shows a message explaining commands available.

--------------------------------------------------------------------------------------------------------------------

## FAQ
Expand All @@ -345,6 +343,22 @@ Action | Format, Examples
**List** | `list`
**Help** | `help`

## Glossary

Term | Further Explanation, Representation and Examples
--------|------------------
**Alphanumeric** | A string that must contain any of alphabetical and numerical characters only. Excludes other special characters, whitespace etc. e.g., `A1`, `T1234567P`.
**CLI** | Command Line Interface
**GUI** | Graphical User Interface
**INDEX** | A positive integer that represents the position of a patient in the displayed list. e.g., `1`, `2`, `3`.
**NAME** | The name of a patient. e.g., `John Doe`.
**IC_NUMBER** | A unique identification number in the format of a capital letter, followed by a 7-digit number, and ending with a capital letter. e.g., `T1234567Z`. Note that while the platform performs some level of IC validation, it is up to the user to ensure that the IC is accurate.
**DATE_OF_BIRTH** | The date of birth of a patient in the format of dd/MM/yyyy. e.g., `21/03/2000`. Note that while the platform performs some level of date validation, it is up to the user to ensure that the date is accurate (not in the future etc).
**ADMISSION_DATE** | The date a patient was admitted to the ward in the format of dd/MM/yyyy. e.g., `21/03/2022`. Note that while the platform performs some level of date validation, it is up to the user to ensure that the date is accurate (not in the future etc).
**WARD** | The ward where a patient is located. e.g., `A1`.
**REMARK** | Optional remarks about a patient. e.g., `Patient is an amputee`.
**TAG** | Optional tags to categorize a patient by health condition or other descriptors. e.g., `FallRisk`, `Diabetes`.

--------------------------------------------------------------------------------------------------------------------

## Troubleshooting
Expand Down
1 change: 0 additions & 1 deletion src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class LogicManager implements Logic {
"Could not save data to file %s due to insufficient permissions to write to the file or the folder.";

private final Logger logger = LogsCenter.getLogger(LogicManager.class);

private final Model model;
private final Storage storage;
private final AddressBookParser addressBookParser;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Messages {
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_DUPLICATE_FIELDS =
"Multiple values specified for the following single-valued field(s): ";

/**
* Returns an error message indicating the duplicate prefixes.
*/
Expand Down Expand Up @@ -50,5 +51,4 @@ public static String format(Person person) {
person.getTags().forEach(builder::append);
return builder.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class ClearCommand extends Command {
public static final String COMMAND_WORD = "clear";
public static final String MESSAGE_SUCCESS = "Address book has been cleared!";


@Override
public CommandResult execute(Model model) {
requireNonNull(model);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class DeleteCommand extends Command {

private final Index targetIndex;

/**
* Creates a DeleteCommand to delete the person at the specified {@code Index}
*/
public DeleteCommand(Index targetIndex) {
this.targetIndex = targetIndex;
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/seedu/address/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public class EditCommand extends Command {
public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
public static final String MESSAGE_DUPLICATE_PERSON = "A patient with this IC already exists in the address book.";

public static final String MESSAGE_DOB_AFTER_ADMISSION =
"Date of birth should not be later than date of admission.";

Expand Down Expand Up @@ -180,10 +179,16 @@ public boolean isAnyFieldEdited() {
return CollectionUtil.isAnyNonNull(name, ic, dob, admissionDate, ward, tags, remark);
}

/**
* Sets {@code name} to this object's {@code name}.
*/
public void setName(Name name) {
this.name = name;
}

/**
* Returns an {@code Optional} containing the {@code name} of this object.
*/
public Optional<Name> getName() {
return Optional.ofNullable(name);
}
Expand Down Expand Up @@ -253,7 +258,6 @@ public boolean equals(Object other) {
&& Objects.equals(admissionDate, otherEditPersonDescriptor.admissionDate)
&& Objects.equals(ward, otherEditPersonDescriptor.ward)
&& Objects.equals(remark, otherEditPersonDescriptor.remark);

}

@Override
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class FindCommand extends Command {

private final Predicate<Person> predicate;

/**
* Creates a FindCommand to find the specified {@code Predicate<Person>}
*/
public FindCommand(Predicate<Person> predicate) {
this.predicate = predicate;
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/seedu/address/logic/commands/ListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ public class ListCommand extends Command {
public static final String MESSAGE_SUCCESS_LIST = "Listed all persons with: %1$s";
private final ListKeywordsPredicate predicate;

/**
* Creates a ListCommand to list relevant patients as filtered by predicate.
*
* @param predicate the predicate to filter the list of patients.
*/
public ListCommand(ListKeywordsPredicate predicate) {
this.predicate = predicate;
}

/**
* Creates a ListCommand to list all persons.
*/
public ListCommand() {
this.predicate = null;
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,4 @@ public static Remark parseRemark(String remark) throws ParseException {
return new Remark(trimmedRemark);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class AdmissionDate {
public static final String MESSAGE_CONSTRAINTS_OCCURRENCE =
"Admission date should not be earlier than date of birth or later than current date";
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");

public final LocalDate date;
public final String value;

Expand Down
1 change: 0 additions & 1 deletion src/main/java/seedu/address/model/person/Dob.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public static boolean isValidDob(String dob) {
return false;
}


@Override
public String toString() {
return value;
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/seedu/address/model/person/Ic.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public class Ic {
"ICs starts with a capital letter, followed by a 7 digit number and ends with a capital letter."
+ "It should not be blank.";

// singapore regex for ic
// Singapore regex for ic
public static final String VALIDATION_REGEX = "^[A-Z]\\d{7}[A-Z]$";

public final String value;

/**
Expand All @@ -25,6 +26,10 @@ public Ic(String value) {
checkArgument(isValidIc(value), MESSAGE_CONSTRAINTS);
this.value = value;
}

/**
* Returns true if a given string is a valid IC.
*/
public static boolean isValidIc(String ic) {
return ic.matches(VALIDATION_REGEX);
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/seedu/address/model/person/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static boolean isValidName(String test) {
return test.matches(VALIDATION_REGEX);
}


@Override
public String toString() {
return fullName;
Expand All @@ -62,5 +61,4 @@ public boolean equals(Object other) {
public int hashCode() {
return fullName.hashCode();
}

}
2 changes: 0 additions & 2 deletions src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class Person {
private final Dob dob;
private final Ic ic;


// Data fields
private final Set<Tag> tags = new HashSet<>();
private final AdmissionDate admissionDate;
Expand Down Expand Up @@ -133,5 +132,4 @@ public String toString() {
.add("remark", remark)
.toString();
}

}

0 comments on commit 9b19699

Please sign in to comment.