Skip to content

Commit c39a741

Browse files
24.08.08 (#343)
* BCO scoring changes * Add New Production Deployment md Changes to be committed: deleted: docs/bco_scores.json modified: docs/deployment/productionDeployment.md new file: docs/newProductionInstance.md * Update config.md * Add API endpoint for basic comaprison Changes to be committed: modified: biocompute/apis.py modified: biocompute/urls.py modified: requirements.txt * Fix Django CI issue (#340) biocompute-objects/portal_userdb#380 Changes to be committed: modified: .github/workflows/django.yml modified: biocompute/apis.py modified: biocompute/models.py modified: config/settings.py modified: config/urls.py * Update to BcoValidator.load_schema (#341) Updated the function to check locally for the most used schemas. Improves testing and speed in BCO validation. Changes to be committed: modified: biocompute/services.py renamed: config/IEEE/2791object.json -> config/schemas/2791object.json new file: config/schemas/dataset_extension.json renamed: config/IEEE/description_domain.json -> config/schemas/description_domain.json renamed: config/IEEE/error_domain.json -> config/schemas/error_domain.json renamed: config/IEEE/execution_domain.json -> config/schemas/execution_domain.json new file: config/schemas/fhir_extension.json new file: config/schemas/galaxy_extension.json renamed: config/IEEE/io_domain.json -> config/schemas/io_domain.json new file: config/schemas/license_extension.json renamed: config/IEEE/parametric_domain.json -> config/schemas/parametric_domain.json renamed: config/IEEE/provenance_domain.json -> config/schemas/provenance_domain.json new file: config/schemas/scm_extension.json renamed: config/IEEE/usability_domain.json -> config/schemas/usability_domain.json * Add additional schema files and reorganize Changes to be committed: modified: biocompute/services.py new file: config/schemas/1.1.0/dataset_extension.json new file: config/schemas/1.1.0/fhir_extension.json new file: config/schemas/1.1.0/galaxy_extension.json new file: config/schemas/1.1.0/license_extension.json new file: config/schemas/1.1.0/scm_extension.json renamed: config/schemas/dataset_extension.json -> config/schemas/1.2.0/dataset_extension.json renamed: config/schemas/fhir_extension.json -> config/schemas/1.2.0/fhir_extension.json renamed: config/schemas/galaxy_extension.json -> config/schemas/1.2.0/galaxy_extension.json renamed: config/schemas/license_extension.json -> config/schemas/1.2.0/license_extension.json renamed: config/schemas/scm_extension.json -> config/schemas/1.2.0/scm_extension.json renamed: config/schemas/2791object.json -> config/schemas/2791/2791object.json renamed: config/schemas/description_domain.json -> config/schemas/2791/description_domain.json renamed: config/schemas/error_domain.json -> config/schemas/2791/error_domain.json renamed: config/schemas/execution_domain.json -> config/schemas/2791/execution_domain.json renamed: config/schemas/io_domain.json -> config/schemas/2791/io_domain.json renamed: config/schemas/parametric_domain.json -> config/schemas/2791/parametric_domain.json renamed: config/schemas/provenance_domain.json -> config/schemas/2791/provenance_domain.json renamed: config/schemas/usability_domain.json -> config/schemas/2791/usability_domain.json modified: config/settings.py modified: requirements.txt * Add instructions for Docker deployment Changes to be committed: modified: Dockerfile modified: docker-compose.yml modified: docs/deployment/dockerDeployment.md new file: entrypoint.sh --------- Co-authored-by: Kiran Sen <[email protected]> Co-authored-by: Kiran Sen <[email protected]>
1 parent 4efc685 commit c39a741

28 files changed

+728
-63
lines changed

.github/workflows/django.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ jobs:
2424
run: |
2525
python -m pip install --upgrade pip
2626
pip install -r requirements.txt
27-
- name: Create .secret file
28-
run: |
29-
echo "${{ secrets.PORTAL_USERDB_SECRET }}" > server/.secret
27+
3028
- name: Run Tests
3129
run: |
3230
python3.9 manage.py test

Dockerfile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,22 @@ LABEL org.opencontainers.image.source=https://github.com/octocat/my-repo
66
LABEL org.opencontainers.image.description="My container image"
77
LABEL org.opencontainers.image.licenses=MIT
88

9-
# Note that this is just for debug / test purposes; should not be set via the setup for production
10-
# ENV DJANGO_SUPERUSER_PASSWORD="BioCompute123"
11-
# ENV DJANGO_SUPERUSER_USERNAME="BioComputeSuperUser"
12-
# ENV DJANGO_SUPERUSER_EMAIL="[email protected]"
139

1410
RUN apt-get -qq update && apt-get install -y python3.9 python3-dev python3-pip
1511

1612
RUN python3 -m pip install --upgrade pip
1713

1814
WORKDIR /biocompute_api
1915

20-
COPY requirements.txt .
21-
16+
COPY requirements.txt /biocompute_api/
2217
RUN python3 -m pip install -r requirements.txt
2318

24-
COPY . ./
25-
26-
WORKDIR /biocompute_api/
19+
COPY . /biocompute_api/
2720

28-
# RUN python3 manage.py migrate
29-
# RUN python3 manage.py createsuperuser --no-input
21+
WORKDIR /biocompute_api
3022

3123
EXPOSE 8000
32-
#CMD ["bash"]
33-
ENTRYPOINT ["python3", "manage.py", "runserver"]
34-
CMD ["0.0.0.0:8000"]
24+
25+
ENTRYPOINT ["./entrypoint.sh"]
26+
27+
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]

biocompute/apis.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ def post(self, request) -> Response:
244244
data=bco_results
245245
)
246246

