Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Added Tooth and Teeth skeleton codes

* Added Teeth as an attribute to Person

* Added Tooth isPresent attribute, with getter method

* Added hasStatus getter method

* Modified and added constructors to initialise all attributes

* Added new Status class to represent Tooth status

* Added crucial attributes to Status class

* Added relevant getter methods to uphold OOP information hiding

* Implemented Status variable, and its getter and setter methods

* Assigned default values to Tooth attributes

* Added skeleton code for Tooth getter method

* Added relevant static teeth counts

* Minor fixes for readability

* Minor fixes

* Minor changes to code style

* Added ImportCommand to AddressBookParser.java

* Added ImportCommand.java

* Added ImportCommandParser.java

* Added parseFile() to ParserUtil.java

* Added ImportCommand to parseCommand() of AddressBookParser.java

* Updated regex for parseFile() in ParserUtil.java

* Updated comments for ImportCommandParser.java

* Updated parseFile() for file validation in ParserUtil.java

* Updated ImportCommandParser.java

* Added data folder filepath to concat with input file in ParserUtil.java

* Added readFile() to ImportCommand.java

* Added ExportCommand.java

* Removed unused import statements from ImportCommand.java

* Added ExportCommand to parseCommand() of AddressBookParser.java

* Updated code for ExportCommand.java

* Added ExportCommandParser.java

* Added parseFile() to ParserUtil.java

* Changed command word to 'export' in ExportCommand.java

* Updated ParserUtil.java to work with ExportCommand

* Updated ExportCommandParser.java to receive exception message from ParserUtil.java

* Updated ExportCommand.java

* Updated ParserUtil.java to work with ExportCommand.java

* Updated ImportCommandParser.java to receive exception message from ParserUtil.java

* Updated readFile() to be private in ImportCommand.java

* Updated ImportCommandParser.java to handle import validation

* Added comments to ImportCommand.java

* Updated writeFile() to be private in ExportCommand.java

* Updated writeFile() to be private in ExportCommand.java

* Created empty attribute classes for Date,Time,Description, Procedure, and Record

* Impletemented code for the attribute classes Description & Procedure

* Minor code comment fix

* Implemented code for attribute classes Date & Time

* Implemented code for Record class

* Updated code to match codeStyle

* Added import and export commands to UserGuide.adoc

* Removed unused imports in ExportCommand.java

* Renamed variable to match camelCase in ParserUtil.java

* Renamed variable to match camelCase in ParserUtil.java

* Fixed codestyle in ImportCommand.java

* Fixed codestyle in ImportCommand.java

* Fixed codestyle in ImportCommandParser.java

* Fixed codestyle in ExportCommandParser.java

* Fixed ImportCommand.java codestyle

* Fixed ExportCommand.java codestyle

* Add CopyCommand class

* Add CopyCommand class

* Add CopyTag class

* Add CopyTag class for copy information

* Modified Person class for temporary duplicates

* Modified EditCommand for removal of copy information

* Main logic for CopyCommand

* Command info for CopyCommand

* Add CopyCommandParser class

* Copy command can be called

* Cleared a bug by typo

* = Add methods to help check copies

* = Add Copy tag for copies

* = Add checkNoCopy method into Model interface

* = Add logger info for copy status

* = Change isSamePerson logic for loading saved data

* = Change error in INFO display

* = Style check change

* = Style check change

* = Style check change

* Added LoginWindow class and LoginWindow.fxml

* Removed unnecessary segments from skeleton of LoginWindow class

* Removed GUI portions for skeleton base of LoginWindow.fxml

* Added textbox to plain LoginWindow.fxml and created handleStringEntered function in LoginWindow class

* Added hide function to LoginWindow class

* Changed hide function to close function

* Fixed coding style

* Fixed Import Style, removed unused Imports in LoginWindow.fxml

* Created blank personal detail attribute classes (Age, DrugAllergy, Nric, Sex)

* Implemented personal detail attribute classes (Age, DrugAllergy, Nric, Sex)

* Minor checkstyle change

* Renamed photos

* Updated UserGuide.adoc

* Updated image file

* Testing UserGuide.adoc

* Test

* Test

* Minor update

* Test

* Rename Date & Time to DateCustom & TimeCustom so it doesn't interfere with the existing inbuilt Java classes

