-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
396 lines (342 loc) · 18.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Giosg Coding Assignment</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/monokai.css">
<style>
/*
Adjust font sizes for paragraphs and code blocks.
Removed some padding to fit more content on one slide
*/
.reveal section p {
display: inline-block;
font-size: 0.6em;
line-height: 1.2em;
vertical-align: top;
}
.reveal .slides > section, .reveal .slides > section > section {
padding: 0px 0px;
}
.reveal pre {
font-size: 0.40em;
}
/* Add partymode logo to top corner */
body {
background-image: url(./img/giosg-partymode.webp);
background-size: 10%;
background-repeat: no-repeat;
background-position: 20px 20px;
}
</style>
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown>
<textarea data-template>
## Hello there, developer!
*Start by pressing right arrow*
</textarea>
</section>
<section data-markdown>
<textarea data-template>
### Welcome to Giosg backend coding assignment
Goal of this assignment is to give us better picture of your skills and also
possibility for you to showcase your talent!
Completing this assignment will usually take anywhere from 2 hours to 8 hours depending on your skill level.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Lets get started!
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Customer training event
Giosg customer success team is organizing event for our customers. Event will have trainings, work shops and of course good food and drinks.
Our amazing HR lady Jenni was tasked to get food and drinks for the event.
As Jenni is new at Giosg she does not have a clue how much she should get each flavor so we need to help her!
</textarea>
</section>
<section data-markdown>
<textarea data-template>
To make the event successfull we need to use our data from previous events to estimate how much she needs to purchase each flavor.
For this reason you need to build a web application to aggregate and display the data from previous events so Jenni can make good decision!
</textarea>
</section>
<section>
<section data-markdown>
<textarea data-template>
# Specs
*Scroll through all requirements by pressing down arrow. After that you can continue by pressing right arrow.*
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Main requirements
* Web app should be done using Django framework
* App should have login page. All other pages and APIs should be accessible only when logged in.
* App should have "results" -page and 2 RESTfull APIs for fetching data.
* App should have API endpoints for `/summary` and `/statistics`.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Login page
* Login page should allow user to login using Django's standard authentication system
* No need for password reset or other fancy stuff
* After successfull login, user should be redirected to results page
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Results page
* Page should have inputs for start date, end date and a submit button.
* Clicking submit button should query your API (with ajax) which in turn should fetch data from Giosg API.
* When request completes, results should get rendered to screen.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Data on results page
* On top of page there should be boxes for "Food", "Non-alcoholic drinks" and "Alcoholic drinks".
* These boxes should show total number of food items, total number of non-alcoholic drinks and alcoholic drinks consumed.
* On bottom of the page there should be table for displaying all data points returned from Giosg API.
* There should be columns: Date, Category, Event name, Item name and quantity.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Results page layout
This is how results page could look like. Your app does not need to look exactly like this!
<img style="background: none; border: none; max-width: 600px; max-height: 400px;" data-src="./img/giosg_backend_assignment.png">
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## REST API endpoints
* Your app should have `/summary` and `/statistics` API
* When querying these APIs, request to Giosg API should be made and data fetched.
* Both APIs should take start date and end date as parameters.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Querying Giosg API
* API url is: https://api.giosg.com/api/events/v1/orgs/6fb6381a-4fdc-4c62-8678-ca8388d5d05e/fetch
* You need to use header for authentication. Token is provided to you by email.
```
Authorization: Token <token here>
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Querying Giosg API
* API Request should be `POST` with following content:
```json
{
"sources": ["untrusted"],
"interval": {
"start": <Start date from UI>, // Ie. "2020-02-17T00:00:00.000Z"
"end": <End date from UI> // Ie. "2020-02-20T23:59:59.999Z"
},
"granularity": "day",
"group_by": [
"category",
"action",
"label"
],
"organization_id": "6fb6381a-4fdc-4c62-8678-ca8388d5d05e",
"vendor": "com.giosg.journalist",
"aggregations": [
"sum"
],
"filters": {}
}
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Giosg API response
* Response to mentioned query will be in following format:
```json
{
"fields": [
{
"type": "dimension",
"name": "timestamp"
},
{
"type": "dimension",
"name": "category"
},
{
"type": "dimension",
"name": "action"
},
{
"type": "dimension",
"name": "label"
},
{
"type": "metric",
"name": "value_sum"
}
],
"data": [
[
"2020-02-24T00:00:00.000Z",
"drinks",
"training-event",
"Sprite",
22
],
[
"2020-02-24T00:00:00.000Z",
"drinks",
"training-event",
"heineken",
123
],
[
"2020-02-24T00:00:00.000Z",
"food",
"training-event",
"pizza",
201
]
]
}
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Giosg API response fields
* `fields` array contains names and types of columns in each item in `data` array.
* So in above query each data array item would translate into this:
```json
{
"timestamp": "2020-02-24T00:00:00.000Z",
"category": "drinks",
"action": "training-event",
"label": "Sprite",
"value_sum": 22
}
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Response fields explained
* `timestamp` will have ISO formatted timestamp of each day in queried time range.
* Category column value is either `drinks` or `food`.
* `action` column contains event name, for example "customer training event"
* `label` column is item name, for example "Pizza" or "Bud Light"
* Column `value_sum` is the quantity consumed in given day
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Summary API
* Your app should have `/summary` API which should return total sum of food items, soft drinks and alcoholic bewerages consumed in the queried time range.
```json
{
"food": 456,
"soft_drinks": 868,
"alcholic_drinks": 12
}
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Statistics API
* Your app should have `/statistics` API which should return all data points returned by Giosg API.
```json
[
{
"date": "2020-02-20T22:08:58.897Z",
"category": "Soft drinks",
"event_name": "Training event",
"item": "Coca-Cola",
"quantity": 9053
}, {
"date": "2020-02-20T22:08:58.897Z",
"category": "Food",
"event_name": "Training event",
"item": "Salami Pizza",
"quantity": 234
}
]
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Bonus points and things to consider
* In memory caching of queries to Giosg API
* Great documentation on how to run and build/install if needed. :)
* Dockerized environment (External dependencies like databases, caches, etc)
* Secrets management
* Something other cool that was not mentioned here!
* Do not commit any access tokens to repository!
</textarea>
</section>
</section>
<section data-markdown>
<textarea data-template>
## Questions?
If you have any questions don't hesitate to ask! We are happy to help.
You can reach us by mail at <a href="mailto:[email protected]">[email protected]</a> or come to our website
<a target="_blank" href="https://giosg.com">giosg.com</a> and have a online chat with us! 💬
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Returning this assignment
You can send link to your master piece with email to <a href="mailto:[email protected]">[email protected]</a>.
<a href="https://github.com">Github</a> or <a href="https://gitlab.com">Gitlab</a> repo link is preferred.
</textarea>
</section>
<section>
<h2>Happy coding!</h2>
<h6>Hope we hear from you soon! :)</h6>
<img style="background: none; border: none; max-width: 600px; max-height: 400px;" data-src="./img/happycoding.jpeg">
</section>
</div>
</div>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
hash: true,
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/highlight/highlight.js' },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>