Csc 8711, Databases and the Web - Project 4

Due: Sunday, March 31st
Individual Assignment.

jsoniq, OpenAPI , MongoDB, Python

I. JSONIQ PROBLEM

Consider the JSON document related to movies available at movie.json. Write JSONIQ expressions to answer the following queries (name the query files ma.jq, mb.jq, etc):
  1. Get the title and years of movies in the Crime genre.
  2. Get the names of persons who have acted in a movie and have directed it as well.
  3. Get the title and years of movies in which James Caan has acted.
  4. Get the names of performers and the number of movies in which they have acted.
  5. Get the names of performers who have acted in at least 10 movies and directed at least 2 movies.
  6. Get the names of the youngest performers.
  7. Get the names of the performers who have directed some actor who is older than they are.

II. MONGODB QUERIES IN PYTHON PROBLEM

Consider the mongodb collections related to movies available at movie.js. Write pymongo programs to answer the above queries; name the programs ma.py, mb.py, etc. The programs should print the answers to the queries when run.

III. OPENAPI , MONGODB, PYTHON PROJECT

In this project, you will specify (using OpenAPI) AND build REST Web services (using Python Flask). MongoDB will be used as the back-end. The Web services will be used by an application that implements an appointment tracker for a clinic. You do not have to build the client GUI in this project; only the Web services. The following three collections will be used in MongoDB:
  1. physicians: will store information about all physicians in the clinic. The format of one individual physician is:
    {
      physicianID: 100,
      lname: "Broderick",
      fname: "John",
      speciality: "Internal Medicine"
    }
    
    You should populate this collection with several physicians with different specialities. You can use consecutive physicianIDs starting with 100.
  2. patients: will store information about all patients in the clinic. The format of one individual patient is:
    {
      patientID: 1000,
      lname: "Jones",
      fname: "Jacob",
      email: "jjones@gmail.com",
      phone: { 
        mobile: "777-8888", 
        home: "111-1234", 
        office: "111-2121"
      },
      address: {
        address: "123 Main Street",
        city: "Atlanta",
        state: "GA",
        zip: "30303"
      }
    }
    
    Initially you can populate the collection with two patients. patientIDs should be consecutive numbers starting with 1000.
  3. appointments: will store information about appointments. The format of an appointment is:
    {
      appointmentID: "1",
      physicianID: 100,
      patientID: 1000,
      date: "12-10-2018",
      time: "10:00",
      type: "new patient"
    }
    
    appointmentID is generated by the system starting with 1. date should be a string with format MM-DD-YYYY and time should be military time such as HH:MM, e.g. 14:30 would be 2.30 pm and 09:30 would be 9.30 am. type would be one of two strings: "new patient", "regular patient". All appointments will begin at half hour intervals between 09:00 and 17:00. Also, your system should not allow more than 2 appointments at the same time with the same physician.

Routes to implement for the Web Services:

GET /physicians
should return all physicians

GET /physicians/Internal%20Medicine
GET /physicians/Cardiology
should return all physicians with given speciality.

-----------------------------------------
GET /patients
should return all patients

POST
/patients
should add a new patient
input json: fname, lname, address, phone
generate patientID automatically by finding max patientID and adding 1.

PUT
/patients
allows update of address, phone numbers

-----------------------------------------
GET /appointments/physicianID
should return all appointments given a physicianID

GET /appointments/physicianID/MM-DD-YYYY
should return all appointments given a physicianID and a date

POST
/appointments
input JSON: physicianID, patientID, date, time, patient type

DELETE
/appointments/appointmentID
delete the appointment with given appointmentID

Deliverables:

  1. Swagger/OpenAPI specifications for Web servcies.
  2. Python/Flask implementation of the services
ws1-mongo.py