Skip to content

Repository files navigation

iPRO CE — Hippocrates Platform

iPRO Community Edition — backend service of the iPRO Patient Reported Outcome Measures (PROM) platform. Built with Express, Sequelize, and PostgreSQL. Works together with the Avicenna client frontend.

iPRO CE is developed by the Institute of Mathematics and Informatics, Bulgarian Academy of Sciences (IMI-BAS), under Bulgarian Recovery and Resilience Plan grant BG-RRP-2.011-0049 (ПВУ).

Prerequisites

  • Node.js >= 18
  • npm >= 9
  • PostgreSQL 14 or higher
  • Redis 6 or higher (for session storage)
  • The hstore extension must be installed in the target database before running migrations (required by the configurations table):
    psql -d ipro_ce -c "CREATE EXTENSION IF NOT EXISTS hstore"

Quick Start

# 1. Clone
git clone https://github.com/imi-bas/ipro-hippocrates-ce.git
cd ipro-hippocrates-ce

# 2. Install dependencies
npm install

# 3. Configure environment
cp .env.example .env
# Edit .env — at minimum set DATABASE_URL and DOCTOR_TOKEN_SECRET:
#   DATABASE_URL=postgres://postgres:@localhost:5432/ipro_ce
#   DOCTOR_TOKEN_SECRET=$(node -e "console.log(require('crypto').randomBytes(32).toString('hex'))")

# 4. Create the database and enable required extension
createdb ipro_ce
psql ipro_ce -c "CREATE EXTENSION IF NOT EXISTS hstore"

# 5. Run migrations
DATABASE_URL=postgres://postgres:@localhost:5432/ipro_ce npx sequelize-cli db:migrate

# 6. (Optional) Load demo data
DATABASE_URL=postgres://postgres:@localhost:5432/ipro_ce npx sequelize-cli db:seed:all

# 7. Start
npm start
# Server listens on PORT from .env (default 8080)

Note: DATABASE_URL in the shell overrides the value in .env when running CLI commands. If you have set DATABASE_URL in .env, you can omit it from the command line once you source .env or start the server (which loads .env automatically via dotenv).

Architecture

iPRO uses a 9-question-type questionnaire engine (single/multi choice, cascading, scale, matrix, autocomplete, etc.) with type-aware scoring (PROM/PREM). The backend exposes a REST API at /eskis/crud/* consumed by the Avicenna frontend. See docs/ for architecture deep-dives.

Email provider

Outbound transactional email is handled via a pluggable EmailProvider interface. iPRO CE ships with a console stub by default (no emails sent). To enable real delivery, implement your own provider (SMTP, AWS SES, Mailgun, etc.) — see docs/email-provider.md for examples.

Testing

Unit tests (no DB required):

npm test -- --testPathIgnorePatterns=integration

Integration tests (require a running PostgreSQL instance):

# Create a dedicated test database
createdb ipro_ce_test
psql ipro_ce_test -c "CREATE EXTENSION IF NOT EXISTS hstore"

# Run integration tests against it
TEST_DATABASE_URL=postgres://postgres@localhost:5432/ipro_ce_test \
  npm test -- --testPathPattern=integration

# Or with individual env vars
TEST_DB_USER=myuser TEST_DB_PASS=secret TEST_DB_NAME=ipro_ce_test \
  npm test -- --testPathPattern=integration

The TEST_DATABASE_URL env var takes precedence. If absent, DATABASE_URL is tried next, then individual TEST_DB_* vars, and finally postgres://postgres@localhost:5432/ipro_ce_test.

All tests (requires DB as above):

TEST_DATABASE_URL=postgres://postgres@localhost:5432/ipro_ce_test npm test

Contributing

See CONTRIBUTING.md (forthcoming). Pull requests welcome — please open an issue first for major changes.

License

MIT. See LICENSE.

This work was supported by the Bulgarian Recovery and Resilience Plan (Национален план за възстановяване и устойчивост), grant BG-RRP-2.011-0049.

Repository

About

iPRO PROM API platform — Community Edition. Part of project BG-RRP-2.011-0049, https://ipro.math.bas.bg

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages