gsp-core-model


License

License

GroupId

GroupId

edu.gemini
ArtifactId

ArtifactId

gsp-core-model_sjs1_2.13
Last Version

Last Version

0.2.8
Release Date

Release Date

Type

Type

jar
Description

Description

gsp-core-model
gsp-core-model
Project URL

Project URL

https://github.com/gemini-hlsw/gsp-core
Project Organization

Project Organization

Association of Universities for Research in Astronomy, Inc. (AURA)
Source Code Management

Source Code Management

https://github.com/gemini-hlsw/gsp-core

Download gsp-core-model_sjs1_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/edu.gemini/gsp-core-model_sjs1_2.13/ -->
<dependency>
    <groupId>edu.gemini</groupId>
    <artifactId>gsp-core-model_sjs1_2.13</artifactId>
    <version>0.2.8</version>
</dependency>
// https://jarcasting.com/artifacts/edu.gemini/gsp-core-model_sjs1_2.13/
implementation 'edu.gemini:gsp-core-model_sjs1_2.13:0.2.8'
// https://jarcasting.com/artifacts/edu.gemini/gsp-core-model_sjs1_2.13/
implementation ("edu.gemini:gsp-core-model_sjs1_2.13:0.2.8")
'edu.gemini:gsp-core-model_sjs1_2.13:jar:0.2.8'
<dependency org="edu.gemini" name="gsp-core-model_sjs1_2.13" rev="0.2.8">
  <artifact name="gsp-core-model_sjs1_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='edu.gemini', module='gsp-core-model_sjs1_2.13', version='0.2.8')
)
libraryDependencies += "edu.gemini" % "gsp-core-model_sjs1_2.13" % "0.2.8"
[edu.gemini/gsp-core-model_sjs1_2.13 "0.2.8"]

Dependencies

compile (7)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.3
org.scala-js : scalajs-library_2.13 jar 1.1.1
co.fs2 : fs2-core_sjs1_2.13 jar 2.4.2
edu.gemini : gsp-math_sjs1_2.13 jar 0.2.7
com.github.julien-truffaut : monocle-core_sjs1_2.13 jar 2.0.5
com.github.julien-truffaut : monocle-macro_sjs1_2.13 jar 2.0.5
edu.gemini : gemini-locales_sjs1_2.13 jar 0.5.0

test (1)

Group / Artifact Type Version
org.scala-js : scalajs-test-bridge_2.13 jar 1.1.1

Project Modules

There are no modules declared in this project.

gsp-core

Core schema and data model for GSP.

Artifact Platform(s) Description
gsp-core-model JVM+JS, Scala 2.12 GSP core data model.
gsp-core-testkit JVM+JS, Scala 2.12 GSP core laws and arbitraries.
gsp-core-ocs2-api JVM+JS, Scala 2.12 OCS2 PIO parsers for GSP core data model.

In addition, this library builds and tests (but does not publish) core database bindings, epheris parsing, and OCS2 program import functionality. These modules will be moved into application projects as GSP progresses.

Setting Up a Local Database

In order to build and run tests you will need a Postgres database running locally. There are two ways to do this.

Option 1: Postgres in Docker

This option is what's used in CI and is what you want if you're ok starting over with an empty database when things change. It does not require you to install or administer your own Postgres instance. Make sure you have Docker installed, then you can use the included docker-compose file. In the project root run:

docker-compose up -d

This will start a new Postgres database initialized with the schema defined in the schema project, configured as follows.

Parameter Value Notes
Port 5432 This is the standard port.
Database gem
User postgres
Password (none)

If you have psql installed locally you can connect to the database thus:

psql -h localhost -U postgres -d gem

Otherwise you can run it in a container:

docker-compose exec db psql -U postgres -d gem

To stop and delete the database:

docker-compose down

Option 2: Local Postgres Installation with Flyway

If you want to maintain a database full of data and peform migrations instead of starting with a fresh database every time, this option is probably what you want. Install Postgres.app and add its binaries to your path, something along the lines of

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin

Next you can run the following to create the postgres user and gem database.

psql -c 'create user postgres createdb'
psql -c 'create database gem' -U postgres

Initialize the database by running the migration scripts.

sbt schema/flywayMigrate

If you ever want to wipe out the database and start over, you can do

psql -c 'drop database gem' -U postgres

And then redo the steps above starting from create database.

You can do

psql -U postgres -d gem

to poke around with the database on the commandline.

Generating Enumerated Types

There are many enumerated types in the database, represented by tables named e_whatever. The Scala equivalents are generated on demand by queries, then checked into source control like normal source files. This is only needed if you update the contents of an enum in the schema, or add/modify a the generation code in the gen project. In any case, you can [re]-generate the enumerated types thus:

sbt genEnums

The source files appear in modules/model/shared/src/main/scala/gem/enum.

edu.gemini

Gemini High-Level Software Group

Versions

Version
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0