Skip to main content

Build forms from LinkML. Export to HTML or (basic) PDF

Project description

LinkML formbuilder

© Amsterdam UMC, 2024

This CLI tool converts LinkML models into HTML and PDF forms. It does not check for model validity and thus might crash or show errors when used with an invalid model. Use the official LinkML tools to check whether your model is valid.

This tool was built as part of a larger project by a programmer who is not part of the LinkML development team. Therefore, errors in the interpretation of slots of the modelling language are possible.

Installation

Under the hood, this tool uses the python adaptation of PDFKIT. It requires wkhtmltopdf to be installed on your system.

Installation steps:

  1. Install and add wkhtmltopdf to path
    1. Download here
    2. Add the /bin to the path variable in your system's environment variables
  2. pip install linkmlformbuilder

Build from source

  1. Make sure the working directory contains the pyproject.toml file
  2. pip install build
  3. python -m build
  4. Install the .whl file in the dist folder using pip install

Usage

Basic usage

Without additional arguments, the command linkmlformbuilder [yamlfile] with [yamlfile] being an absolute or relative path to the LinkML yaml resource you want converted, processes the provided LinkML model and creates two files:

  1. An HTML file containing code for PDFKIT to use. This HTML file can be viewed, but will look different than the PDF file. This is due to a missing css file that is added during the PDF conversion
  2. A PDF form based on the provided LinkML model

Advanced usage

usage: linkmlformbuilder [-h] [-html] [-dir [OUTPUT_DIRECTORY]] [--name [NAME]]
                    yamlfile

positional arguments:
  yamlfile              The LinkML yaml file for which a form should be built

optional arguments:
  -h, --help            show this help message and exit
  -html, --html_only    This flag is used when the user only wants an HTML
                        file returned, there will be no PDF export
  -dir [OUTPUT_DIRECTORY], --output_directory [OUTPUT_DIRECTORY]
                        Specify an output directory, the current working
                        directory is used when this value not provided or the
                        flag is missing
  --name [NAME]         Specify an alternative file name, do not specify a
                        file extension. By default, the filename of the
                        yamlfile is used for the HTML and optionally PDF files

Changelog

Version 1.0.0

  • UI update for html-only forms

Version 0.1.11

  • Add value fields to radio buttons so they show up in FormData
  • Fix issue with inline attributes and slots without a name field

Version 0.1.10

  • Add name fields to input and textareas

Version 0.1.9

  • Missing 'name' field error is now a warning
  • Default options for missing 'name' fields

Version 0.1.8

  • Throw error when field 'name' is missing from a model element
  • Auto close file on error (with statement)

Version 0.1.7

  • Apply cardinality to slots

Version 0.1.6

  • Overwrite existing output file(s) instead of throwing fileExists errors

Version 0.1.5

  • Capitalize visible names, values, and descriptions
  • Remove spaces in ids and enum names

Version 0.1.4

  • Improve support for inlined enums
  • Add support for dynamic enums

Version 0.1.1 - Version 0.1.3

  • Fix entry point

Version 0.1.0

  • Initial commit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linkmlformbuilder-1.0.0.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linkmlformbuilder-1.0.0-py3-none-any.whl (45.8 kB view details)

Uploaded Python 3

File details

Details for the file linkmlformbuilder-1.0.0.tar.gz.

File metadata

  • Download URL: linkmlformbuilder-1.0.0.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for linkmlformbuilder-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c59dcd0f7b86d798e078aeb65d70c4680409fd8f66bd6be03f9f9ab725cc8fab
MD5 c1cab4cd35ec45fc0e29f553f51c4ca1
BLAKE2b-256 b29da5c747fe5ebf323f10c3c687b4b4f8b71ff2ad5568cd7c82a513f2a0f83c

See more details on using hashes here.

File details

Details for the file linkmlformbuilder-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linkmlformbuilder-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbd57eb58eba268ab6874e806518b4f18de39b518ec5f98256f90ccf9a97b2e9
MD5 77b7f21636079a45048eca2cd10363bd
BLAKE2b-256 5a3ea332e6ed22868eab274f3998da668af009484cbc8b62e8dd3237b44f356b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page