Welcome to the Candidate Assessment for Backend developers. We have details instructions on how to get started and what a successful solution will entail. Please read and follow the enclosed instructions.
At the core is our Django API which powers multiple front-facing client(s) - specifically the authentication, CRUD interfaces for models, permissions, and complex workflows.
In our sample application we are adding a webhook /ehr_webhook/
to our API / Platform. Your task is the implementation of the endpoint so that it returns a 201
even if duplicates exist, but returns 400x
and 500x
for invalid situations (for example malformed json
) and ensure the tests are passing and there are no regressions. You will do the work on a separate branch and submit a pull-request (see below for Submit Solution).
- You can run a local compatible data-store for a Django 4.x app
- Alter
settings.py
as needed
- Alter
- You can run a local python
env
withpip
- You can handle any build issues that can occur in a python environment
- You can run the projects test-suite
- Implement a version of the webhook in the 30-1hr time-allotment and be prepared to discuss/document the trade-offs (tech-debit, security, scale-ability)
Setting up a new project is time intensive so we have done some of the upfront work.
- We provide you with a shell of a Django app with working migrations,
requirements.txt
and working tests. - Preconfigured data-store bindings for
sqlite
andpostgres
- Sample webhook payloads the assignment/task.
API
Documentation- Grading Solution Rubric (see below)
We also are providing an initial endpoint for you to have as a basis
- GET
/patient/
will return a list of patients - POST
/patient/
- As a POST requires a json body withemail
, andname
as required fields. Returns201
You are to implement a new webook endpoint that accepts the following POST /ehr_webhook
that will contain an array of data as:
[
{"email":"pete@example.com", "name": "Pete Townshend"},
{"email":"Jane@example.com", "name": "Jane Buckneer"}
]
To help you in your work here is an example of our vendors webhook all to our server
curl -X POST -H "Content-Type: application/json" -d '[{"email":"pete@
fi.com", "name": "Pete Townshend"},{"email":"Jane@example.com", "name": "Jane Buckneer"}]' http://localhost:8000/ehr_webhook/
Here are a few first steps to get off the ground
1. python3 -m venv venv
2. source venv/bin/activate
3. pip install -r requirements.txt
4. python manage.py migrate
At this point you should be able to do either of the following:
- Run
python manage.py runserver
- Run
python manage.py test app
We want to ensure you submit a successful solution so here is our assessment grading rubric.
Task / Skill-Check | Description | |
---|---|---|
π | Code Complete | Did you complete the assessment in it's entirety in terms of functionality |
β | CI Passes | We expect the CI Runner using github-actions to pass. |
π‘ | API / Network Comms. | Were networking communications properly configured |
π | Pull-Request | Open up a proper PR, read the submission process below |
Commit History | We value conventional-commits |
IMPORTANT: When you receive this zip file create your repository and COMMIT the code as the
initial commit
inside of the default branchmain
ormaster
.
You should begin to build your solution on a new branch (we don't care what you call it we recommend -- solution
). Once you are code complete, create a private repository and push up both branches. And open up a pull-request against the default branch main|master
.
Invite mgan59
, DanOB34
, CMitchell08
, ramirog89
to your repository so we can see your pull-request. We also recommend assigning the PR to for review so that we get notifications in our github-ui.
Once the reviewers are added to the repository, we will conduct a quick PR review and setup a time to go over the code together.
- Initial Commit
- Setup Dev Environment (Runtime, Virtual Env, IDE)
- Support incoming webhooks v1: receive, validate, and save Patients (Leverage on DRF)
- Support tests for validations and response in order to prevent regressions
- Pre-commit + Conventional commits
- Spike: how webhooks implementation could be improved
- Incoming Webhooks app
- Setup Celery
- Use Pytest instead of Django suite
- Split views and serializers
- Introduce Observability layer (Better logging and exception handling)
pipenv install
pipenv shell
pipenv run dev # python manage.py runserver
pipenv run migrate # python manage.py migrate
Install pre-commit within
.git/hooks/pre-commit
.
pre-commit install
pre-commit install --hook-type commit-msg
Supports:
- β Conventional commits
- β Trailing and whitespace checks
- β Check yaml sintax
- β Check merge conflicts
- β Prevent debug statements
- β Check for large files added
- β
Check
requirements.txt
file to be present - β Django: check project for potential problems
- β Django: check project for missing migrations
- β Python: flake8
- β Python: isort
- β Python: black
Suggested configuration file
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/*.pyc": true,
"**/__pycache__": true
},
"python.pipenvPath": "<PATH_TO_VENV>", // pipenv --venv
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--disable=C0111", // missing docstring
"--load-plugins=pylint_django"
],
"python.linting.enabled": true,
"python.formatting.provider": "black"
}
Endpoint: /ehr_webhook/
Allow: POST
, OPTIONS
Content-Type: application/json
Payload
[
{
"email": "jane@example.com",
"name": "Jane Doe"
},
{
"email": "fjcero@gmail.com",
"name": "Francisco"
}
]
- The implementation of the endpoint returns a
201
HTTP Status Code, even if duplicates exist. - HTTP errors like
400x
and500x
are triggered in invalid situations, for example malformedjson
- Tests are passing and there are no regressions
- Conventional commits format applied