Clone the aphp-formbuilder repository to your local machine:
git clone https://github.com/aphp/formbuilder.git
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
-
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:
- Build the Docker image:
docker build -t formbuilder .
- Run the Docker container:
docker run -p 8080:8080 formbuilder
- 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.
For local development, run the server as follows:
-
Prerequisites:
- Install Node.js (if not already installed) from [nodejs.org] (https://nodejs.org/fr).
- Install the Angular CLI globally (if not already installed)
npm install -g @angular/[email protected]
-
Steps:
- Install project dependencies:
npm install
- Remove the existing ./src/lib/lforms directory:
for Linux:
rm -rf ./src/lib/lforms
for Windows:
Remove-Item -Path "src\lib\lforms" -Recurse -Force
- Run the copy script:
node ./bin/copy-lforms.js
- Serve the application locally:
ng serve --port 9032 --configuration development
- Access the application:
- Open your web browser and navigate to http://localhost:9032 to access the application.
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}
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.
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.
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.
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.
This project is licensed under the LICENSE .