Skip to content

Commit

Permalink
Resolve #13
Browse files Browse the repository at this point in the history
  • Loading branch information
nutjob4life committed Jun 9, 2021
1 parent 9b1e612 commit 21b5e8c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 36 deletions.
33 changes: 9 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Here are the environment variables you'll need to set (substituting values betwe
- `EDRN_CANCERDATAEXPO_DATA` — set to a path to contain blobstorage, filestorage, and logs.
- `EDRN_CANCERDATAEXPO_PORT` — set to a free port number
- `EDRN_CANCERDATAEXPO_VERSION` — set to a version number of `latest`
- `EDRN_IMAGE_OWNER` — set to `nutjob4life` or leave it blank to use your local Docker containers


### 🧱 Building the Image
Expand Down Expand Up @@ -89,19 +90,16 @@ To run the CancerDataExpo for the **first time**, create empty directories to ho
--project-name cancerdataexpo \
up --detach

The `docker-compose.yaml` assumes that `EDRN_CANCERDATAEXPO_DATA` is `usr/local/labcas/cancerdataexpo/docker-data` which is appropriate for `edrn-docker.jpl.nasa.gov` where this normally runs, and that `EDRN_CANCERDATAEXPO_PORT` is 2131, and that `EDRN_CANCERDATAEXPO_VERSION` is `latest`, so you can simply say:

docker-compose --project-name cancerdataexpo up --detach

You can check the logs with:

env \
EDRN_CANCERDATAEXPO_DATA=/usr/local/labcas/cancerdataexpo/docker-data \
EDRN_CANCERDATAEXPO_VERSION=latest \
EDRN_CANCERDATAEXPO_PORT=2131 \
docker-compose \
--project-name cancerdataexpo \
logs --follow
docker-compose --project-name cancerdataexpo logs --follow

**📝 Note:** With no existing database, the initiall startup might fail (see the logs, message "Resource Busy"). If this happens, stop it and start it again.


Once this is up and running, head to http://localhost:${EDRN_CANCERDATAEXPO_PORT}/manage_main and log in (with username `admin` and password `admin`) and change the default password in the `acl_users` object. Next, create an instance of the CancerDataExpo by visiting http://localhost:${EDRN_CANCERDATAEXPO_PORT}/@@plone-addsite?site_id=Plone&advanced=1 and entering the following:

- Path identifier: `cancerdataexpo`
Expand All @@ -123,25 +121,14 @@ Then click "Save". Lastly, head to the RDF Generators and give the LabCAS genera

Need to bring it all down?

env \
EDRN_CANCERDATAEXPO_DATA=/usr/local/labcas/cancerdataexpo/docker-data \
EDRN_CANCERDATAEXPO_VERSION=latest \
EDRN_CANCERDATAEXPO_PORT=2131 \
docker-compose \
--project-name cancerdataexpo \
down
docker-compose --project-name cancerdataexpo down


### 🎽 Subsequent Runs

Start it up again?

env \
EDRN_CANCERDATAEXPO_DATA=/usr/local/labcas/cancerdataexpo/docker-data \
EDRN_CANCERDATAEXPO_VERSION=latest \
EDRN_CANCERDATAEXPO_PORT=2131 \
docker-compose \
--project-name cancerdataexpo \
up --detach
docker-compose --project-name cancerdataexpo up --detach


#### 🐛 Advanced Debugging
Expand All @@ -160,5 +147,3 @@ Add a Manager user (not through the web, like above):
Get a shell:

docker container run --volume ${EDRN_CANCERDATAEXPO_DATA}/blobstorage:/data/blobstorage --tty --rm --interactive --network cancerdataexpo_frontsidebus --entrypoint /bin/bash cancerdataexpo:latest


