Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

FS-3629: Add shared answer display class #400

Merged
merged 16 commits into from
Dec 8, 2023

Conversation

tferns
Copy link

@tferns tferns commented Nov 20, 2023

Description

  • Adds a python directory with python specific tools for our fork of the digital-form-builder
  • Add a github action to run tests on the python specific stuff, and upload the changes to PyPi
  • We need to bump the version manually, I think we should keep it this way - so we're forced to do semantic versioning
  • Add pre-commit hooks related to python, README.md related to the python dir (writing better version atm)
  • Add the concept of an AnswerDisplayer abstract class
    • Each currently used component has a concrete implementation, with test coverage for how it will display
    • There are three methods it supports (at the moment, but we can add more) CSV, TXT, PDF
    • When using this to render the CSV, TXT & PDF, these implementations may change!
  • dictionaries.py holds relevant mappings that may be used on downstream integrations to map answers properly, exactly how this is used and the structure may change once the work implementing downstream is in place.

Note: Some components need to handle back-wards compatibility to how the component used to render, i.e MultiInputFieldDisplayer has both a legacy and new way of displaying. Also - when some components are embedded in a MultiInputField component, their structure they're saved as is different, so some also have a implementation specifically for that scenario, i.e. UkAddressField and MonthYearField.

Package

Available on PyPi here: https://pypi.org/project/funding-service-design-digital-form-builder-tools/0.0.1/

When merging to main, if the version is bumped (it's bumped to 0.0.2 here) - it will update on PyPi.

@tferns tferns force-pushed the tferns-fs-3629-shared-answer-display-class branch from 8c03f5e to f0b8001 Compare November 23, 2023 10:20
@tferns tferns closed this Nov 23, 2023
@tferns tferns reopened this Nov 23, 2023
@tferns tferns force-pushed the tferns-fs-3629-shared-answer-display-class branch 5 times, most recently from eaf22e8 to c0053ea Compare November 23, 2023 10:45
@tferns tferns force-pushed the tferns-fs-3629-shared-answer-display-class branch from c0053ea to 534b94b Compare November 23, 2023 10:48
@tferns tferns marked this pull request as ready for review November 23, 2023 10:54
python/README.md Outdated Show resolved Hide resolved
For more details, documentation, and updates, visit the [GitHub repository](https://github.com/communitiesuk/digital-form-builder/) for this project.

Feel free to contribute and extend this package with additional tools and functionalities as needed.
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lovely docs @tferns 👍

@property
@abstractmethod
def as_pdf(self):
raise NotImplementedError
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great use of ABC

python/README.md Outdated Show resolved Hide resolved
Copy link

@adamdavies1 adamdavies1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tferns tferns merged commit e2a9f4e into main Dec 8, 2023
6 of 7 checks passed
@tferns tferns deleted the tferns-fs-3629-shared-answer-display-class branch December 8, 2023 09:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants