Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
INFO1112 A1 - Just a friendly reminder
In this assignment, you'll be creating a basic application called "Jafr" (short for "Just a
friendly reminder"). This application helps multiple users manage their tasks and meetings
on a Unix-like OS (a popular choice of OS in industry where developers might share a
computer system or host web applications).
Jafr is Unix-friendly. This means that
1. Users interact with Jafr by typing commands in a command-line interface.
2. Jafr assumes that all the tasks and meetings are stored in text files that are otherwise
managed by users of the shared system. Users simply edit these files themselves when
they want to make changes outside of Jafr.
You will implement Jafr in Python and write a simple start up script in Bash. You will then
write I/O end to end tests for Jafr.
These specifications first describe each behaviour of Jafr. The final sections describe error
handling, how to write tests for Jafr and provide some hints.
Overview
Jafr is designed to run whenever a user opens their terminal at the beginning of their day.
Users can choose to view reminders that are relevant to the current day, or make changes.
Changes can include sharing reminders with other users.
There are two kinds of reminders: tasks and meetings.
Note
Students and tutors often have great suggestions to specifications. While no major
changes will be made after release, this assignment specification may be clarified up to
Week 4, 27/08/2023. Revised versions will be clearly marked and accompanying
announcements made to Edstem.
Setup
Jafr primarily relies on two text files for each user: tasks.md and meetings.md . These text
files are placed inside a master directory of the user's choosing.
The user chooses their master directory inside a JSON file called user-settings.json
located at ~/.jafr/user-settings.json . You may consider ~/.jafr/ a 'hidden' directory,
for Jafr's internal use only.
user-settings.json has a single key value pair storing the absolute path to the master
directory.
Sample user-settings.json :
Hint
Notice that the hidden directory .jafr/ is inside a user's home directory which can be
symbolically referred to by ~ .
You can fetch the path referred to by ~ in Python by using os.path.expanduser('~')
{
"master": "/home/dailystuff"
}
Help! What's a JSON file?
JSON is a universal file format for easy data reading and writing. There are two kinds of
data structures possible to write in JSON: objects and arrays.
Curly braces are used to define an object: a collection of name/value pairs (exactly like
a dictionary in Python). Square brackets are used to define an array: an ordered list of
values (exactly like a list in Python).
You may use Python's json library in your implementation to read JSON files. See
json.load()
Note
tasks.md and meetings.md for each user are given inside your scaffold. Assume the
user creates these themselves using their preferred text editor.
The ~/.jafr/ directory for each user is also given inside your scaffold. You do not
have to handle the case where ~/.jafr/user-settings.json is missing for any user.
Assume Jafr has some installation script that handles this, outside of the scope of your
assignment.
Text files containing reminders
The two text files inside the master directory for each user are as follows.
tasks.md
This text file contains dot pointed tasks with the following format. Dates follow DD/MM/YY, or
more precisely the C standard format %d/%m/%y (see the datetime docs). You will only ever
have to handle dates in the years 1969 - 2068 (inclusive).
For example
meetings.md
This text file contains dot pointed meetings with the following format. Times follow HH:mm,
or more precisely the C standard format %H:%M (see the datetime docs).
For example
- Due:
- Complete INFO1112 A1 Due: 01/10/23 not complete
- Acquire Twitter Due: 30/10/23 complete
- Study linux namespaces Due: 30/09/23 not complete
Hint
Notice that a task must end with complete or not complete !
Moreover, the format implies that a task description should never contain the string
Due: . You do not have to handle the case where a user does this.
- Scheduled:
- Michael Mai's welcome party Scheduled: 18:00 25/08/23
- A1 marking meeting Scheduled: 09:00 01/09/23
Hint
You do not have to handle the case where a user places Scheduled: inside the
meeting description.
Further, as suggested by the links above, it will be easiest to use datetime to handle
all dates/times!
Usage
Jafr runs when jafr.py is executed by the Python interpreter. There is one command line
argument which will contain a path (absolute or relative) to a given passwd file. More on this
below.
For example
Jafr first displays relevant reminders (tasks followed by meetings), before showing a menu.
The menu contains the following.
A user chooses one option only.
This invokes the relevant behaviour, described below. If the user enters 6 , Jafr exits. After
completing a behaviour, Jafr returns to the menu.
For example
python3 jafr.py passwd
What would you like to do?
1. Complete tasks
2. Add a new meeting.
3. Share a task.
4. Share a meeting.
5. Change Jafr's master directory.
6. Exit
Just a friendly reminder! You have these tasks to finish today.
- Read INFO1112 A1 specs
- Fix bug 1 inside Jafr
- Study ELEC1601
These tasks need to be finished in the next three days!
- Shower by 03/08/23
- Organise paul's brithday by 03/08/23
You have the following meetings today!
- Michael Mai's welcome party at 18:00
- Resume writing workshop at 09:00
- Jafr dev meeting at 13:30
You have the following meetings scheduled over the next week!
- Barbenheimer marathon on 06/08/23 at 17:00
- Academic advice on 02/08/23 at 14:30
Displaying tasks
Jafr will write two views of tasks to standard output. The first is a view of all tasks that are
due today that have not been completed. The second is a view of all tasks that are due in
the upcoming three days that have not been completed.
Today's view has the following format.
For example
The upcoming three days' view has the following format.
For example
- ELEC1601 group meeting on 03/08/23 at 11:00
What would you like to do?
1. Complete tasks
2. Add a new meeting.
3. Share a task.
4. Share a meeting.
5. Change Jafr's master directory.
6. Exit
Just a friendly reminder! You have these tasks to finish today.
-
-
[...]
Just a friendly reminder! You have these tasks to finish today.
- Read INFO1112 A1 specs
- Fix bug 1 inside Jafr
- Study ELEC1601
These tasks need to be finished in the next three days!
- by
- by
[...]
These tasks need to be finished in the next three days!
- Shower by 03/08/23
- Organise paul's birthday by 04/08/23
Displaying meetings
Jafr will write two views of meetings to standard output. The first is a view of all events that
are scheduled today. The second is a view of all events that are scheduled in the upcoming
7 days.
Today's view has the following format.
For example
The upcoming 7 days' view has the following format.
For example
Note
Listed tasks are simply displayed in the order that they appear in tasks.md
Hint
The "upcoming" three days' view does not include the current day. Instead, "upcoming"
implies the three days following the current day.
You have the following meetings today!
- at
- at
[...]
You have the following meetings today!
- Michael Mai's welcome party at 18:00
- Resume writing workshop at 09:00
- Jafr dev meeting at 13:30
You have the following meetings scheduled over the next week!
- on at
- on at
[...]
You have the following meetings scheduled over the next week!
- Barbenheimer marathon on 06/08/23 at 17:00
- Academic advice on 02/08/23 at 14:30
- ELEC1601 group meeting on 03/08/23 at 11:00
Changing the user's master directory
Jafr allows the user to change their chosen master directory that contains tasks.md and
meetings.md .
The user enters an absolute path.
Jafr should replace the master object in ~/.jafr/user-settings.json appropriately.
Jafr then writes a confirmation message to standard output.
For example
Completing tasks
Jafr allows the user to mark tasks as completed. The user is first prompted for which task
they would like to complete. All not complete tasks are shown and numbered, in the order
they appear in tasks.md .
Note
Listed meetings are simply displayed in the order that they appear in meetings.md
Which directory would you like Jafr to use?
Hint
See json.dump().
Master directory changed to .
Which directory would you like Jafr to use?
/home/paul/atreides_work
Master directory changed to /home/paul/atreides_work.
Hint
Jafr does not move tasks.md or meetings.md when changing the master directory.
You can assume the user handles this themselves. This also allows the user to have
multiple directories containing reminders and have Jafr focus on one at a time.
The user then selects task(s) by their number, separated by whitespace.
Jafr should modify tasks.md appropriately and write a message to standard output. Tasks
inside tasks.md are modified in place (in the same line).
For example
If all tasks are already complete then Jafr just writes the following to standard output.
Adding new meetings
Jafr allows users to add meetings. The user is first prompted for a meeting description, then
a date, then a time.
Jafr should then modify meetings.md appropriately. A meeting is appended to the bottom of
meetings.md as follows.
Which task(s) would you like to mark as completed?
1. by
2. by
[...]
[ ... ]
Marked as complete.
Which task(s) would you like to mark as completed?
1. Shower by 26/07/23
2. Invite friend by 27/07/23
3. Read INFO1112 A1 specs by 28/07/23