18 changes: 8 additions & 10 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
---
services:
appserver:
# image: cancerdataexpo:${EDRN_CANCERDATAEXPO_VERSION:-latest}
image: nutjob4life/cancerdataexpo:${EDRN_CANCERDATAEXPO_VERSION:-latest}
image: ${EDRN_IMAGE_OWNER-nutjob4life/}cancerdataexpo:${EDRN_CANCERDATAEXPO_VERSION:-latest}
volumes:
-
type: bind
source: ${EDRN_CANCERDATAEXPO_DATA}/blobstorage
source: ${EDRN_CANCERDATAEXPO_DATA:-/usr/local/labcas/cancerdataexpo/docker-data}/blobstorage
target: /data/blobstorage
consistency: consistent
-
type: bind
source: ${EDRN_CANCERDATAEXPO_DATA}/log
source: ${EDRN_CANCERDATAEXPO_DATA:-/usr/local/labcas/cancerdataexpo/docker-data}/log
target: /data/log
consistency: delegated
ports:
Expand All @@ -41,23 +40,22 @@ services:
org.label-schema.name: CancerDataExpo Application Server
org.label-schema.description: Zope appserver running the exposition for cancer data.
db:
# image: cancerdataexpo:${EDRN_CANCERDATAEXPO_VERSION:-latest}
image: nutjob4life/cancerdataexpo:${EDRN_CANCERDATAEXPO_VERSION:-latest}
image: ${EDRN_IMAGE_OWNER-nutjob4life/}cancerdataexpo:${EDRN_CANCERDATAEXPO_VERSION:-latest}
command: zeo
volumes:
-
type: bind
source: ${EDRN_CANCERDATAEXPO_DATA}/filestorage
source: ${EDRN_CANCERDATAEXPO_DATA:-/usr/local/labcas/cancerdataexpo/docker-data}/filestorage
target: /data/filestorage
consistency: consistent
-
type: bind
source: ${EDRN_CANCERDATAEXPO_DATA}/blobstorage
source: ${EDRN_CANCERDATAEXPO_DATA:-/usr/local/labcas/cancerdataexpo/docker-data}/blobstorage
target: /data/blobstorage
consistency: consistent
-
type: bind
source: ${EDRN_CANCERDATAEXPO_DATA}/log
source: ${EDRN_CANCERDATAEXPO_DATA:-/usr/local/labcas/cancerdataexpo/docker-data}/log
target: /data/log
consistency: delegated
networks:
Expand All @@ -72,7 +70,7 @@ services:
org.label-schema.name: CancerDataExpo DB Server
org.label-schema.description: Zope Enterprise Objects DB server for the cancer data exposition.
memory-cache:
image: memcached
image: memcached:1.6.9-alpine
networks:
- frontsidebus
restart: on-failure
Expand Down
18 changes: 16 additions & 2 deletions src/edrn.rdf/edrn/rdf/dmccprotocolrdfgenerator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# encoding: utf-8
# Copyright 2012 California Institute of Technology. ALL RIGHTS
# Copyright 2012–2021 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.

'''DMCC Protocol RDF Generator. An RDF generator that describes EDRN protocols using the DMCC's bungling web services.
Expand Down Expand Up @@ -178,6 +178,12 @@ class IDMCCProtocolRDFGenerator(IRDFGenerator):
description=_('Uniform Resource Identifier for the cancer type predicate.'),
required=True,
)
cancerTypeURIPrefix = schema.TextLine(
title=_('Disease URI Prefix'),
description=_('URI prefix to identity Disease objects for the cancer type studied by a protocol.'),
required=True,
default='http://edrn.nci.nih.gov/data/diseases/'
)
commentsURI = schema.TextLine(
title=_('Comments URI'),
description=_('Uniform Resource Identifier for the comments predicate.'),
Expand Down Expand Up @@ -412,7 +418,6 @@ def addToGraph(self, graph, context):
'Protocol_Aims': 'aimsURI',
'Protocol_Analytic_Method': 'analyticMethodURI',
'Protocol_Blinding': 'blindingURI',
'Protocol_Cancer_Type': 'cancerTypeURI',
'Protocol_Collaborative_Group': 'collaborativeGroupTextURI',
'Protocol_Comments': 'commentsURI',
'Protocol_Data_Sharing_Plan': 'dataSharingPlanURI',
Expand Down Expand Up @@ -484,13 +489,22 @@ def _addMiscFields(self, graph, context):
if not obj: continue
predicateURI = URIRef(getattr(context, predicateFieldName))
graph.add((subjectURI, predicateURI, Literal(obj)))
def _addCancerTypes(self, graph, context):
subjectURI, predicateURI = self.getSubjectURI(context), URIRef(context.cancerTypeURI)
values = self.slots.get('Protocol_Cancer_Type', '')
for value in values.strip().split(', '):
value = value.strip()
if value:
graph.add((subjectURI, predicateURI, URIRef(context.cancerTypeURIPrefix + value)))
def addToGraph(self, graph, specifics, context):
self._addInvolvedInvestigatorSites(graph, specifics, context)
self._addOtherSites(graph, context)
self._addPublications(graph, context)
self._addFieldsOfResearch(graph, context)
self._addCancerTypes(graph, context)
self._addMiscFields(graph, context)


_specificsMap = {
'Animal_Subject_Training_Received': 'animalTraining',
'Human_Subject_Training_Recieved': 'humanTraining',
Expand Down

0 comments on commit 21b5e8c

Please sign in to comment.