-
Notifications
You must be signed in to change notification settings - Fork 1
Firestore Collection Order
Felix Beil edited this page Apr 28, 2020
·
2 revisions
Name | order |
Context | database root |
Document IDs | auto generated |
The order collection stores the orders that have been made via our Twilio bot. The names of the documents are auto generated by Firestore. Each order also has a sub-collection to store a log.
The data stored in an order document has the following fields.
-
type
(string)
The type defines what kind of order this is. There is a set of predefined types that all clients should be aware of:medicine
,groceries
,other
. All other string values should be interpreted asother
to allow future expansion of this list. -
urgency
(string)
The urgency defines how fast an order should be handled. There is a set of predefined values that all clients should be aware of:asap
,today
,tomorrow
. Any other values are not allowed. If there are other values regardless, they should be interpreted as the least urgent type. -
name
(string)
The complete name of the caller. -
phone_number
(string)
The phone number of the caller. This number has to be internationally valid and thus has to include the country based prefix (e.g. +49 for Germany). -
address
(map)
The address map contains all information about the address of the caller.-
street
(string)
The name of the street of the address. This is an UTF-8 encoded string. -
house_number
(string)
The house number of the address. This is an UTF-8 encoded string. Numbers are not sufficient here, since there are house numbers that contain letters. -
zip
(string)
The postal code of the city in the address. This is an UTF-8 encoded string. Numbers are not sufficient here, since there are zip codes that start with a 0. -
city
(string)
The name of the city in the address. This is an UTF-8 encoded string.
-
-
location
(map)
The location map contains all information about the location that the order is needed at.-
gps
(geopoint)
These are the GPS coordinates that correspond to the callers address. They are used to display the order on the map. -
geohash
(string)
The geohash of the GPS coordinates. These are required to efficiently request orders from the database based on the users current location.
-
-
extras
(map)
The extras map contains additional information about the order. The exact values given in the map depend on the type of the order. All clients should make sure to implement default states for the fields given in this map, as they might not always be given.-
car_necessary
(boolean)
Defines whether a car is necessary, or at least recommended to execute the order. Assumefalse
if this field is missing. -
prescription
(boolean)
Defines whether the user has to get a prescription from the caller before executing the order. Assumefalse
if this field is missing.
-
-
raw
(map)
This map contains the raw data that have been gathered by the bot. They are only for debug purposes and should not be used by the apps. -
status
(string)
The status of the order. There is a set of predefined stati:-
open
: The order is open for users to execute. -
in_progress
: A user is currently executing the order. -
closed
: The order has been executed. The caller no longer needs help. -
incomplete
: The order is in creation and missing some input from the user. -
invalid
: There are some inconclusive data, or there was an error while processing the bots data. Clients should not display orders with this state - Any other string values are not allowed. If however there are other values, they should be interpreted as
invalid
.
-
-
account_id
(string)
The id of the account of the user that is currently executing the order. This field is only valid whilestatus == in_progress
. -
privacy_agreed
(boolean) Flag is true if the user gave his consent on phone. -
locale
(string) The ISO 3166-1 alpha-2 country code (in lower case) of the country that the order has been recorded in.
An example document /order/abcdefgHijk5mnopqrsT
could look like this (JSON representation of the data):
{
"type": "groceries",
"urgency": "today",
"name": "Jane Doe",
"phone_number": "+49123456789",
"address": {
"street": "Adalbertstraße",
"house_number": "5a",
"zip": "36039",
"city": "Fulda"
},
"location": {
"gps": [50.55856° N, 9.676204° E],
"geohash": "u0yzs5vuzys"
},
"extras": {
"car_necessary": true,
"prescription": false
},
"status": "in_progress",
"account_id": "abcdefghi6KLmn0pqrst",
"privacy_agreed": true,
"locale": "de"
}