* Updated date & time occurances to DateCustom & TimeCustom

* Minor checkStyle changes

* Created empty command & parser classes for Sort and Stats

* updated badges on README

* Updated devGuide with all discussed userStories
  • Loading branch information
kthSim authored Mar 14, 2019
1 parent 901ed8f commit e6948e7
Show file tree
Hide file tree
Showing 42 changed files with 1,321 additions and 42 deletions.
6 changes: 2 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
= OurTeeth (Morphed from Address Book Level 4)
ifdef::env-github,env-browser[:relfileprefix: docs/]

https://travis-ci.org/se-edu/addressbook-level4[image:https://travis-ci.org/se-edu/addressbook-level4.svg?branch=master[Build Status]]
https://ci.appveyor.com/project/damithc/addressbook-level4[image:https://ci.appveyor.com/api/projects/status/3boko2x2vr5cc3w2?svg=true[Build status]]
https://coveralls.io/github/se-edu/addressbook-level4?branch=master[image:https://coveralls.io/repos/github/se-edu/addressbook-level4/badge.svg?branch=master[Coverage Status]]

https://travis-ci.org/CS2103-AY1819S2-W17-2/main[image:https://travis-ci.org/CS2103-AY1819S2-W17-2/main.svg?branch=master["Build Status", link="https://travis-ci.org/CS2103-AY1819S2-W17-2/main"]]
https://app.netlify.com/sites/cs2103-w17-2/deploys[image:https://api.netlify.com/api/v1/badges/0ed4dd99-3443-483f-94e5-64bb727aa43c/deploy-status[Netlify Status]]

ifdef::env-github[]
image::docs/images/Ui.png[width="600"]
Expand Down
4 changes: 2 additions & 2 deletions docs/AboutUs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Responsibilities: Records IO
'''

=== Jonathan Choo
image::cchj1995.jpg[width="150", align="left"]
image::cchj1995.png[width="150", align="left"]
{empty}[http://github.com/cchj1995[github]] [<<johndoe#, portfolio>>]

Role: Developer +
Expand All @@ -56,7 +56,7 @@ Responsibilities: Login
'''

