Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: switch to Phenopackets v2 #1394 #380

Merged
merged 181 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 175 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
f8586b7
docker-compose file for quick postgress setup in standalone
v-rocheleau Jan 25, 2023
a058838
Convenience docker-compose.dev.yml to spin PostgreSQL and AdMiner dev…
v-rocheleau Jan 27, 2023
aede7d7
Schema updates: additions
v-rocheleau Jan 30, 2023
a4bf6f0
fixes
v-rocheleau Jan 31, 2023
abcc035
Phenopacket V2 migrations
v-rocheleau Feb 2, 2023
d4ea857
Started work on django models phenov2, added BaseTimeStamp table to i…
v-rocheleau Feb 6, 2023
1c913e4
Utils functions, more schemas
v-rocheleau Feb 6, 2023
3767690
VRS and VRSATILE missing schema items
v-rocheleau Feb 7, 2023
d721847
Schema utils helper functions, schema cleanup
v-rocheleau Feb 7, 2023
14ca39a
Replaced schema type string literals with enum values
v-rocheleau Feb 7, 2023
519518b
More constants, opt description in helper functions
v-rocheleau Feb 7, 2023
55e2dd2
Small fix model fields fixes, makemigrations works
v-rocheleau Feb 7, 2023
bb51f4b
Helper function for named oneOf object properties
v-rocheleau Feb 8, 2023
05c27dd
Django models created, search_schemas needs fixing
v-rocheleau Feb 8, 2023
1eac6a4
PK and FK search schema funcs
v-rocheleau Feb 10, 2023
5efbbd6
Updated search schemas, working on TimeElement's search schema
v-rocheleau Feb 10, 2023
43897d4
Fixes on models, search schemas, and filters
v-rocheleau Feb 10, 2023
387be3a
Filters ands views small mods
v-rocheleau Feb 10, 2023
dda28a7
Json-schema fixes raised by ingest debugging
v-rocheleau Feb 13, 2023
db175bd
Fixed oneOf inside measurement values
v-rocheleau Feb 13, 2023
e3f6a1f
Json-Schema validation passes, need to handle snake_case and camelCas…
v-rocheleau Feb 13, 2023
06e97f1
Use camelCase for metadata and ressources fields (check with ga4gh if…
v-rocheleau Feb 13, 2023
2291993
First successful Phenopackets V2 ingestion! New FK relations to be added
v-rocheleau Feb 14, 2023
9e735b3
Schema fixes, workflow ingestion converts camelCase keys to snake_case
v-rocheleau Feb 14, 2023
d1a06c6
Fixed Quantity.reference_range schema
v-rocheleau Feb 15, 2023
016f6ae
Fixed DOSE_INTERVAL items in example phenopacket covid19_samples.json
v-rocheleau Feb 15, 2023
2d2b361
PhenotypicFeature.negated changed to PhenotypicFeature.excluded
v-rocheleau Feb 15, 2023
7aba149
Todos for later
v-rocheleau Feb 15, 2023
b57e716
Converted Diseases, Medical_Action and Measurements to JSONField, cov…
v-rocheleau Feb 16, 2023
b7f86a4
Covid and mcahs samples pass validation, remodeling DB fields as JSON
v-rocheleau Feb 16, 2023
e11e82e
Interpretation DB ingestion
v-rocheleau Feb 17, 2023
227e379
Convert diseases fields to JSON
v-rocheleau Feb 17, 2023
05224f2
Fixed api_views breaking changes
v-rocheleau Feb 17, 2023
5f5ec85
Removed large pheno v1 json files
v-rocheleau Feb 17, 2023
bb2aee2
Fixed serialization of interpretations and their nested entities
v-rocheleau Feb 20, 2023
e1dc6d7
New manage.py command to validate phenopackets/experiment jsons again…
v-rocheleau Feb 21, 2023
e746b76
MetaDataTest pass
v-rocheleau Feb 21, 2023
5768954
Individual test_model passes
v-rocheleau Feb 21, 2023
e6af7ef
All tests pass in chord_metadata_service.patients
v-rocheleau Feb 22, 2023
7894b49
Resources tests all pass, fixed constants
v-rocheleau Feb 22, 2023
5adb53d
Working on phenopackets app tests, added new filters on GenomicInterp…
v-rocheleau Feb 22, 2023
53aabf4
Phenopackets model tests pass, will rollback Disease to a table
v-rocheleau Feb 23, 2023
10b9847
Rolled back Phenopacket.diseases from JSON to M2M field for better fi…
v-rocheleau Feb 24, 2023
6a29fe7
Fixed tests for latest diagnos model changes
v-rocheleau Feb 24, 2023
30b4110
Fixed schemas and tests
v-rocheleau Feb 24, 2023
09b758a
Fixed vrs path
v-rocheleau Feb 24, 2023
cceb1ab
Recursively tag reference vrs.json schemas
v-rocheleau Feb 25, 2023
4acac41
Parsing of VRS json-schema definitions works
v-rocheleau Feb 27, 2023
d5d00f4
Refactor VRS schema parsing
v-rocheleau Feb 27, 2023
ba5fabb
VRS schemas references now resolve fully
v-rocheleau Feb 28, 2023
869e2fd
Handle any composition keyword (allOf, oneOf) and if-the-else in Sche…
v-rocheleau Feb 28, 2023
f2258c5
On the fly schema resolving
v-rocheleau Mar 1, 2023
7375526
Prevent cyclic refs in schema resolution for VRS
v-rocheleau Mar 1, 2023
3d9deec
API tests fixes
v-rocheleau Mar 1, 2023
3636d2a
Use Disease FK in Diagnosis model
v-rocheleau Mar 2, 2023
c44393e
TIME_ELEMENT schema moved to restapi app, Individual refactors
v-rocheleau Mar 2, 2023
8cb75b1
Individual model refactors
v-rocheleau Mar 2, 2023
ad5ea0d
Api tests fixes
v-rocheleau Mar 2, 2023
28713e9
Fixed camel/snake case handling that inserted underscores before numb…
v-rocheleau Mar 3, 2023
c2f28a1
Fixed GenomicInterpretationSerializer for test_api
v-rocheleau Mar 3, 2023
8d55ea9
Removed Variant model, no longer in phenov2
v-rocheleau Mar 3, 2023
b557023
Finally can validate any cyclic VRS message, cleanup needed
v-rocheleau Mar 3, 2023
f52ad33
Validation of VRS defs works! Must fix ingestion of VariantInterpreta…
v-rocheleau Mar 6, 2023
015d617
API test fixes
v-rocheleau Mar 7, 2023
dcf2bfe
Fixed typo in VariationDescriptor, all phenopacket module tests passing
v-rocheleau Mar 7, 2023
69fc540
Patients app is phenov2 compliant, tests pass in Patients and Phenopa…
v-rocheleau Mar 7, 2023
fe69c13
Fixed most tests in chord app
v-rocheleau Mar 8, 2023
f6f311a
All chord tests pass
v-rocheleau Mar 8, 2023
d0e2c90
Fixed test data for experiments, all tests passing
v-rocheleau Mar 8, 2023
2482128
Fixed mcode tests and data, all passing
v-rocheleau Mar 8, 2023
bbabff5
Fixes for restapi tests, some still failing
v-rocheleau Mar 8, 2023
cbba154
Created File model, added missing Biosample fields
v-rocheleau Mar 9, 2023
06dcf46
FHIR test fixes
v-rocheleau Mar 9, 2023
602ecbf
Fixed last restapi tests, ALL tests passing
v-rocheleau Mar 10, 2023
638170a
Merge branch 'develop' into features/phenov2-1394
v-rocheleau Mar 10, 2023
d0f65ec
Migrations and lint fixes
v-rocheleau Mar 10, 2023
6187c80
Lint fixes, all checks should pass in theory
v-rocheleau Mar 10, 2023
04bbda6
GA4GH VRS schema imported as submodule
v-rocheleau Mar 10, 2023
39f3e02
Touch ups, naming, formating
v-rocheleau Mar 13, 2023
5a48428
Generic typing for chord.ingest.phenopackets._get_or_create_opt
v-rocheleau Mar 13, 2023
867ec13
Merge branch 'develop' into features/phenov2-1394
v-rocheleau Mar 22, 2023
3f84ab4
fix(schemas): individual.gender schema is now an ontology class inste…
v-rocheleau Mar 22, 2023
275c2d2
perf(schemas): chord_metadata_service.phenopackets schemas use valid …
v-rocheleau Mar 22, 2023
46d8d64
perf(schemas): helper functions to create valid schema uris
v-rocheleau Mar 22, 2023
f7848d4
modified .env-sample by accident, revert
v-rocheleau Mar 22, 2023
da6e0b2
lint fix
v-rocheleau Mar 22, 2023
00f663f
perf(schemas): all json-schema ids are expressed as a valid uri
v-rocheleau Mar 23, 2023
8d8572d
fix: remove last invalid uri schema id, new migrations with schema va…
v-rocheleau Mar 23, 2023
f221080
django field choices, VRS Variation validator constant using RefResolver
v-rocheleau Mar 24, 2023
db18c5d
migrations
v-rocheleau Sep 11, 2023
e0d27cb
remove feature branch migrations
v-rocheleau Sep 11, 2023
dc685db
Merge branch 'develop' into features/phenov2-1394
v-rocheleau Sep 11, 2023
8ce0f58
migrations
v-rocheleau Sep 11, 2023
8fb0067
fix tests
v-rocheleau Sep 12, 2023
5a11f7a
Merge branch 'develop' into features/phenov2-1394
v-rocheleau Oct 10, 2023
9f81606
fix disease search schema
v-rocheleau Oct 11, 2023
13bfc0d
regen poetry.lock
v-rocheleau Oct 11, 2023
23942b5
fix optional type for py 3.8
v-rocheleau Oct 11, 2023
1e6146e
fix BaseTimeStamp for reingestion
v-rocheleau Oct 11, 2023
60cb02c
timestamp migrations
v-rocheleau Oct 11, 2023
bb3c426
fix biosample ingestion
v-rocheleau Oct 12, 2023
0f05163
Make Procedure a JSON field of Biosample
v-rocheleau Oct 16, 2023
ef52e54
Procedure removal tests fixes
v-rocheleau Oct 16, 2023
d9a0d4d
lint
v-rocheleau Oct 16, 2023
9ca5279
PhenotypicFeature.modifiers changed to plural
v-rocheleau Oct 16, 2023
dc2c9c8
genomic interp serializes only one of gene or variant interp
v-rocheleau Oct 18, 2023
40c2440
store GenomicInterpretation related type in extra properties
v-rocheleau Oct 18, 2023
e27ebb2
fix gene context schema and ingestion
v-rocheleau Oct 26, 2023
faed586
update jsonschema for referencing api
v-rocheleau Oct 30, 2023
ea3b909
use referencing api for json schema
v-rocheleau Oct 30, 2023
14d700f
working vrs schemas using referencing api
v-rocheleau Nov 2, 2023
1b2fe6a
merge and fix mcode removal
v-rocheleau Nov 6, 2023
4dd6c64
schema id changes migrations
v-rocheleau Nov 6, 2023
87581c9
Merge branch 'develop' into features/phenov2-1394
v-rocheleau Nov 6, 2023
e534b51
lint
v-rocheleau Nov 6, 2023
6de22d0
remove unnecessary file closure
v-rocheleau Nov 6, 2023
fe8970f
alternate ids non curie strings
v-rocheleau Nov 8, 2023
584b94e
lint
v-rocheleau Nov 8, 2023
41902ae
combine phenopacket v2 patients migrations
v-rocheleau Nov 8, 2023
9a3fc88
ci: test PRs to feature branches
davidlougheed Nov 8, 2023
333d369
chore: update Docker base image
davidlougheed Nov 8, 2023
a84e5ab
ci: build PRs to feature branches
davidlougheed Nov 8, 2023
d492705
chore: update uvicorn in prod docker image
davidlougheed Oct 16, 2023
ee5f390
chore!: require python 3.10+, update bento_lib, rm strict-rfc3339 dep
davidlougheed Oct 16, 2023
53547c9
chore: rename logger to 'katsu'
davidlougheed Oct 18, 2023
39b82a2
update workflows to new format + start refactoring vcf2maf
davidlougheed Oct 20, 2023
6e9c02b
chore: update bento_lib to 9.1.0
davidlougheed Nov 13, 2023
a833b6d
more work on upgrading workflows to new system
davidlougheed Oct 23, 2023
8a84f72
fix: startup errors with workflow + viewset definitions
davidlougheed Oct 24, 2023
86df6da
fix(phenopackets): missing __all__ entries
davidlougheed Nov 9, 2023
a7a0695
chore: port document ingestion to new workflow system
davidlougheed Nov 13, 2023
82d2d36
chore: finish porting vcf2maf workflow
davidlougheed Nov 13, 2023
a4ce435
ci: update actions & use python 3.10/3.11
davidlougheed Oct 16, 2023
9e7af7b
chore!: use poetry-created venv
davidlougheed Oct 16, 2023
e6515f8
test: fix tox config
davidlougheed Nov 13, 2023
366c206
chore: update bento_lib to 9.2.0
davidlougheed Nov 13, 2023
f5582e5
fix(chord): rm unused/broken bento ingest schema validator
davidlougheed Nov 13, 2023
a253b96
fix(experiment): bad query logic for ER api endpoint
davidlougheed Nov 13, 2023
4ebcddf
fix(chord): bad regex for file extensions + lint
davidlougheed Nov 13, 2023
eddd2f0
fix(chord): access token input should be a secret
davidlougheed Nov 14, 2023
3e9c50e
fix(chord): typos in WDL files
davidlougheed Nov 14, 2023
445ac91
fix(chord): more workflow typos + cbioportal export port
davidlougheed Nov 14, 2023
a2f7d19
fix(chord): readset ingestion workflow
davidlougheed Nov 14, 2023
25956f1
fix(chord): fix some workflow tags
davidlougheed Nov 14, 2023
776267a
styling, docs updates
v-rocheleau Nov 15, 2023
99e5bb3
read metadata phenopacket version from data
v-rocheleau Nov 15, 2023
b4ff116
squash migrations, fix test data
v-rocheleau Nov 15, 2023
ad5a52c
add interpretations test data
v-rocheleau Nov 15, 2023
bb2d9d5
test coverage increase with test data
v-rocheleau Nov 16, 2023
0ba84b6
phenopacket_schema_version enum versions validation
v-rocheleau Nov 16, 2023
6203a6b
increase interpretation filter test coverage
v-rocheleau Nov 16, 2023
e8482d1
remove hts file, clean phenopacket migrations
v-rocheleau Nov 16, 2023
379d0e7
variant interpretation tests
v-rocheleau Nov 16, 2023
c406c4f
fix(chord): correct WDL file for document ingest
davidlougheed Nov 17, 2023
e87df86
fix(chord): spurious run dir inputs for document/readset wdls
davidlougheed Nov 17, 2023
a0c1a33
experiment version migration, biosample api update test
v-rocheleau Nov 17, 2023
975fdd3
Merge remote-tracking branch 'origin/features/phenov2-1394' into chor…
davidlougheed Nov 17, 2023
d1980ae
chore!: remove 'fake' data types + add cbioportal tag to rel. wfs
davidlougheed Nov 17, 2023
b12c08b
fix(chord): tag should be lowercase
davidlougheed Nov 17, 2023
db3a102
fix(chord): add access token param to cbioportal export
davidlougheed Nov 20, 2023
aad8cb5
individual filter search for phenopacket interpretations and nested e…
v-rocheleau Nov 20, 2023
f54adb2
chore(chord): add validate_ssl config for workflows
davidlougheed Nov 20, 2023
e6d50d6
docs, example files updates, warn for phenopacket files ingestion
v-rocheleau Nov 20, 2023
bdeaa62
lint
v-rocheleau Nov 20, 2023
0cd8a9e
chore: update to bento_lib 10.0.0
davidlougheed Nov 20, 2023
efa01cd
remove ingest mcode script and example files
v-rocheleau Nov 20, 2023
35e8304
chore(chord): fix readset workflow + fail with body on non-2XX response
davidlougheed Nov 20, 2023
8a9a7af
lint
davidlougheed Nov 20, 2023
bc4afff
Merge remote-tracking branch 'origin/features/phenov2-1394' into chor…
davidlougheed Nov 20, 2023
6ab2ed8
factor out command data types function dicts
v-rocheleau Nov 20, 2023
81a24bc
Merge pull request #457 from bento-platform/chore/new-workflows
davidlougheed Nov 20, 2023
9d4cc0a
Merge branch 'develop' into features/phenov2-1394
v-rocheleau Nov 21, 2023
a45d05c
update version to 6.0.0
v-rocheleau Nov 21, 2023
e51936a
migrations v6.0.0
v-rocheleau Nov 22, 2023
1681e7d
remove remaining genes model code, formating and code/comments cleanup
v-rocheleau Nov 24, 2023
4e8e763
interpretations cleanup
v-rocheleau Nov 24, 2023
fcc5268
add Biosample.derived_from_id and GenomicInterpretation subject/biosa…
v-rocheleau Nov 27, 2023
486d2b8
compute geno interp subject_or_biosample_id, update geno interp searc…
v-rocheleau Nov 27, 2023
9cdfad5
search schemas updates
v-rocheleau Nov 28, 2023
afb5bb8
bento-lib 10.1.1
v-rocheleau Nov 28, 2023
7dea81b
factor out verbose jsonb from search schemas
v-rocheleau Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export SERVICE_SECRET_KEY=some_secret_key
export POSTGRES_DATABASE=
export POSTGRES_USER=
export POSTGRES_PASSWORD=

# Should only need to use a host or socket dir
export POSTGRES_HOST=
export POSTGRES_SOCKET_DIR=
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
pull_request:
branches:
- develop
- 'features/**'
push:
branches:
- develop
Expand All @@ -24,7 +25,7 @@ jobs:
submodules: "recursive"

- name: Run Bento build action
uses: bento-platform/bento_build_action@v0.11.0
uses: bento-platform/bento_build_action@v0.11.1
with:
registry: ghcr.io
registry-username: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: "3.8"
python-version: "3.10"
- name: Install flake8
run: python -m pip install flake8
- name: Run linter
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- master
pull_request:
branches:
- 'features/**'
- develop
- master

Expand All @@ -16,10 +17,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10"]
python-version: ["3.10", "3.11"]
services:
postgres:
image: postgres:13
image: postgres:15
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -29,7 +30,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -43,6 +44,6 @@ jobs:
- name: Test
run: |
export POSTGRES_USER="postgres" && export POSTGRES_PASSWORD="postgres" && export POSTGRES_PORT=5432
coverage run ./manage.py test
poetry run coverage run ./manage.py test
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ __pycache__/
# sqlite
/*.sqlite3

#PostgreSQL
postgres/

# migrations
patients/migrations/*

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "chord_metadata_service/dats"]
path = chord_metadata_service/dats
url = https://github.com/datatagsuite/schema
[submodule "chord_metadata_service/vrs"]
path = chord_metadata_service/vrs
url = https://github.com/ga4gh/vrs
83 changes: 57 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,30 @@ A Phenopackets-based clinical and phenotypic metadata service for the Bento plat

## Table of Contents

* [License](#license)
* [Funding](#funding)
* [Architecture](#architecture)
* [REST API Highlights](#rest-api-highlights)
* [Install](#install)
* [Authentication](#authentication)
* [Note on Permissions](#note-on-permissions)
* [Authorization inside CanDIG](#authorization-inside-candig)
* [Developing](#developing)
* [Branching](#branching)
* [Tests](#tests)
* [Terminal Commands](#terminal-commands)
* [Project/Dataset/Table/Ingestion Commands](#projectdatasettableingestion-commands)
* [Patient Commands](#patient-commands)
* [Phenopacket Commands](#phenopacket-commands)
* [Accessing the Django Shell from inside a Bento Container](#accessing-the-django-shell-from-inside-a-bento-container)
* [Configuring Public overview and public search fields](#configuring-public-overview-and-public-search-fields)
- [Katsu Metadata Service](#katsu-metadata-service)
- [Table of Contents](#table-of-contents)
- [License](#license)
- [Funding](#funding)
- [Architecture](#architecture)
- [REST API highlights](#rest-api-highlights)
- [Install](#install)
- [Install via Docker](#install-via-docker)
- [Environment Variables](#environment-variables)
- [Standalone PostGres db and AdMiner](#standalone-postgres-db-and-adminer)
- [Authentication](#authentication)
- [Note on Permissions](#note-on-permissions)
- [Authorization inside CanDIG](#authorization-inside-candig)
- [Developing](#developing)
- [Branching](#branching)
- [Tests](#tests)
- [Terminal Commands](#terminal-commands)
- [Project/Dataset/Table/Ingestion Commands](#projectdatasettableingestion-commands)
- [Patient Commands](#patient-commands)
- [Phenopacket Commands](#phenopacket-commands)
- [Accessing the Django Shell from inside a Bento Container](#accessing-the-django-shell-from-inside-a-bento-container)
- [When running Katsu with `bentoV2`:](#when-running-katsu-with-bentov2)
- [When running Katsu with `chord_singularity` (DEPRECATED)](#when-running-katsu-with-chord_singularity-deprecated)
- [Configuring public overview and public search fields](#configuring-public-overview-and-public-search-fields)

## License

Expand Down Expand Up @@ -92,10 +99,9 @@ git submodule update --init

The service uses PostgreSQL database for data storage.

* Create and activate virtual environment
* Install Poetry (for dependency management) in the virtual environment: `pip install poetry`
* Install dependencies with `poetry install`
* To configure the application (such as the DB credentials) we are using python-dotenv:
* Install Poetry (for dependency management): `pip install poetry`
* Install dependencies with `poetry install`, which manages its own virtual environment
* To configure the application (such as the DB credentials) we are using `python-dotenv`:
- Take a look at the .env-sample file at the root of the project
- You can export these in your virtualenv or simply `cp .env-sample .env`
- `python-dotenv` can handle either (a local .env will override environment variables though)
Expand All @@ -104,18 +110,20 @@ The service uses PostgreSQL database for data storage.
* Run:

```
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
poetry run python manage.py makemigrations
poetry run python manage.py migrate
poetry run python manage.py runserver
```

* Development server runs at `localhost:8000`


### Install via Docker

Optionally, you may also install standalone Katsu with the Dockerfile provided. If you develop or
deploy Katsu as part of the Bento platform, you should use Bento's Docker image instead.
Optionally, you may also install standalone Katsu with the Dockerfile provided. If you develop or deploy Katsu as
part of the Bento platform, you should use Bento's Docker
[image](https://github.com/bento-platform/katsu/pkgs/container/katsu) instead.



## Environment Variables
Expand Down Expand Up @@ -162,6 +170,29 @@ CANDIG_OPA_SITE_ADMIN_KEY=
INSIDE_CANDIG=
```

## Standalone Postgres db and Adminer

For local development, you can quickly deploy a local database server (Postgres) and management tool (Adminer) with
`docker compose`. Make sure your Postgres env variables are set in `.env` before running:

```
# Start docker compose containers
docker compose -f docker-compose.dev.yaml up -d

# Stop and remove docker-compose containers
docker compose -f docker-compose.dev.yaml down
```

You can now use the katsu-db container (`localhost:5432`) as your database for standalone katsu development and
explore the database tables with adminer (`localhost:8080`).
Login to adminer by specifying the following on the login page:

- **System:** `PostgreSQL`
- **Server:** `katsu-db` (host and port are resolved by Docker with the container name)
- **Username:** `POSTGRES_USER`
- **Password:** `POSTGRES_PASSWORD`
- **Database:** `POSTGRES_DATABASE`

## Authentication

Default authentication can be set globally in `settings.py`
Expand Down
8 changes: 4 additions & 4 deletions bento.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.03.22
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.10.20

SHELL ["/bin/bash", "-c"]

Expand All @@ -7,17 +7,17 @@ SHELL ["/bin/bash", "-c"]
RUN apt-get update -y && \
apt-get install -y postgresql-client && \
rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir "uvicorn[standard]==0.20.0"
pip install --no-cache-dir "uvicorn[standard]==0.23.2"

# Backwards-compatible with old BentoV2 container layout
WORKDIR /app

COPY pyproject.toml .
COPY poetry.lock .
COPY poetry.toml .

# Install production dependencies
RUN poetry install --no-root --without dev
RUN poetry config virtualenvs.create false && \
poetry install --no-root --without dev

# Copy all application code
COPY . .
Expand Down
11 changes: 7 additions & 4 deletions bento.dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.03.22
FROM ghcr.io/bento-platform/bento_base_image:python-debian-2023.10.20

LABEL org.opencontainers.image.description="Local development image for Katsu."
LABEL devcontainer.metadata='[{ \
Expand All @@ -18,19 +18,19 @@ SHELL ["/bin/bash", "-c"]
RUN apt-get update -y && \
apt-get install -y postgresql-client && \
rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir "uvicorn[standard]==0.20.0"
pip install --no-cache-dir "uvicorn[standard]==0.23.2"

# Backwards-compatible with old BentoV2 container layout
WORKDIR /app

COPY pyproject.toml .
COPY poetry.lock .
COPY poetry.toml .

# Install production + development dependencies
# Without --no-root, we get errors related to the code not being copied in yet.
# But we don't want the code here, otherwise Docker cache doesn't work well.
RUN poetry install --no-root
RUN poetry config virtualenvs.create false && \
poetry install --no-root

# Create temporary directory for downloading files etc.
RUN mkdir -p /app/tmp
Expand All @@ -39,5 +39,8 @@ RUN mkdir -p /app/tmp
COPY entrypoint.bash .
COPY run.dev.bash .

# Tell the service that we're running a local development container
ENV BENTO_CONTAINER_LOCAL=True

ENTRYPOINT [ "bash", "./entrypoint.bash" ]
CMD [ "bash", "./run.dev.bash" ]
23 changes: 0 additions & 23 deletions chord_metadata_service/chord/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@

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.experiments.schemas import EXPERIMENT_RESULT_SCHEMA

__all__ = [
"DATA_TYPE_EXPERIMENT",
"DATA_TYPE_EXPERIMENT_RESULT",
"DATA_TYPE_PHENOPACKET",
"DATA_TYPE_READSET",
"DATA_TYPES",
]


DATA_TYPE_EXPERIMENT = "experiment"
DATA_TYPE_EXPERIMENT_RESULT = "experiment_result"
DATA_TYPE_PHENOPACKET = "phenopacket"
DATA_TYPE_READSET = "readset"

DATA_TYPES = {
DATA_TYPE_EXPERIMENT: {
Expand All @@ -35,22 +30,4 @@
"type": "object", # TODO
},
},
DATA_TYPE_READSET: {
"label": "Readsets",
"queryable": False,
"schema": {
"file_format": EXPERIMENT_RESULT_SCHEMA["properties"]["file_format"]
},
"metadata_schema": {
"type": "object"
}
},
DATA_TYPE_EXPERIMENT_RESULT: {
"label": "Experiment Results",
"queryable": False,
"schema": EXPERIMENT_RESULT_SCHEMA,
"metadata_schema": {
"type": "object"
}
}
}
20 changes: 20 additions & 0 deletions chord_metadata_service/chord/ingest/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import Callable

from chord_metadata_service.chord.data_types import DATA_TYPE_EXPERIMENT, DATA_TYPE_PHENOPACKET
from chord_metadata_service.chord.ingest.experiments import ingest_experiments_workflow, validate_experiment
from chord_metadata_service.chord.ingest.phenopackets import ingest_phenopacket_workflow, validate_phenopacket

__all__ = [
"DATA_TYPE_TO_VALIDATOR_FN"
]


DATA_TYPE_TO_VALIDATOR_FN: dict[str, Callable] = {
DATA_TYPE_EXPERIMENT: validate_experiment,
DATA_TYPE_PHENOPACKET: validate_phenopacket,
}

DATA_TYPE_TO_INGESTION_FN: dict[str, Callable] = {
DATA_TYPE_EXPERIMENT: ingest_experiments_workflow,
DATA_TYPE_PHENOPACKET: ingest_phenopacket_workflow,
}
13 changes: 0 additions & 13 deletions chord_metadata_service/chord/ingest/mcode.py

This file was deleted.

Loading