Question:
Your task is to look at the supplied database schema and propose, justify and implement improvements to this system to make it more efficient. You will need to identify and write the SQL DDL to add foreign key and uniqueness constraints, identify columns needing indexes and create those indexes, propose, with justification, re-design of tables to remove repeated data or for de-normalization for optimisation (implementation is not required), implement stored procedures for the identified common queries and implement part of the monthly report as python files that export to .csv format.
ICT320 Database Programming Task 2 Page 4 of 13 System Requirements These requirements and sample reports are provided to assist in you in gaining an understanding of the existing system and the hospital’s needs. You do not need to implement these requirements nor all the reports. User Requirements - Every patient admitted has a unique patient id. If the patient is a koala, it will have also have a koala tag. It may have a microchip. Animals including, but not limited to, wallabies, kangaroos, and possums may have ear tags in one or both ears that uniquely identify them (The tags should have the same number but should be able to tell if one is missing).
Turtles may also have a tag. Not all tag number formats will be the same - In addition to formal tags, some animals will have one or more alternate identifiers, being either a Queensland Parks and Wildlife identifier, or transfer from or to another facility such as Currumbin Wildlife Hospital, RSPCA, or Australia Zoo, these must all be maintained and searchable. - In addition to type, animals are sorted into ‘breeds’, of which there are nearly 1000 in the current system.
Each breed must be associated with exactly one‘type’. - All animal wildlife may be admitted more than once, if they are re-admitted their previous patient number should be re-used, along with the date they were re- admitted – all historical admissions should be maintained (and not overwritten). - The database needs to record who brought in the animal, where it was found, including the regional or local council area it was found it – reports are generated for particular councils upon request. There should be a link between the postcode that the animal was found in and the local council it belongs to. - The system should be loss-less, no data should be over written. - Aetiology is the term used to describe the diagnosis categories for the wildlife. Animals can and will present with more than one aetiology.
In addition, animals may be diagnosed with multiple diagnoses within a category – e.g. an animal may have multiple broken bones/anatomical issues. - During treatment, the vets will put notes on the forms, this information should be maintained where possible using searchable text fields - A wildlife patient can be assigned a treatment, this could be multiple medicines, or particular surgery or other actions. For medicine, the system should allow the start and stop date of each medicine/treatment. A treatment will be uniquely identified for patient, accession, and date it was prescribed. - AZWH maintains a contact list – they have other hospitals, other zoos/wildlife parks, government departments, other organizations, wildlife carers, vets, researchers, volunteers and general public that have brought in a patient. For all contacts, AZWH maintains, their first name, last name, title/salutation, email, phone number(s), street address, suburb, state, country, postcode, and what sort of contact they are. ICT320 Database Programming Task 2 Page 5 of 13 User Reports
1. List the patient id, accession id, animal name, and breed for all animals, sorted by animal type, that are currently being treated (where they have not been released, or sent to a carer or other facility).
2. List all animals with a microchip, Qld Parks and Wildlife Id or ear tag within a given time period (ie. A month or year)
3. Monthly report (this is multiple queries):
a. list the total for all in-coming accessions in the previous calendar month grouped by i. Diagnosis/Aetiology ii. Taxon group iii. Local government area iv. Cause of affliction
b. List the total number of accessions for this month in the previous years.
c. List the total number of accessions for each month in the previous 12 months.
4. List all Koalas in 2009 that were treated for Chlamydial Conjunctivitis Specific Instructions You are not to contact the hospital directly as this takes valuable resources away from treating the wildlife. All client communication is to be directed through your lecturer/tutor in the first instance and for more clarification through Course Coordinator Dr Erica Mealy. All SQL Code for your assignment should be submitted under an open- source royalty free license, this allows you to use the database in your portfolio when you are seeking work as well as allowing for further development of the database for AZWH. The license we have selected is CC-BY 4.0. Please include the comment text in Appendix E at the start of your .sql & .py files. Please note that all data is copyright and owned by Australia Zoo Wildlife Hospital and is used with their permission for the purposes of this assignment. Further distribution of this data is not permitted. Submission Format and Requirements For Part A you are to include an analysis of the current system’s design in a word document or PDF.
You should include: - Identification of major implementation flaws in the existing system, and/or areas for improvement, including o Removing repeated data, o De-normalization for optimization o changing some areas to NoSQL (if so include what type of NoSQL database). o Rational for the creation of constraints (Foreign Key and Unique) and indexes - Identification of the current Normal Form of the system. ICT320 Database Programming Task 2 Page 6 of 13 For Part B you are to submit - A single plain text file, named _ict320_azwh.sql. In this file you are to include all the SQL for your database modification. This includes: o The License agreement as seen in Appendix E with your name as author o ALTER TABLE CREATE CONSTRAINT commands for
• the missing Foreign Keys
• UNIQUEness constraints. o CREATE INDEXs for the appropriate indexes for optimizing the database for the queries listed in User Reports. o CREATE PROCEDUREs for
• User report 3.a.i: Monthly report (this is multiple queries): list the total for all in-coming accessions in a given calendar month (and year) grouped by
• Taxon Group .
• User report 3.a.iii: Monthly report (this is multiple queries): list the total for all in-coming accessions a given calendar month (and year) grouped by
• Local government area
• User report 3.c.: List the total number of accessions for each month in the previous 12 months from a supplied calendar month & year.
A single plain text file named _ict320_azwh.py. In this file you are to include the Python for your programming implementation. This includes: o The License agreement as seen in Appendix E. o Code for the Monthly report – Taxon Group section o Code for the Monthly report – Local Gov't Area section o Code for the Monthly report – Monthly Comparisons section Submission The completed assignment is to be submitted to Blackboard by the due date of Friday 5pm Week 12. The assignment will be assessed according to the marking sheet. Late submission will be penalized according to the policy in the course outline. Please note Saturday and Sunday are included in the count of days late.
Answer:
Their current system contains many vulnerability. Their database need to be analyzed in order to identify the flaws. Major flaw areas needs to be improved as well. Their existing database contains 6000-8000 entries that needs to be maintain as well. This enormous number of the entries are creating repeating conflict. The repeated data are also consuming huge amount of unwanted space. It is essential to remove the repeated data in order to gain more free space. The database performance is also lacking as it is unable to produce the desire result. The database performance can be optimized through de-normalization the tables.
The de-normalized strategies can be used on current normalized tables to optimize the performance as well. Their existing system also use a relation data structure. SQL database needs predefined schema to determine the structure of a database and also all data must follow same structure. For their current approaches the document-based store no SQL is appropriate. It is best suited for the system caused it is able to store document made up of tagged elements. CouchDB is an example of the document-based store database. The implementation of the foreign key is also essential as it could uniquely identifies a record/row in another table.
The unique can be utilized to ensure that all values in a column are different. This approach can stop the amount of repeated data which are most likely caused by not-null and primary constrains. Their database are embedded with 1NF normalization. The current normalization strategy is not very effective as data repetition is occurring frequently.