Skip to content

Commit

Permalink
Merge pull request #129 from c3g/develop
Browse files Browse the repository at this point in the history
Version 0.7.0
  • Loading branch information
zxenia committed Jul 7, 2020
2 parents 732bf6a + 7706526 commit e5da8ad
Show file tree
Hide file tree
Showing 153 changed files with 6,999 additions and 4,477 deletions.
10 changes: 4 additions & 6 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ formats:
- htmlzip

# Optionally set the version of Python and requirements required to build your docs
#python:
# version: 3.7
# install:
# - requirements: requirements.txt
# - requirements: docs/requirements.txt
# - method: pip
python:
version: 3.7
install:
- requirements: requirements.txt
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ python:
- "3.6"
- "3.8"
addons:
postgresql: "11"
postgresql: "12"
apt:
packages:
- postgresql-11
- postgresql-contrib-11
- postgresql-12
- postgresql-contrib-12
before_install:
- sudo -u postgres psql -U postgres -p 5432 -d postgres -c "alter user postgres with password 'hj38f3Ntr';"
- sudo -u postgres psql -U postgres -p 5433 -d postgres -c "alter user postgres with password 'hj38f3Ntr';"
install:
- pip install -r requirements.txt
- pip install .
script:
- export POSTGRES_USER="postgres" && export POSTGRES_PASSWORD="hj38f3Ntr" && export POSTGRES_PORT=5432
- python3 -m coverage run ./manage.py test
- export POSTGRES_USER="postgres" && export POSTGRES_PASSWORD="hj38f3Ntr" && export POSTGRES_PORT=5433
- python3 -m tox
- codecov
- rm -rf chord_metadata_service
- python3 -m coverage run ./manage.py test chord_metadata_service
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include chord_metadata_service/chord/workflows/phenopackets_json.wdl
include chord_metadata_service/chord/workflows/*.wdl
include chord_metadata_service/chord/tests/*.json
include chord_metadata_service/dats/*
include chord_metadata_service/package.cfg
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,24 @@ under the BSD 3-clause license.
CHORD Metadata Service is a service to store epigenomic metadata.

1. Patients service handles anonymized individual’s data (individual id, sex, age or date of birth)
* Data model: aggregated profile from GA4GH Phenopackets Individual and FHIR Patient
* Data model: aggregated profile from GA4GH Phenopackets Individual, FHIR Patient and mCODE Patient.

2. Phenopackets service handles phenotypic and clinical data
* Data model: [GA4GH Phenopackets schema](https://github.com/phenopackets/phenopacket-schema)

3. CHORD service handles metadata about dataset, has relation to phenopackets (one dataset can have many phenopackets)
3. mCode service handles patient's oncology related data.
* Data model: [mCODE data elements](https://mcodeinitiative.org/)

4. Experiments service handles experiment related data.
* Data model: derived from [IHEC Metadata Experiment](https://github.com/IHEC/ihec-ecosystems/blob/master/docs/metadata/2.0/Ihec_metadata_specification.md#experiments)

5. Resources service handles metadata about ontologies used for data annotation.
* Data model: derived from Phenopackets Resource profile

6. CHORD service handles metadata about dataset, has relation to phenopackets (one dataset can have many phenopackets)
* Data model: [DATS](https://github.com/datatagsuite) + [GA4GH DUO](https://github.com/EBISPOT/DUO)

4. Rest api service handles all generic functionality shared among other services
7. Rest api service handles all generic functionality shared among other services


## REST API highlights
Expand All @@ -42,7 +51,6 @@ Phenopackets model is mapped to [FHIR](https://www.hl7.org/fhir/) using
To retrieve data in fhir append `?format=fhir` .

* Ingest endpoint: `/private/ingest`.
Example of POST body is in `chord/views_ingest.py` (`METADATA_WORKFLOWS`).


## Install
Expand Down Expand Up @@ -131,22 +139,28 @@ out and tagged from the tagged major/minor release in `master`.

Tests are located in tests directory in an individual app folder.

Run all tests for the whole project:
Run all tests and linting checks for the whole project:

```bash
tox
```

Run all tests for the whole project:

```bash
python manage.py test
```

Run tests for an individual app, e.g.:

```
```bash
python manage.py test chord_metadata_service.phenopackets.tests.test_api
```

Create coverage html report:
Test and create `coverage` HTML report:

```
coverage run manage.py test
```bash
tox
coverage html
```

Expand Down
7 changes: 6 additions & 1 deletion chord_metadata_service/chord/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from .models import *
from .models import Project, Dataset, TableOwnership, Table


@admin.register(Project)
Expand All @@ -16,3 +16,8 @@ class DatasetAdmin(admin.ModelAdmin):
@admin.register(TableOwnership)
class TableOwnershipAdmin(admin.ModelAdmin):
pass


@admin.register(Table)
class TableAdmin(admin.ModelAdmin):
pass
23 changes: 19 additions & 4 deletions chord_metadata_service/chord/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from chord_metadata_service.restapi.api_renderers import PhenopacketsRenderer, JSONLDDatasetRenderer, RDFDatasetRenderer
from chord_metadata_service.restapi.pagination import LargeResultsSetPagination
from .models import *
from .models import Project, Dataset, TableOwnership, Table
from .permissions import OverrideOrSuperUserOnly
from .serializers import *
from .serializers import ProjectSerializer, DatasetSerializer, TableOwnershipSerializer, TableSerializer


__all__ = ["ProjectViewSet", "DatasetViewSet", "TableOwnershipViewSet"]
__all__ = ["ProjectViewSet", "DatasetViewSet", "TableOwnershipViewSet", "TableViewSet"]


class ReadOnly(BasePermission):
Expand Down Expand Up @@ -61,8 +61,23 @@ class TableOwnershipViewSet(CHORDPublicModelViewSet):
post:
Create a new relationship between a dataset (and optionally a specific biosample) and a table
in another service
in a data service
"""

queryset = TableOwnership.objects.all().order_by("table_id")
serializer_class = TableOwnershipSerializer


class TableViewSet(CHORDPublicModelViewSet):
"""
get:
Return a list of tables
post:
Create a new table
"""

# TODO: Create TableOwnership if needed - here or model?

queryset = Table.objects.all().prefetch_related("ownership_record").order_by("ownership_record_id")
serializer_class = TableSerializer
2 changes: 1 addition & 1 deletion chord_metadata_service/chord/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ChordConfig(AppConfig):
name = 'chord'
name = 'chord_metadata_service.chord'
35 changes: 35 additions & 0 deletions chord_metadata_service/chord/data_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from chord_metadata_service.experiments.search_schemas import EXPERIMENT_SEARCH_SCHEMA
from chord_metadata_service.phenopackets.search_schemas import PHENOPACKET_SEARCH_SCHEMA
from chord_metadata_service.mcode.schemas import MCODE_SCHEMA

__all__ = [
"DATA_TYPE_EXPERIMENT",
"DATA_TYPE_PHENOPACKET",
"DATA_TYPE_MCODEPACKET",
"DATA_TYPES",
]

DATA_TYPE_EXPERIMENT = "experiment"
DATA_TYPE_PHENOPACKET = "phenopacket"
DATA_TYPE_MCODEPACKET = "mcodepacket"

DATA_TYPES = {
DATA_TYPE_EXPERIMENT: {
"schema": EXPERIMENT_SEARCH_SCHEMA,
"metadata_schema": {
"type": "object", # TODO
},
},
DATA_TYPE_PHENOPACKET: {
"schema": PHENOPACKET_SEARCH_SCHEMA,
"metadata_schema": {
"type": "object", # TODO
}
},
DATA_TYPE_MCODEPACKET: {
"schema": MCODE_SCHEMA,
"metadata_schema": {
"type": "object", # TODO
}
}
}

0 comments on commit e5da8ad

Please sign in to comment.