INF3003W 2024 Coding Assignment
University of Cape Town
Department of Information Systems
INF3003W – Coding Assignment
October 2024
Instructions to Candidates
1. This assignment will be available between 12:00 PM on the 17th October 2024 till 23H55 PM
on the 18th October via a Amathuba Assignment.
2. This assignment is a take-home assignment which you can do in the labs or at home. However,
you are not allowed to communicate with other students, candidates or tutors during the
assignment.
3. You may not help another student to engage in dishonest conduct and may not allow or assist
another student to copy. You may also not use any AI tool or code assisast except searching
on Google for solutions to errors. Any dishonesty will render you liable to disqualification and
to disciplinary action.
4. For this assignment you need to answer software development questions based on the case
study.
5. You will need to create visual diagrams and also need to create a project in Visual Studio.
6. You are welcome to use any modelling tool of your choice e.g., lucid charts, draw.io,
PowerPoint, MS Word etc.
7. Please submit the final complete solution on Amathuba. You must submit a single .zip file
containing all your project related and assignment (word) files.
8. NB: Use your student number as the project name. If you fail to do so, you risk a fail.
9. The assignment paper consists out of five (5) pages for the case study (including this page)
and two (2) pages for the exam questions. You need to answer all the questions as part of
your solution.
10. The final solution will be marked out of 60. All the required systems features will be marked,
even if the program runs with errors.
11. For Marking Purposes
Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 TOTAL
/10 /10 /10 /0 /5 /5 /9 /11 /60
1
INF3003W 2024 Coding Assignment
Case Study - Nyumbani Comfort Keepers
INSTRUCTIONS:
Please read the case study in connection with the questions. Ensure that your answers are linked
to the case study; they should not merely reflect knowledge from the lecture notes but also
highlight your ability to translate and apply your knowledge to a case. This case study is fictional.
Nyumbani Comfort Keepers
Nyumbani Comfort Keepers (CK) provides award-winning in-home care for seniors and
adults who need assistance at home. Their expert-trained home care aides let loved ones
remain at home for as long as possible, a dream come true for many seniors.
Nyumbani CK's caregivers have one goal: enriching the lives of their clients and their
families by maintaining their safety, well-being, and comfort as they continue to live
independently. In-home care gives seniors freedom despite limited mobility, chronic
conditions, and other age-related considerations.
Nyumbani CK provides modern facilities for the elderly and trained personnel, including
medical professionals, to care for them. The medics handle all old-age complications that
their customers experience, such as joint pains, depression, Alzheimer's disease etc.
Nyumbani CK understands the struggle family members face when a loved one needs
extra assistance in their home and is devoted to helping. Since it can be overwhelming for
family members to be with ageing parents and grandparents due to work and other
responsibilities, most people prefer to have assistance. Nyumbani CK's caregivers relieve
this stress by providing professional home care services with a personal touch.
Nyumbani CK prides its services on the unique approach of Interactive Caregiving, which
helps caregivers build true friendships with clients, satisfying their emotional and social
needs.
Nyumbani CK's Healthcare tracking App
Mrs Maua Waridi is Nyumbani CK's global Chief Information Officer (CIO). She provides
strategic direction and leadership to the Information Systems and Technology (IS&T) at
the organisational level.
When the pandemic hit in 2020, Mrs Waridi saw an urgent need for an app that could
help keep track of their customers and implement social distancing while finding the best
way to care for their clients.
Mrs Waridi and her team came up with an idea for an app that could serve as a "one-stop-
shop" for customers' healthcare information and needs. She appointed an internal team
to come up with the mobile app requirements. Her team came up with the following six
features and information.
2
INF3003W 2024 Coding Assignment
1. A fitness tracker allows customers to record and track their blood pressure readings,
cholesterol levels, exercise regimen, calorie intake, and other related information.
2. A medication tracker in which caregivers and customers can enter medications and
schedules for taking those meds. This will contain a calendar that displays the customer's
medication schedule and an alarm that sounds whenever it's time to take one of the
medications. To ensure regulatory compliance, the responsible pharmacist must load the
medicine on the app. The patient must be alerted at their chosen time for taking their
medicine i.e. Morning, Afternoon and Evening depending on the script. The caregiver
needs to be notified if the patient has missed two consecutive pills for a script. The app
also needs to calculate when the next prescription refill should be processed and alert the
caregiver and the responsible pharmacist in advance.
3. A physician's list is essentially an electronic address book from Nyumbani CK containing
the doctors, nurses, and physician's assistants. The list will include controls that allow
customers to quickly incorporate existing entries from other contact lists on their phones.
4. An emergency list for storing vital phone numbers and addresses. This list will provide
quick access to their caregivers, local in-network hospitals, urgent care clinics, and
children or friends who can be relied upon to provide transportation in an emergency. As
soon as the customer enters and saves an address, an interactive GPS map becomes
available in a new window, with voice and text directions.
5. An emergency information list in which customers store essential information about
themselves, such as medical conditions (e.g., the customer has diabetes, hypertension, and
Alzheimer's disease), allergies, adverse reactions to drugs, and other personal
information that a physician, nurse, caregivers or other concerned parties might find
helpful in an emergency.
6. Resources feature lists all information about services provided by Nyumbani CK for quick
references.
Nyumbani CK's set a budget of R500,000 for the app, and they wanted the project to be ready in
four months from June 1, 2022. Nyumbani CK realised that they needed to quickly identify a
software development house that could build the required system to ensure that their in-home
care for seniors and adults ran smoothly.
NGUNI SOFTWARE COMPANY
The organisation Nguni Software Company was awarded the contract based on an excellent
submission and experience in mobile app development. In addition, the Nguni Software Company
promised to deliver the needed app performance at an acceptable cost and timely.
The Nguni Software Company is a relatively young company made of the University of Cape
Town's alumni. It specialises in developing mobile applications for phones. The company is still
trying to find its corporate identity and permanent footing; it has released several moderately
successful products but is still looking to make a product that will have a significant impact.
Nyumbani CK is their first biggest client.
Nguni Software Company has high hopes for the healthcare app and wants to ensure that all team
members work out some basic, crucial requirements before proceeding. To spend less time
defining the scope in the early stages of a project, the team proposed to prototype the Medicine
tracking app for Nyumbani CK. Following are a list of the deliverables that you need to submit to
Nyumbani CK to demonstrate the viability of the app.
3
INF3003W 2024 Coding Assignment
Nyumbani CK's Medication tracking App
The coding section of the assignment will consist of a C# ASP.NET Web application for Nguni Software’s
medicine tracking app. You are allowed to consult any web resource or previous
workshop/assignment that you have done in order to answer this section. This is an individual
assignment, and you are not allowed to collaborate with your team members or anyone else during
the assignment.
SECTION A: Software Development Theory (Answer in a Word Document). [30 Marks]
1) Provide a short descriptive analysis (step-by-step/bullet points) of the medicine tracking app
based on the brief information provided in the case study and your own analysis. [10]
Solution: A medication tracker in which caregivers and customers can enter medications and
schedules for taking those meds. This will contain a calendar that displays the customer's
medication schedule and an alarm that sounds whenever it's time to take one of the medications.
Analysis (1 mark each)
Step1: Register on App
Step 2: Pharmacist load medicines (name, identification, dosage (frequency, quantity, minimum
level)). (Repeat)
Step 3: Create reminders preference (Preferred times of the day).
Step 4: Timer event: Generate reminder for specific medicine
Step 5: Alert Caregiver of non-compliance
Step 6: Caregiver follow up with patient
Step 7: Generate reminder (alarm) for new prescription (when min level reached).
Step 6. Display Calendar
2) Model the medicines tracking process that you outlined in the previous question as an Activity
diagram following the guidelines taught in this course and in INF2009. Marks will be awarded for
following the modelling guidelines taught in this course and marks will be deducted for poor
readability. [10]
Model process.
Negative marks: Readability [max -1]
Notation [4] In marking I have listed the incorrect notation number.
✓ Narrative to provide context.
✓ Accurate description of process flow.
✓ Numbering of diagram.
✓ Start (only one) & end node;
✓ No black holes; miracles
✓ Guard condition and decision diamonds correctly used; merging diamonds;
✓ Logical sequential flow & activities (interaction between actors)
✓ Swim lanes
✓ Assumptions & narrative
4
INF3003W 2024 Coding Assignment
Q7. Typical Diagram.
3) Class Diagram: Model the structure of the system using a class diagram. Draw a detailed Class
Diagram for the Nyumbani CK's Healthcare tracking App. There is no need to model the abstract
or interface classes. Your diagram needs to include the following: [10]
a) Main classes including inheritance/specialisation/generalisation. (2)
b) Main attributes for each class (no methods are needed). (2)
c) Data types for each attribute. (2)
d) Indicate the relationships between classes (2)
e) Indicate multiplicities for all relationships (2)
You are welcome to use any modelling tool of your choice e.g., lucid charts, draw.io, PowerPoint, MS
Word etc.
Model class diagram.
Marks for the following:
• Main classes including inheritance/specialisation/generalisation.
• Main attributes for each class (no methods are needed).
• Data types for each attribute.
• Indicate the relationships between classes
• Indicate multiplicities for all relationships
Typical student answer:
5
INF3003W 2024 Coding Assignment
6
INF3003W 2024 Coding Assignment
SECTION B: Software Development (Answer in Visual Studio) [30 Marks]
4) Creating the Project [0 Marks]
Create a new C# ASP.NET Core Web App (Razor pages) project in Visual Studio.
1. Use your STUDNUM_Exam2023 as the project name
2. Place the solution and the project in the same directory
3. The target Framework is ASP .NET Core 7.0 Web App (C#).
4. The framework is .NET 7.0 (Long-term support)
5. The authentication Type is “Individual Accounts”.
6. HTTPS is Off.
7. Do not enable Docker OS
8. Do NOT use top-level statements
9. Do NOT enable version control for the project
10. Remember to apply existing migrations and update packages before running your project.
11. You are not required to develop the user roles (pharmacist/patient) for this prototype.
5) Scaffolding Identity [5 Marks]
You need to scaffold the Account Register, Login, LogOut, RegisterConfirmation and Manage/Index
pages for Identity:
1. Add New Scaffolded Item to your project. (2)
2. Create a new migration and update the database. (2)
3. Test the Identity feature by registering a new user. (1)
Note: The app needs to cater for two roles, namely Pharmacist and Customer. All new
registrations by default needs to be Customers. You can manually add/create the pharmacist
role to test the rest of the functionality. For this exam you can disable the default account
verification
6) Create the Classes/Objects [5 Marks]
7
INF3003W 2024 Coding Assignment
Using the code-first approach, write the code to define the following domain classes of the Medicine
tracking process as identified by you in your class diagram. NOTE: For the purposes of this exam, we
will only create the Medicines class and not the other classes.
a) Medicines Class: A class that contains the detail of the Medicines in the Nyumbani CK's
Healthcare tracking App as defined in your class diagram. (4)
b) Create a public enumeration called AlertTime which represents when a notification is sent.
Include the following values: Morning, Afternoon and Evening depending on the script.
(1)
c) Add a migration for the new classes and update your database. (0)
7) Scaffold the CRUD Pages [9 Marks]
Now you need to scaffold the new Razor Pages using Entity Framework (CRUD).
a) Medicines: Scaffold the Medicines CRUD pages in the Pages/Medicines folder (5)
8
INF3003W 2024 Coding Assignment
b) Add the Medicines links to the _Layout.cshtml page. (3)
<li class="nav-item">
<a class="nav-link text-dark" asp-area=""
asp-page="/Medicines/Index">Medicines</a>
</li>
c) Check that the ApplicationDbContext class has been updated with the Medicines class.
(1)
public DbSet<ExamApp.Models.Medicines> Medicines { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Medicines>().ToTable("Medicines");
}
8) Customize the Medicines Page [11 Marks]
Now you need to customise the Medicines page by:
a) Add security so that only a Pharmacist can add and delete products. (2)
Add Products (1)
[Authorize(Roles = "Pharmacist")] (0.5)
public IActionResult AddProduct() (0.5)
Delete Products (1)
[Authorize(Roles = "Pharmacist")] (0.5)
public IActionResult DeleteProduct() (0.5)
b) Add security so that a Patient can only view products and details of products. (2)
View Products (1)
[Authorize(Roles = "Patient,User")] (0.5)
public IActionResult ViewProducts() (0.5)
Product Details (1)
[Authorize(Roles = "Patient,User")] (0.5)
public IActionResult ProductDetail(int productId) (0.5)
9
INF3003W 2024 Coding Assignment
c) Add paging function which shows at most 10 medicine items per page. (2)
{
int pageNumber = page ?? 1; (0.5)
int pageSize = 10; (0.5)
var medicineList = _context.Medicines
// Add sorting or filtering logic here
.OrderBy(m => m.MedicationName) (0.5)
.ToPagedList(pageNumber, pageSize); (0.5)
return View(medicineList);
}
d) Add sorting function by medicine name (2)
switch (sortOrder)
{
case "name_desc": (0.5)
medicineList = medicineList.OrderByDescending(m => m.MedicationName); (0.5)
break;
default:
medicineList = medicineList.OrderBy(m => m.MedicationName); (0.5)
break;
}
var pagedMedicineList = medicineList.ToPagedList(pageNumber, pageSize);
return View(pagedMedicineList); (0.5)
e) Edit the page to display the time that medicines need to be taken (based on the enum). (2)
public IActionResult Edit(int id)
{
var medicine = _context.Medicines.Find(id); (0.5)
if (medicine == null) (0.5)
{
return NotFound();(0.5)
}
return View(medicine); (0.5)
}
Edit the page to remove (not display) the medicines ID. (1)
ModelState.Remove("MedicationId"); (1)
g) Test your application by adding a new Medicine to the Medicines table. (0)
[HttpGet]
public IActionResult AddMedicine()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult AddMedicine(Medicine medicine)
{
if (ModelState.IsValid)
10
INF3003W 2024 Coding Assignment
{
// Add the new medicine to the database
_context.Medicines.Add(medicine);
_context.SaveChanges();
return RedirectToAction("Index"); // Redirect to the medicine list or another appropriate page
}
return View(medicine); // Return to the form if there are validation errors
}
11