247-
import pdb; pdb.set_trace()
248247
return Response(status=status.HTTP_200_OK, data=response_data)
249248

250249
# for index, object in enumerate(data):
@@ -307,7 +306,6 @@ def post(self, request) -> Response:
307306
# continue
308307

309308
# bco_results = validator.parse_and_validate(bco_instance.contents)
310-
# import pdb; pdb.set_trace()
311309
# identifier, results = bco_results.popitem()
312310

313311
# if results["number_of_errors"] > 0:
@@ -499,7 +497,7 @@ def post(self, request) -> Response:
499497
message=message,
500498
data=results
501499
))
502-
500+
503501
status_code = response_status(accepted_requests, rejected_requests)
504502
return Response(status=status_code, data=response_data)
505503

biocompute/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
]
2020

2121
class Bco(models.Model):
22-
"""BioComput Object Model.
22+
"""BioCompute Object Model.
2323
2424
Attributes:
2525
-----------

biocompute/services.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,25 @@ def load_schema(schema_uri):
5050
Returns:
5151
- dict: The loaded JSON schema.
5252
"""
53+
schema_mapping = {
54+
"https://w3id.org/ieee/ieee-2791-schema/2791object.json": f"{BASE_DIR}/config/schemas/2791/2791object.json",
55+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.1.0/dataset/dataset_extension.json": f"{BASE_DIR}/config/schemas/1.1.0/dataset_extension.json",
56+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.1.0/fhir/fhir_extension.json": f"{BASE_DIR}/config/schemas/1.1.0/fhir_extension.json",
57+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.1.0/galaxy/galaxy_extension.json": f"{BASE_DIR}/config/schemas/1.1.0/galaxy_extension.json",
58+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.1.0/license/license_extension.json": f"{BASE_DIR}/config/schemas/1.1.0/license_extension.json",
59+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.1.0/scm/scm_extension.json": f"{BASE_DIR}/config/schemas/1.1.0/scm_extension.json",
60+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.2.0/dataset/dataset_extension.json": f"{BASE_DIR}/config/schemas/1.2.0/dataset_extension.json",
61+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.2.0/fhir/fhir_extension.json": f"{BASE_DIR}/config/schemas/1.2.0/fhir_extension.json",
62+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.2.0/galaxy/galaxy_extension.json": f"{BASE_DIR}/config/schemas/1.2.0/galaxy_extension.json",
63+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.2.0/license/license_extension.json": f"{BASE_DIR}/config/schemas/1.2.0/license_extension.json",
64+
"https://raw.githubusercontent.com/biocompute-objects/extension_domain/1.2.0/scm/scm_extension.json": f"{BASE_DIR}/config/schemas/1.2.0/scm_extension.json"
65+
}
5366

54-
if schema_uri == \
55-
"https://w3id.org/ieee/ieee-2791-schema/2791object.json":
56-
return jsonref.load_uri(
57-
f"file://{BASE_DIR}/config/IEEE/2791object.json"
58-
)
67+
if schema_uri in schema_mapping:
68+
print(schema_uri in schema_mapping, schema_uri)
69+
return jsonref.load_uri(f"file://{schema_mapping[schema_uri]}")
70+
else:
71+
print(schema_uri in schema_mapping, schema_uri)
5972
try:
6073
return jsonref.load_uri(schema_uri)
6174
except (JSONDecodeError, TypeError, RequestsConnectionError) as e:
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://www.w3id.org/biocompute/extension_domain/1.1.0/dataset/dataset_extension.json",
4+
"title": "dataset_extension",
5+
"type": "object",
6+
"description": "The external references extension to list additional licenses and dataset catagories for a dataset BCO (dsBCO).",
7+
"required": ["dataset_extension", "extension_schema"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"dataset_extension": {
11+
"type": "object",
12+
"additionalProperties": false,
13+
"required": ["dataset_categories"],
14+
"properties": {
15+
"additional_license": {
16+
"type": "object",
17+
"description": "The additional license property contains the details about the licenses applied to the dataset and the script or tool/software used to process the given dataset.",
18+
"additionalProperties": false,
19+
"properties": {
20+
"data_license": {
21+
"title": "data_license",
22+
"type": "string",
23+
"description": "The license applied to the data or the dataset by the author",
24+
"examples": [
25+
"https://creativecommons.org/licenses/by/4.0/"
26+
]
27+
},
28+
"script_license": {
29+
"title": "script_license",
30+
"type": "string",
31+
"description": "The license applied to the computational script or the tool/software developed to process (parse, QC, align) the input dataset for a final output dataset.",
32+
"examples": [
33+
"https://www.gnu.org/licenses/gpl-3.0.en.html"
34+
]
35+
}
36+
}
37+
},
38+
"dataset_categories": {
39+
"title": "dataset_categories",
40+
"type": "array",
41+
"description": "Dataset categories describe and provide more information about the dataset which can be used to classify, group, sort and filter datasets.",
42+
"items": {
43+
"required": [
44+
"category_value",
45+
"category_name"
46+
],
47+
"additionalProperties": false,
48+
"properties": {
49+
"category_value": {
50+
"type": "string",
51+
"title": "category_value",
52+
"description": "An explanation about the purpose of this instance.",
53+
"examples": [
54+
"Homo sapiens"
55+
]
56+
},
57+
"category_name": {
58+
"type": "string",
59+
"title": "category_name",
60+
"description": "An explanation about the purpose of this instance.",
61+
"enum": [
62+
"species",
63+
"molecule",
64+
"tag",
65+
"file_type",
66+
"status",
67+
"scope"
68+
]
69+
}
70+
}
71+
}
72+
}
73+
}
74+
},
75+
"extension_schema": {
76+
"title": "extension_schema",
77+
"type": "string",
78+
"format": "uri",
79+
"description": "The schema applied to the extension object",
80+
"examples": [
81+
"http://www.w3id.org/biocompute/extension_domain/example.json"
82+
]
83+
84+
}
85+
}
86+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://w3id.org/biocompute/extension_domain/1.1.0/fhir/fhir_extension.json",
4+
"title": "fhir_extension",
5+
"type": "object",
6+
"description": "The external references extension to FHIR resource",
7+
"required": ["fhir_extension", "extension_schema"],
8+
"additionalProperties": false,
9+
"properties":{
10+
"extension_schema": {
11+
"title": "extension_schema",
12+
"type": "string",
13+
"format": "uri",
14+
"description": "The schema applied to the extension object",
15+
"examples": [
16+
"http://www.w3id.org/biocompute/extension_domain/example.json"
17+
]
18+
19+
},
20+
"fhir_extension":{
21+
"title": "",
22+
"type": "array",
23+
"decription": "",
24+
"items": {
25+
"required": [
26+
"fhir_endpoint",
27+
"fhir_version",
28+
"fhir_resources"
29+
],
30+
"properties": {
31+
"fhir_endpoint": {
32+
"type": "string",
33+
"description": "Base URI of FHIR server where the resources are stored",
34+
"examples": [
35+
"http://fhirtest.uhn.ca/baseDstu3"
36+
],
37+
"format": "uri"
38+
},
39+
"fhir_version": {
40+
"type": "string",
41+
"description": "FHIR version of the server endpoint"
42+
},
43+
"fhir_resources": {
44+
"type": "array",
45+
"items": {
46+
"type": "object",
47+
"required": [
48+
"fhir_resource",
49+
"fhir_id"
50+
],
51+
"properties": {
52+
"fhir_resource": {
53+
"type": "string",
54+
"description": "Type of FHIR resource used"
55+
},
56+
"fhir_id": {
57+
"type": "string",
58+
"description": "Server-specific identifier string"
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://www.w3id.org/biocompute/extension_domain/1.1.0/galaxy/galaxy_extension.json",
4+
"title": "galaxy_extension",
5+
"type": "object",
6+
"description": "The external references **example** extension for a Galaxy BCO.",
7+
"required": ["galaxy_extension", "extension_schema"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"extension_schema": {
11+
"type": "string",
12+
"format": "uri",
13+
"description": "The schema applied to the extension object",
14+
"examples": [
15+
"http://www.w3id.org/biocompute/extension_domain/example.json"
16+
]
17+
18+
},
19+
"galaxy_extension": {
20+
"type": "object",
21+
"required": [
22+
"galaxy_url",
23+
"galaxy_version"
24+
],
25+
"properties": {
26+
"galaxy_url": {
27+
"type": "string",
28+
"description": "The base url for the galaxy instance used to create the BioCompute Object.",
29+
"examples": [
30+
"https://galaxy.aws.biochemistry.gwu.edu/"
31+
],
32+
"format": "uri"
33+
},
34+
"galaxy_version": {
35+
"type": "string",
36+
"description": "The specific version of the Galaxy software used to generate the BioCompute Object.",
37+
"examples": [
38+
"20.01"
39+
]
40+
}
41+
}
42+
}
43+
}
44+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://www.w3id.org/biocompute/extension_domain/1.1.0/license/license_extension.json",
4+
"type": "object",
5+
"description": "The extension to add additional licenses.",
6+
"required": ["licence_extension", "extension_schema"],
7+
"additionalProperties": false,
8+
"properties":{
9+
"extension_schema": {
10+
"title": "extension_schema",
11+
"type": "string",
12+
"format": "uri",
13+
"description": "The schema applied to the extension object",
14+
"examples": [
15+
"http://www.w3id.org/biocompute/extension_domain/example.json"
16+
]
17+
},
18+
"licence_extension":{
19+
"required": [
20+
"data_license",
21+
"scripts_license"
22+
],
23+
"properties": {
24+
"data_license": {
25+
"type": "string",
26+
"examples": [
27+
"https://github.com/example/repo1"
28+
],
29+
"format": "uri"
30+
},
31+
"scripts_license": {
32+
"type": "string",
33+
"examples": [
34+
"https://github.com/example/repo1"
35+
],
36+
"format": "uri"
37+
}
38+
}
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)