Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1. Describe how you intend to develop the API module and provide the ability to run it in Web service mode (Zifan Wei )

Image RemovedImage Added

2. Discuss your current thinking about how parameters can be passed to your module and how results are collected. Show an example of a possible interaction. (e.g.- sample HTTP calls with URL and parameters) (Tingzhuang Zhou )

Initially we sign to put eveything query parameter in the request body, in order to make the URL string more readable for users, but soon we realized that GET request doensn’t countain request body, therefore we have two options: to put query in query string, or to use POST request for the usage of request body, but to keep request format in standered, we have finally choose the query string as our selection.

API usage

Return all matching reports

Code Block
GET/report/:country/:city/?{param}start=''&end=

Get single report that match the data

Code Block
GET/report/?{reportId}

...

User (frontend) related Actions

Get all user saved report

POST
Code Block
language
js
GET/report/:userId/:reportId

...

Save report as user’s saved report

Code Block
languagejs
GETPOST/report/:userId/:reportId

Delete report by userId and report id

...

Code Block
languagejs
report = {
  id: 'sample_id',
  url: 'http://outbreaks.globalincidentmap.com/xxx',
  date_of_publication: "2022-02-23 16:07:00",
  country: "United Kingdom",
  city: "London",
  eventType: "Salmonella Outbreak (Suspected or Confirmed)",
  location: {
    latitude: 51.507,
    longitude: -0.128
  }
}

The database design

...

We design a light weight database with 4 fields, the country and city are storing for fast enumerate purpose in query suggestions.

  • possible interactions other than get request

...

  • Heroku: a cloud platform as a service for app deployment

    • We chose to deploy our API using Heroku as it only requires a few steps in order for deployment. This will make it quicker and easier to deploy our API compared to other platforms such as AWS

    • Additionally, since our API is small, it doesn’t need all the functions that AWS provides, making it much simpler for us to deploy it using Heroku

    • However, if time permits, we plan on deploying our API using AWS

Database - MongoDB (TODO)

  • MongoDB: a cross-platform, NoSQL database

    • Initial thoughs on database selection might be MongoDB

    • We chose MongoDB as our database as our app isn’t very big, so we didn't need to use SQL

    • Additionally, MongoDB integrates well with NodeJS, and stores data in JSON format, which matches the format our API will output in

...