Implementation of Q-CTRL back-end engineering challenge in Django.
Make sure you have Poetry installed. And create a fresh database in postgreSQL.
$ ln -sv .envs/.env.dev qctrl/.env
$ poetry install
Modify project settings as you require in qctrl/.env
, or override them using
environment variables when calling manage.py
.
You can then run a development server with
$ poetry run ./manage.py makemigrations api
$ poetry run ./manage.py migrate
$ poetry run ./manage.py runserver
The API root is available at api/
. HTTP request bodies should be in JSON,
unless otherwise specified.
The API allows for
- Create a new control
- List all controls (five per page)
- Get a specific control
- Update a specific control
- Delete a specific control
- Bulk upload controls in CSV format
- Download controls in CSV format
POST /controls/
Name | Type | Description |
---|---|---|
name |
string |
Required Name of the control |
type |
string |
Required One of: Primitive, CORPSE, Gaussian, CinBB, CinSK |
maximum_rabi_rate |
float |
Required The maximum achievable angular frequency of the Rabi cycle for a driven quantum transition. This is a number between 0 and 100. |
polar_angle |
float |
Required An angle measured from the z-axis on the Bloch sphere. This is a number between 0 and 1 (units of pi). |
GET /controls/
GET /controls/:id
PUT /controls/:id
Name | Type | Description |
---|---|---|
name |
string |
Required Name of the control |
type |
string |
Required One of: Primitive, CORPSE, Gaussian, CinBB, CinSK |
maximum_rabi_rate |
float |
Required The maximum achievable angular frequency of the Rabi cycle for a driven quantum transition. This is a number between 0 and 100. |
polar_angle |
float |
Required An angle measured from the z-axis on the Bloch sphere. This is a number between 0 and 1 (units of pi). |
DELETE /controls/:id
POST /controls/upload
Name | Type | Description |
---|---|---|
data |
binary |
CSV file in binary format |
For example,
curl -X POST -i
--data-binary @dir/to/foo.csv
-H 'Content-Type: text/csv'
-H 'Accept: text/csv' http://domain.name/api/controls/upload/
GET /controls/download
You can easily invoke tests with
$ poetry run ./manage.py test
- CI/CD (with GitHub actions)
- Authentication to limit scope of API
- API versioning
- Rate limiting
- User-Agent detection