Skip to content

Database Structure

Sebastian edited this page Feb 15, 2021 · 1 revision

Firebase Storage

  • All images are stored at the root of the default bucket
  • Use UUIDv4 as the name of the image (which will also be the ID of the image)
    • This ID will later be sent as the payload of Firebase Cloud Messaging
    • Or can use any other ID as long as it fits the requirement to be an ID

Firebase Storage Example

Firebase Realtime Database

  • The root node has 2 children: assignments and violations
    • assignments stores list of task-allocation related items (which security guard is assigned to which location)
    • violations stores list of violation items

The assignments node is not in the scope of the project, it is there so that it is possible to simulate task allocation to the security guards.

assignments

Field Type Nullable? Description
location String ✔️ The location where the security guard is assigned to.
user String The uid of the security guard which is generated by Firebase Authentication.

violations

Gender is represented using an integer value of 0 or 1. 0 represents female while 1 represents the male.

Field Type Nullable? Description
detectedGender Gender The gender of the person entering the toilet.
locationGender Gender The gender allocated to the toilet.
location String The violation location.
imageId String The violation image id. This refers to the image name in the Firebase Storage.
timestamp Double The time of violation.
isTrue Boolean If this value is false and verifiedBy is not null, then the violation is a false positive.
verifiedBy String ✔️ The uid of the security guard that verifies the violation. When this value is not null and isTrue is true, then a violation is happening and the security guard should deal with the case immediately.

Firebase RTD Example

Clone this wiki locally