Managing subjects in a human research context.
Project description
huscy.subjects
Requirements
- Python 3.6+
- A supported version of Django
Tox tests on Django versions 2.1, 2.2, 3.0 and 3.1.
Installation
To install husy.subjects
simply run:
pip install huscy.subjects
Configuration
First of all, the huscy.subjects
application has to be hooked into the project.
- Add
huscy.subjects
and further required apps toINSTALLED_APPS
in settings module:
INSTALLED_APPS = (
...
'django_countries',
'phonenumber_field',
'rest_framework',
'rest_framework_nested',
'huscy.subjects',
)
- Create
huscy.subjects
database tables by running:
python manage.py migrate
REST-Endpoints
URL | HTTP Method | Description |
---|---|---|
/api/subjects/ |
GET | Returns 500 subjects, paginated by 25 items per page and ordered by contact__last_name and contact__first_name . |
| | Additional get parameter allowed:
| | - `count=<items_per_page>` - configure the items per page; max count is 100
| | - `ordering=<field_name>` - comma separated list of fields. One can order by `contact__first_name`, `contact__last_name`, `contact__gender` or `contact__date_of_birth`
| | - `page=<page>` - show results on page `page`
| | - `serach=<query_string>` - search for `display_name` or `date_of_birth`
/api/subjects/<subject_id>/guardians/
| POST | Create new contact and add as guardian to subject.
/api/subjects/<subject_id>/guardians/<guardian_id>/
| DELETE | Removes the guardian for subject.
/api/subjects/<subject_id>/notes/
| GET | Returns the list of all notes for subject.
/api/subjects/<subject_id>/notes/
| POST | Create new note about subject. Other option should be chosen to save comment.
/api/subjects/<subject_id>/notes/<note_id>/
| DELETE | Removes the note about subject
/api/subjects/<subject_id>/inactivity/
| DELETE | Removes inactivity for subject.
| POST | Creates or updates the inactivity for a subject.
Development
After checking out the repository you should activate any virtual environment. Install all development and test dependencies:
make install
Create migration files and database tables:
make makemigrations
make migrate
We assume you're having a running postgres database with a user huscy
and a database also called huscy
.
You can easily create them by running
sudo -u postgres createuser -d huscy
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE huscy TO huscy;"
sudo -u postgres psql -c "ALTER USER huscy WITH PASSWORD '123';"
sudo -u postgres createdb huscy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for huscy.subjects-0.8.0rc18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e501e90f5fb115da343716f8c3acfbec9a59ce4720ce28974c21a17d73cca295 |
|
MD5 | 2946c0489d45bbb0e1e235cc77d2b3b5 |
|
BLAKE2b-256 | 4a8bc37f2ad5648283280f6a7532311affddca8d7eaf975cf1437c85757709de |