HUB
Sign inSign up

akiel/lens-warehouse

By akiel

•Updated over 10 years ago

The data warehouse component of the Lens system.

Image
0

1.7K

akiel/lens-warehouse repository overview

Please start at the Top-Level Lens Repo⁠.

⁠Lens Warehouse Service

Build Status

The data warehouse service of the Lens system which is one of several backend services. The data warehouse service holds the medical study data which can be queried.

⁠Usage with Leiningen

To start the service with leiningen, run the following command

lein with-profile production,datomic-free trampoline run -h

This prints a help of all command line options. You need to specify at least a database URI. The database URI has to point to a Datomic Free Edition Database. If you like to use the Pro Edition, you have to use the datomic-pro leiningen profile instead of the datomic-free profile. An example database URI is:

datomic:free://localhost:4334/lens-warehouse

⁠Usage on Heroku Compatible PaaS

This application uses the following environment vars:

  • PORT - the port to listen on
  • DB_URI - the Datomic database URI
  • CONTEXT_PATH - an optional context path under which the warehouse service runs. Has to be empty for root context or start with a slash but not ending with a slash.
  • DATOMIC_EDITION - one of free or pro with a default of free
  • SEARCH_HOST - hostname of the Elastic Search Cluster
  • SEARCH_PORT - port of the Elastic Search Cluster (defaults to 9200)
  • SEARCH_INDEX - index to use in the Elastic Search Cluster

If you have foreman⁠ installed you can create an .env file listing the environment vars specified above and just type foreman start.

⁠Usage through Docker Container

You have to start a database volume container, a database container and a warehouse container linking them all together:

docker run --name lens-warehouse-db-vol akiel/lens-warehouse:db-latest
docker run -d --volumes-from lens-warehouse-db-vol -e ALT_HOST=lens-warehouse-db --name lens-warehouse-db akiel/datomic-free
docker run -d -p 8080:80 --link lens-warehouse-db:db --name lens-warehouse akiel/lens-warehouse

After starting all containers, a curl http://localhost:8080 should show the service document of Lens Warehouse.

⁠Development

First you need a running Datomic database. The easiest way to bring one up is the following:

docker run -d --name lens-warehouse-db -p 4334-4336:4334-4336 akiel/datomic-free

after that, create an .env file in the project root with the following content:

DB_URI=datomic:free://localhost:4334/lens-warehouse

now you can start a REPL with lein repl. After it is up, go into the user namespace which is located under dev. There is a comment block "Init Development". Just invoke the functions:

(startup)
(create-database)
(load-base-schema)

one after each other. You should be able to see the Warehouse service running at port 8080. If you like to specify a different port, you can do it in the .env file.

If you have already a database, a (startup) will be sufficient. If you make changes, a (reset) will reload the code. In order to get rid of the database, simply delete the Datomic container with docker rm -f datomic and start it again.

If you use Intellij IDEA⁠ with Cursive⁠, you can add a Datomic stub JAR to your project dependencies as described here⁠. The stub will provide signatures and documentation for the Datomic API functions. I can't add the stub dependency to the project.clj file because it is currently not available on Clojars. I opened an issue here⁠.

⁠Using Datomic Pro

You need a license to be able to use the Pro Edition of Datomic. The Leiningen project file contains two profiles, one for the Free Edition (datomic-free) and one for the Pro Edition (datomic-pro).

⁠Metadata Model

The metadata model used in Lens Warehouse is based on the CDISC ODM⁠ standard. The goal is to implement a sufficent subset of the ODM concepts to be able to import metadata from ODM files. Lens Warehouse will not directly contain an ODM importer. Instead there will be a command line client called lens-import⁠ which reads ODM files and uses the REST API of Lens Warehouse to create metadata entities.

You can find more in the ODM Section⁠ of the documentation.

⁠License

Copyright © 2015 Alexander Kiel

Distributed under the Eclipse Public License, the same as Clojure.

Tag summary
Recent tags
Content type
Image
Digest
sha256:8a7ec0c65…
Size
268.5 MB
Last updated
about 11 years ago
docker pull akiel/lens-warehouse:latest