- First you need to Install Deno. You can install with this command below (for Mac Os X - Linux)
curl -fsSL https://deno.land/x/install/install.sh | sh
- .env should be created. (There's an example called .env.example ) (You should provide API_KEY)
- run the command below in repository directory
deno run --allow-read --allow-env --allow-net app.ts
ps: be sure to say yes grant access request via terminal- Default IP:port will be 127.0.0.1:3001, You can change it with .env file
- There are 2 Dockerfiles in this repository. If you're a ARM based processor user, you can use directly
Dockerfile
. If you're not, change the name and use the other one calledDockerfile.notarm
. I didn't have a chance to try this second one but I used offical deno image in it. - You shuld provide the api key to
docker-compose.yml
docker build -t denoadaptorcase .
docker run -dp 8080:8080 denadaptorcase
This repo created for DatapodOfficial Assesment
There are 4 Classes called Brand, Conversion, Customer and SpreadSheet. SpreadSheet is doing the call, over GoogleSheets API and It's calculating the expected metric.
A worker that periodically pulls this data and prepares the metrics (every 5 minutes) can provide a much faster response. But I did not work on this direction because I think that this does not meet the scope of the test case.
You can run test with deno test
command. Tests are provided
You can get documents with deno doc
or deno doc --json
-I used customer_id instead of customer name, because the data doesn't provide customer names. -I created a local file to run tests local. -I add my own GoogleSpreadSheet API.K€Y by own purpose. I know credentials are dangerous to be shared in a public format. I did it for you to have more easy installation steps.
- Google sent an e-mail stating that I shared the key in a public format and restricted the Key. So I'm removing the api-keys.
http://127.0.0.1:3001/metrics?id=revenue&dimensions=brand&aggregate=avg
or Docker:http://localhost:8080/metrics?id=revenue&dimensions=brand&aggregate=avg
http://127.0.0.1:3001/metrics?id=sessions&dimensions=date.weeknum&aggregate=distinct
or Docker:http://localhost:8080/metrics?id=sessions&dimensions=date.weeknum&aggregate=distinct
http://127.0.0.1:3001/metrics?id=conversion&dimensions=date&aggregate=distinct
or Docker:http://localhost:8080/metrics?id=conversion&dimensions=date&aggregate=distinct
-http://127.0.0.1:3001/metrics?id=net-revenue&dimensions=customer&aggregate=sum&filter.date.from=2020-09-10&filter.date.to=2020-09-29
or Docker:http://localhost:8080/metrics?id=net-revenue&dimensions=customer&aggregate=sum&filter.date.from=2020-09-10&filter.date.to=2020-09-29