ExamBank Scot · AH Computing Science question bank · All AH Computing Science questions

AH Computing Science 2024 Question 8

15 marks · Feasibility studies and user surveys

The developers begin by investigating the hardware and software required for running this system. State the type of feasibility being investigated. The appointments system will allow admin staff to make appointments, edit appointments or cancel appointments. In addition, medical staff will also be able to view patient notes and, if required, they can add details to a patient’s notes. Draw a UML use case diagram for the appointments system. The database will store details of patients, appointments, doctors and notes in the four entities shown below. Patient patientID patientFirst patientLast contactNumber patientType notesID* Appointment patientID* staffID* dateApp timeApp appointmentType Staff staffID staffFirst staffLast staffType Notes notesID comments The data dictionary for the Appointment entity is shown. Entity: Appointment Attribute name Key Type Size Required Validation patientID PK/FK varchar 6 Yes Existing patientID from Patient table staffID PK/FK integer Yes Existing staffID from Staff table dateApp PK varchar 10 Yes timeApp PK varchar 5 Yes appointmentType varchar 30 Yes The developers decide to replace the primary key of the Appointment entity with a surrogate key called appointmentID. Describe two benefits of using a surrogate key for the Appointment entity of the database. The patientType field for patient GS0901 contains the value Child. This patient has now reached the age of 18 and the contents of the patientType field must be updated from Child to Adult. The following query is used to update the relevant record by first checking that the specified record is already in the database. UPDATE Patient SET patientType = "Adult" WHERE patientID = "GS0901" AND _____________ ; Write the SQL clauses needed to complete this query. The updated Appointment table is shown below, together with the other tables of the database. Patient patientID patientFirst patientLast contact patientType notesID* Appointment appointmentID patientID* staffID* dateApp timeApp appointmentType Staff staffID staffFirst staffLast staffType Notes notesID comments The medical centre runs group physiotherapy classes for adult and senior patient types. Appointments for these classes are recorded in the Appointment table with the value of the appointmentType field set to ‘Physiotherapy class’. A query is required to display dates when more than 10 patients, who are not children, are attending a group physiotherapy class from 27 May to 31 May 2024. The design of this query is shown below. Search criteria Field(s)/calculations Date Tables(s) query(-ies) Appointment, Patient Count(*) greater than 10, appointment type is Physiotherapy class age >= 18 dates from 27 May to 31 May 2024 Grouping Date Having Sort order This design is not fit for purpose. Identify problems with the design and describe how those problems could be resolved. Using a suitable Advanced Higher logical operator, write the SQL clause that would be needed to specify the date range in the implemented query. Sample data from the Appointment table is shown below. appointmentID patientID staffID dateApp timeApp appointmentType 3461271 AL0121 1 09/06/2024 09:00 Physiotherapy class 3461272 PC0123 2 09/06/2024 10:30 Doctor appointment 3461273 DS0099 3 12/06/2024 13:30 Vaccination 3461274 BN0021 1 12/06/2024 14:00 Physiotherapy class 3461275 PC0123 2 12/06/2024 09:45 Nurse appointment 3461260 AL0121 1 12/06/2024 10:00 Doctor appointment 3461277 GS0249 2 13/03/2024 14:30 Nurse appointment 3461278 SW0671 3 14/06/2024 11:15 Physiotherapy class 3461279 BN0021 1 14/06/2024 12:00 Vaccination One of the SQL queries used in the appointments system is shown below. SELECT dateApp FROM Appointment WHERE staffID = 2 AND dateApp = ANY ( SELECT dateApp FROM Appointment WHERE staffID = 1 ) Using the sample data provided: state the output returned from the subquery state the output returned from the query. The database system will integrate with a webserver to allow users to access the data through a web interface. A wireframe of the appointments system’s search facility is shown below. Appointments System 74 x 71 Logo Centre Name Search Appointments Surname* text Date of Birth* dd/mm/yyyy Search During the implementation stage of the development process, the form code below is produced. Line 1 < form _____________________ > Line 2 Surname * Line 3 < input type="text" value="text" name="surname" required > Line 4 < br > Line 5 Date of Birth * Line 6 < input type="date" value="dd/mm/yyyy" name="dob" required > Line 7 < br > Line 8 < input type="submit" value="Search" > Line 9 < /form > Complete the code needed at line 1 to send data gathered using this form securely to a page called search.php. A new database-driven appointments system is being introduced in a medical centre.

Marking scheme

Technical See sample solution below. 1 mark for 3 actors with generalisation (DB, Admin Staff, Medical Staff). 1 mark for correct use cases (Make appt, Edit appt, Cancel appt and View Patient Medical Record) and appropriate relationships. 1 mark for extend for Add Notes. Search would be improved, for example, reduces the amount of data entered to retrieve details for a particular appointment. Automatically incremented and added at the time the record is created meaning no chance of duplication. It is simpler to create join conditions on complex queries. Surrogate keys are immutable; without a surrogate, changing an appointment would mean changing part of the primary key. Easier to reference historical data. 1 mark for each of two benefits of a surrogate key relating to scenario. Note: accept ‘reduced search time’ but not ‘faster’. EXISTS (SELECT patientID FROM Patient WHERE patientID = "GS0901"); 1 mark for correct use of EXISTS 1 mark for correct subquery. Use of count in the search criteria is incorrect; count should be in the HAVING section of the design. The design cannot use age as part of the search criteria. NOT child or IN(adult, senior) should be used instead. 1 mark for explaining incorrect use of count with correct solution. 1 mark for explaining incorrect use of age with a possible solution. dateApp BETWEEN "2024/05/27" AND "2024/05/31" 1 mark for correct use of BETWEEN logical operator. Note: do not penalise for date format. dateApp 09/06/2024 12/06/2024 12/06/2024 14/06/2024 1 mark for 4 correct results. Note: do not penalise for lack of column headings. dateApp 09/06/2024 12/06/2024 1 mark for 2 correct results. Note: do not penalise for lack of column headings. <form action="search.php" method="post"> 1 mark for correct action 1 mark for correct method

Previous question: AH Computing Science 2024 Question 7

Next question: AH Computing Science 2024 Question 9