Coder Social home page Coder Social logo

openhospital-api's Introduction

Open Hospital API

Java CI with Maven

This is the API project of Open Hospital: it exposes a REST API of the business logic implemented in the openhospital-core project.

Summary

Table of contents generated with markdown-toc

How to build [WIP]

For the moment, to build this project you should

  1. fetch and build the core project

    git clone https://github.com/informatici/openhospital-core.git
    cd openhospital-core
    mvn clean install -DskipTests=true
    
  2. clone and build this project

    git clone https://github.com/informatici/openhospital-api
    cd openhospital-api
    mvn clean install -DskipTests=true
    
  3. prepare settings from each rsc/*.dist file

    rsc/application.properties <- set a SHA-256 jwt token
    rsc/database.properties
    rsc/log4j.properties
    rsc/...
    
  4. set target/rsc/database.properties

    DB can be created with `docker-compose up` from `openhospital-core` or using a dedicated MySQL server
    
  5. start openhospital-api (in target folder)

    # Windows
    java -cp "openhospital-api-0.1.0.jar;rsc/;static/" org.springframework.boot.loader.JarLauncher
    
    # Linux
    java -cp "openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher
    
  6. call services

You can see Swagger Api Documentation at: http://localhost:8080/swagger-ui/

image

Using Swagger-UI

  1. use endpoint /auth/login to login and get the token

image image

  1. use the Authorize button at the top of the Swagger-UI, paste the token from step #1 and click Authorize

image

  1. close the dialog

image

  1. now all the endpoints are automatically secured and the token will be added to the request

image

Using Postman

  1. import postman_collection.json in your Postman installation

How to deploy backend in Docker environment

Make sure you have docker with docker-compose installed, then run the following commands:

  • copy dotenv file into .env and set variables as needed (the SHA-256 jwt token is needed)
  • run make
  • run docker compose up -d database (wait for some seconds the very first time to build the DB)
  • (optional - demo data) run docker compose run --rm oh-database-init
  • run docker compose up backend

When done successfully, head over at http://localhost:[API_PORT]/swagger-ui/

You can change the deployment branch using an .env file.

Cleaning

docker compose rm --stop --volumes --force
make clean

How to contribute

You can find the contribution guidelines in the Open Hospital wiki.
A list of open issues is available on Jira.

Community

You can reach out to the community of contributors by joining our Slack workspace or by subscribing to our mailing list.

Code style

This project uses a consistent code style and provides definitions for use in both IntelliJ and Eclipse IDEs.

IntelliJ IDEA instructions

For IntelliJ IDEA the process for importing the code style is:

  • Select Settings in the File menu
  • Select Editor
  • Select Code Style
  • Expand the menu item and select Java
  • Go to Scheme at the top, click on the setting button by the side of the drop-down list
  • Select Import Scheme
  • Select IntelliJ IDE code style XML
  • Navigate to the location of the file which relative to the project root is: .ide-settings/idea/OpenHospital-code-style-configuration.xml
  • Select OK
  • At this point the code style is stored as part of the IDE and is used for all projects opened in the editor. To restrict the settings to just this project again select the setting button by the side of the Scheme list and select Copy to Project.... If successful a notice appears in the window that reads: For current project.
Eclipse instructions

For Eclipse the process requires loading the formatting style and the import order separately.

  • Select Preferences in the Window menu
  • Select Java
  • Select Code Style and expand the menu
  • Select Formatter
  • Select the Import... button
  • Navigate to the location of the file which relative to the project root is: .ide-settings/eclipse/OpenHospital-Java-CodeStyle-Formatter.xml
  • Select Open
  • At this point the code style is stored and is applicable to all projects opened in the IDE. To restrict the settings just to this project select Configure Project Specific Settings... in the upper right. In the next dialog select the openhospital repository and select OK. In the next dialog select the Enable project specific settings checkbox. Finally select Apply and Close.
  • Back in the Code Style menu area, select Organize Imports
  • Select Import...
  • Navigate to the location of the file which relative to the project root is: .ide-settings/eclipse/OpenHospital.importorder
  • Select Open
  • As with the formatting styles the import order is applicable to all projects. In order to change it just for this project repeat the same steps as above for Configure Project Specific Settings...

openhospital-api's People

Contributors

dbmalkovsky avatar mwithi avatar emecas avatar averni avatar arnaudfonzam avatar dependabot[bot] avatar dependabot-preview[bot] avatar pviotti avatar npasquetto avatar vir8wh47 avatar goto-eof avatar verdoso avatar gildasdongmo avatar martinezx21 avatar torrespro avatar fstorz avatar andreafalco1991 avatar dnlebgwa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.