Python software engineer pre-interview repository. Please fork this repository to your own GitHub accounts. You can create one using this link.
- Provide an API for client to push data to this server
- The server need to handle a lot of data input in 10 seconds
- The API should accept XML format only
- Format the data to time based data structure and store it into a database(any of your choice)
- Provide an API to let client fetch the reformatted data by time(timestamps or datetime)
- API to receive the data => POST --
/data
- API to display the data => GET --
/data/<id>
<?xml version="1.0" encoding="UTF-8"?>
<root>
<data>
<element>
<device>SGD-12344</device>
<value>1234.266</value>
</element>
<element>
<device>SGB-11233</device>
<value>60</value>
</element>
<element>
<device>SCC-525</device>
<value>220</value>
</element>
<element>
<device>SGC-1552</device>
<value>5266.66</value>
</element>
<element>
<device>SGB-11233</device>
<value>440</value>
</element>
<element>
<device>G3112</device>
<value>32.266</value>
</element>
<element>
<device>SGD-12344</device>
<value>1234.266</value>
</element>
</data>
<devices>
<G3112>Temperature Sensor</G3112>
<SCC-525>Voltage Meter</SCC-525>
<SGB-11233>Current Meter</SGB-11233>
<SGC-1552>Power Meter</SGC-1552>
<SGD-12344>Power Meter</SGD-12344>
</devices>
<id>2314</id>
<record_time>1008910273</record_time>
</root>
[
{
"datetime": "2018-08-17T19:00:00+08:00",
"value": 1274.034,
"unit": "V"
},
{
"datetime": "2018-08-17T19:00:10+08:00",
"value": 25.253,
"unit": "A"
},
{
"datetime": "2018-08-17T19:00:20+08:00",
"unit": "°C",
"value": 14.0524,
}
]
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You will need to install pipenv and pyenv before you start using this repo.
First install the dependences via pipenv
pipenv install
If you want to install any dependence from PyPi, then you should run the following
pipenv install <package_name>
After you installed the packages, you can use this to active the virtual environment.
pipenv shell
We use pytest as our unit test framework. Run the following command to do the test.
pipenv run pytest hedersgava
Please follow the PEP8 standard as your basic coding style. But use 100 as your line length. And run the following command to do code style test.
pipenv run pylint hedersgava/hedersgava
- Django - The web framework used
- Django REST framework - The web RESTful framework
- Hypothesis - Property based testing library
- PyTest - Python unit test tools
- Linnovs - Initial work - linnovs47
- Andy - Initial work - EntrakAndyLam
See also the list of contributors who participated in this project.