=== Wang Debang
image::wsemis.JPG[width="150", aligh="left"]
image::wsemis.png[width="150", aligh="left"]
{empty}[https://github.com/wSemis[github]] [<<johndoe#, portfolio>>]

Role: Developer +
Expand Down
34 changes: 25 additions & 9 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= AddressBook Level 4 - Developer Guide
= OurTeeth - Developer Guide
:site-section: DeveloperGuide
:toc:
:toc-title:
Expand All @@ -15,7 +15,7 @@ ifdef::env-github[]
endif::[]
:repoURL: https://github.com/se-edu/addressbook-level4/tree/master

By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT`
By: `Team W17-2`      Since: `14 Mar 2019`      Licence: `MIT`

== Setting up

Expand Down Expand Up @@ -827,27 +827,43 @@ Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (un
[width="59%",cols="22%,<23%,<25%,<30%",options="header",]
|=======================================================================
|Priority |As a ... |I want to ... |So that I can...
|`* * *` |new user |see usage instructions |refer to instructions when I forget how to use the App

|`* * *` |user |add a new person |
|`* * *` |user |add a new patient's particulars | know about their situation

|`* * *` |user |delete a person |remove entries that I no longer need
|`* * *` |user |edit my patient's particulars when the situation changes |

|`* * *` |user |find a person by name |locate details of persons without having to go through the entire list
|`* * *` |user |my patients' medical records and teeth data tied to them |know how their situation evolved

|`* * *` |user |add a new task |
|`* * *` |user |store, edit, and view my dental patients' teeth condition | understand and serve my dental patients'
teeth condition better

|`* * *` |user |add a new task | keep track of what I need to do

|`* * *` |user |delete a task |remove tasks that I have already completed or no longer need to do

|`* * *` |user |edit a task |change details of certains tasks that I have already added

|`* *` |user |hide <<private-contact-detail,private contact details>> by default |minimize chance of someone else seeing them by accident
|`* * *` |user | encrypt the imported/exported data | ensure patient information remains confidential

|`* * *` |user | append imported/exported data | work more flexibly with patient information

|`* * *` |user | my imported/exported data supported by multiple file types | work more flexibly with patient information

|`* * *` |user | see a statistics report on each patient's dental history | have an easier time understanding their potential problems

|`* * *` |user | warning to come up when I'm exiting the program if there exists duplicate entries | be reminded to
edit them before exiting.

|`* *` |user | see an overall statistics report on my patients | analyze potential trends

|`* *` |user |copy a person |reduce the time needed to create a new person who has similar records to an existing person in the list

|`* *` |user |export entries into an external file |view certain entries even when I am not using the application

|`* *` |user |import entries from an external file |reduce the time needed to create a person whose information can be already be obtained from an external source
|`* *` |user |import entries from an external file |reduce the time needed to create a person whose information can
be already be obtained from an external source

|`* *` |user |see relevant dentistry tags on my patients' entries | have an overview of my patients' condition

|`*` |user with confidential patient information|log into the application with a password |prevent unauthorized access to the application when I am not around

Expand Down
44 changes: 19 additions & 25 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,13 @@ Universal Numbering System.

==== The Universal Numbering System

image::images/image1.png[image,width=200,height=294]
ifdef::env-github[]
image::image1.png[width="200"]
endif::[]

ifndef::env-github[]
image::image1.png[width="200"]
endif::[]

The uppercase letters A through T are used for primary teeth and the
numbers 1 - 32 are used for permanent teeth. The tooth designated "1" is
Expand Down Expand Up @@ -340,38 +346,26 @@ newly created teeth layout.
indicate personalised note describing more detail on the patient’s teeth
health.

=== Export
Exports the entire records into the specified file path with the
specified file name.

Format: `export FILE_PATH FILE_NAME`

Example:
=== Importing records: `import`


* `export /mnt/ext_drive/ clinicRecords.txt` +
Creates a file named clinicRecords.txt in the /mnt/ext_drive/ folder


=== Import
Imports data into the program from the specified file path and
overwrites current data.

Format: `import FILE_PATH [append]`

Note: The optional “append” adds the file data onto the current records
rather than overwriting.
Reads all entries from a specified text file and overwrites the address book. +
Format: `import FILENAME`

Examples:

* `import records1.json` +
Reads all entries from a records1.json and overwrites the address book. +

* `import /mnt/sample/newData` +
Replaces the current records with the ones in the newData file
=== Exporting records: `export`

Writes all entries from the address book to a specified text file. +
If no file exists, a new one will be created.
Format: `export FILENAME`

* `import /mnt/sample/extraData append` +
Appends the records within extraData onto the current program’s records.
Examples:

* `Export records2.json` +
Writes all entries from the address book to records2.json. +

=== List
Shows a list of all personnel or medical stored in the application
Expand Down
File renamed without changes
File renamed without changes
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ public void start(Stage primaryStage) {
@Override
public void stop() {
logger.info("============================ [ Stopping Address Book ] =============================");
if (model.checkNoCopy()) {
logger.info("No copies left");
} else {
logger.info("Unedited copies exist");
}
try {
storage.saveUserPrefs(model.getUserPrefs());
} catch (IOException e) {
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/seedu/address/logic/commands/CopyCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import java.util.List;

import seedu.address.commons.core.Messages;
import seedu.address.commons.core.index.Index;
import seedu.address.logic.CommandHistory;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.person.Person;

/**
* Adds a person to the address book.
*/
public class CopyCommand extends Command {

public static final String COMMAND_WORD = "copy";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Have a temporary duplicate person in the addressbook. "
+ "Parameters: Index (Must be an integer)"
+ "Example: " + COMMAND_WORD + " 1 ";

public static final String MESSAGE_SUCCESS = "Person copied: %1$s";

private final Index index;

/**
* Creates an AddCommand to add the specified {@code Person}
*/
public CopyCommand(Index index) {
requireNonNull(index);
this.index = index;
}

@Override
public CommandResult execute(Model model, CommandHistory history) throws CommandException {
requireNonNull(model);
List<Person> lastShownList = model.getFilteredPersonList();

if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}

Person personToCopy = lastShownList.get(index.getZeroBased());
Person copyPerson = personToCopy.copy();

model.addPerson(copyPerson);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.commitAddressBook();
return new CommandResult(String.format(MESSAGE_SUCCESS, copyPerson));
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof CopyCommand // instanceof handles nulls
&& index.equals(((CopyCommand) other).index));
}
}
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
}

model.setPerson(personToEdit, editedPerson);

if (personToEdit.isCopy()) {
personToEdit.editCopy();
}

model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.commitAddressBook();
return new CommandResult(String.format(MESSAGE_EDIT_PERSON_SUCCESS, editedPerson));
Expand Down
63 changes: 63 additions & 0 deletions src/main/java/seedu/address/logic/commands/ExportCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;

import seedu.address.MainApp;
import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.CommandHistory;
import seedu.address.model.Model;
import seedu.address.storage.AddressBookStorage;
import seedu.address.storage.JsonAddressBookStorage;
import seedu.address.storage.StorageManager;

/**
* Exports records to a text file.
*/
public class ExportCommand extends Command {

public static final String COMMAND_WORD = "export";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Exports to text file in the \"data\" folder \n"
+ "Parameters: FILENAME\n"
+ "Example: " + COMMAND_WORD + " records1.json";

public static final String MESSAGE_SUCCESS = "Exported the records!";
private static final String MESSAGE_FAILURE = "Problem while writing to the file.";

private final File file;

public ExportCommand(File file) {
this.file = file;
}

@Override
public CommandResult execute(Model model, CommandHistory history) {
requireNonNull(model);
writeFile(model);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
return new CommandResult(MESSAGE_SUCCESS);
}

/**
* writeFile() writes or overwrites a file with the contents of the current address book.
*/
private void writeFile(Model model) {
AddressBookStorage addressBookStorage = new JsonAddressBookStorage(file.toPath());

StorageManager storage = new StorageManager(addressBookStorage, null);

final Logger logger = LogsCenter.getLogger(MainApp.class);

try {
storage.saveAddressBook(model.getAddressBook(), file.toPath());
} catch (IOException e) {
logger.warning(MESSAGE_FAILURE);
}
}
}
82 changes: 82 additions & 0 deletions src/main/java/seedu/address/logic/commands/ImportCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;

import java.io.File;
import java.io.IOException;
import java.util.Optional;
import java.util.logging.Logger;

import seedu.address.MainApp;
import seedu.address.commons.core.LogsCenter;
import seedu.address.commons.exceptions.DataConversionException;
import seedu.address.logic.CommandHistory;
import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.util.SampleDataUtil;
import seedu.address.storage.AddressBookStorage;
import seedu.address.storage.JsonAddressBookStorage;
import seedu.address.storage.StorageManager;

/**
* Imports records from a text file.
*/
public class ImportCommand extends Command {

public static final String COMMAND_WORD = "import";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Imports a text file in the \"data\" folder \n"
+ "Parameters: FILENAME\n"
+ "Example: " + COMMAND_WORD + " records1.json";

public static final String MESSAGE_SUCCESS = "Imported the records!";

private final File file;

public ImportCommand(File file) {
this.file = file;
}

@Override
public CommandResult execute(Model model, CommandHistory history) {
requireNonNull(model);
readFile(model);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
return new CommandResult(MESSAGE_SUCCESS);
}

/**
* readFile() overwrites the current address book with the contents of the file.
*/
private void readFile(Model model) {
AddressBookStorage addressBookStorage = new JsonAddressBookStorage(file.toPath());

StorageManager storage = new StorageManager(addressBookStorage, null);

final Logger logger = LogsCenter.getLogger(MainApp.class);

Optional<ReadOnlyAddressBook> addressBookOptional;
ReadOnlyAddressBook initialData;

try {
addressBookOptional = storage.readAddressBook();
if (!addressBookOptional.isPresent()) {
logger.info("Data file not found. Will be starting with a sample AddressBook");
}
initialData = addressBookOptional.orElseGet(SampleDataUtil::getSampleAddressBook);
} catch (DataConversionException e) {
logger.warning("Data file not in the correct format. "
+ "Will be starting with an empty AddressBook");
initialData = new AddressBook();
} catch (IOException e) {
logger.warning("Problem while reading from the file. "
+ "Will be starting with an empty AddressBook");
initialData = new AddressBook();
}

model.setAddressBook(initialData);
}
}
Loading

0 comments on commit e6948e7

Please sign in to comment.