Skip to content

aphp/formbuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠 Installation

Quick Start (For Non-Technical Users)

Clone the Git repository

Clone the aphp-formbuilder repository to your local machine:

      git clone https://github.com/aphp/formbuilder.git

Set the Backend FHIR Server

To configure your backend FHIR server, edit the hapiServerUrl parameter in the file environment.ts.

By default, it is set to the public HAPI FHIR server: https://hapi.fhir.org/baseR4

🚀 Running the application

With docker
  • Prerequisites:

    • Ensure you have Docker installed on your system. You can download Docker from https://www.docker.com/get-started.

    • Make sure the required ports are not in use by other applications.

  • Steps:

  1. Build the Docker image:
      docker build -t formbuilder .
  1. Run the Docker container:
      docker run -p 8080:8080 formbuilder
  1. Access the application:
  • Open your web browser and navigate to http://localhost:8080 (or replace with the correct port if changed) to access the application.
Start formbuilder server locally (Alternative way to run the application)

For local development, run the server as follows:

  • Prerequisites:

  • Steps:

  1. Install project dependencies:
    npm install
  1. Remove the existing ./src/lib/lforms directory:

for Linux:

      rm -rf ./src/lib/lforms 

for Windows:

      Remove-Item -Path "src\lib\lforms" -Recurse -Force
  1. Run the copy script:
node ./bin/copy-lforms.js
  1. Serve the application locally:
ng serve --port 9032 --configuration development
  1. Access the application:

Advanced Configuration & Tips (For Developers & Technical Users)

Build the package for production

Build the production package and copy it to your web server's document location:

  • Prerequisites:
    • Install nodejs package globally on your system.
      npm run build
      cp dist/aphp-formbuilder {webserver docs location}

About copy-lforms.js

The script copy-lforms.js is responsible for copying build files for LForms from the LForms website: https://lhcforms-static.nlm.nih.gov/lforms-versions.

To update the LForms library, you need to modify the lformsVersion variable in version.json and execute the following command: node ./bin/copy-lforms.js This will download the files locally.

Customizing with ngx-item.schema.json

The file ngx-item.schema.json allows you to add new fields to the FormBuilder. This schema defines the structure of form data that can be customized or extended according to the application's requirements.

Activating Keycloak for SSO

To activate Keycloak and use Single Sign-On (SSO), simply enter the appropriate configuration in the environment file:

keycloakConfig: {
  url: 'XXXX',
  realm: 'XXXX',
  clientId: 'XXXX',
}

If the environment file does not contain this configuration (keycloakConfig), the SSO will not be used, and the user will not be authenticated.

Loading Configuration at Runtime

An external configuration is used in Kubernetes via a ConfigMap.

In the Deployment file, the ConfigMap is mounted to a specific directory, for example:

volumes:
  - name: env-consts-config
    configMap:
      name: formbuilder-dev

volumeMounts:
  - name: env-consts-config
    mountPath: "/usr/share/nginx/html/config/config.json"
    subPath: config.json
    readOnly: true

The configuration will be dynamically loaded at runtime using an environment loader approach. This is done by the environmentLoader.ts which reads the config.json.

This file is mounted into the container from the Kubernetes ConfigMap at the path ./config/config.json during the application startup

This strategy enables maintaining a single Docker image for multiple environments while adapting the application's behavior based on the environment parameters.

📜 License

This project is licensed under the LICENSE .

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published