|
1 | 1 | ''' |
2 | 2 | MIT License |
3 | | -
|
4 | 3 | Copyright (c) 2023 Ulster University (https://www.ulster.ac.uk). |
5 | 4 | Project: Harmony (https://harmonydata.ac.uk) |
6 | 5 | Maintainer: Thomas Wood (https://fastdatascience.com) |
7 | | -
|
8 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | 7 | of this software and associated documentation files (the "Software"), to deal |
10 | 8 | in the Software without restriction, including without limitation the rights |
11 | 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | 10 | copies of the Software, and to permit persons to whom the Software is |
13 | 11 | furnished to do so, subject to the following conditions: |
14 | | -
|
15 | 12 | The above copyright notice and this permission notice shall be included in all |
16 | 13 | copies or substantial portions of the Software. |
17 | | -
|
18 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | 20 | SOFTWARE. |
25 | | -
|
26 | 21 | ''' |
27 | | - |
28 | 22 | __version__ = "1.0.7" |
29 | | - |
30 | 23 | # TODO: make these configurable at package level |
31 | 24 | import os |
32 | | - |
33 | 25 | from .examples import example_instruments |
34 | 26 | from .schemas import * |
35 | 27 | from .util.instrument_helper import create_instrument_from_list, import_instrument_into_harmony_web |
36 | 28 | from .util.model_downloader import download_models |
37 | 29 |
|
| 30 | +# PDF Export functionality (addresses issue #53) |
| 31 | +try: |
| 32 | + from .services.export_pdf_report import ( |
| 33 | + generate_pdf_report, |
| 34 | + generate_harmony_pdf_report, |
| 35 | + generate_basic_harmony_report |
| 36 | + ) |
| 37 | +except ImportError: |
| 38 | + # Graceful fallback if PDF dependencies are not available |
| 39 | + def generate_pdf_report(*args, **kwargs): |
| 40 | + raise ImportError("PDF export requires additional dependencies. Install with: pip install fpdf2 matplotlib seaborn") |
| 41 | + def generate_harmony_pdf_report(*args, **kwargs): |
| 42 | + raise ImportError("PDF export requires additional dependencies. Install with: pip install fpdf2 matplotlib seaborn") |
| 43 | + def generate_basic_harmony_report(*args, **kwargs): |
| 44 | + raise ImportError("PDF export requires additional dependencies. Install with: pip install fpdf2 matplotlib seaborn") |
| 45 | + |
38 | 46 | if os.environ.get("HARMONY_NO_PARSING") is None or os.environ.get("HARMONY_NO_PARSING") == "": |
39 | 47 | from .parsing.text_parser import convert_text_to_instruments |
40 | 48 | from .parsing.excel_parser import convert_excel_to_instruments |
41 | 49 | from .parsing.pdf_parser import convert_pdf_to_instruments |
42 | 50 | from .parsing.wrapper_all_parsers import convert_files_to_instruments |
43 | 51 | from .parsing import * |
44 | 52 | from .util.file_helper import load_instruments_from_local_file |
45 | | - |
46 | 53 | if os.environ.get("HARMONY_NO_MATCHING") is None or os.environ.get("HARMONY_NO_MATCHING") == "": |
47 | 54 | from .matching.matcher import match_instruments_with_function |
48 | 55 | from .matching.generate_crosswalk_table import generate_crosswalk_table |
49 | 56 | from .matching.deterministic_clustering import find_clusters_deterministic |
50 | 57 | from .matching.cluster import cluster_questions |
51 | | - |
52 | 58 | try: |
53 | 59 | from .matching.default_matcher import match_instruments |
54 | 60 | except ModuleNotFoundError: |
|
0 commit comments