heurist-api 0.2.1__py3-none-any.whl → 0.2.2a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of heurist-api might be problematic. Click here for more details.

heurist/cli/load.py CHANGED
@@ -45,8 +45,11 @@ def load_command(
45
45
  # Show the results of the created DuckDB database
46
46
  with duckdb.connect(duckdb_database_connection_path, read_only=True) as new_conn:
47
47
  tables = [t[0] for t in new_conn.sql("show tables;").fetchall()]
48
- with open(VALIDATION_LOG) as f:
49
- log = f.readlines()
48
+ if VALIDATION_LOG.is_file():
49
+ with open(VALIDATION_LOG) as f:
50
+ log = f.readlines()
51
+ else:
52
+ log = []
50
53
  show_summary_in_console(tables=tables, log_lines=log)
51
54
 
52
55
  # If writing to CSV files, write only tables of record types
@@ -62,7 +65,7 @@ def load_command(
62
65
  new_conn.table(table_name).sort("H-ID").write_csv(str(fp))
63
66
 
64
67
 
65
- def show_summary_in_console(tables: list[str], log_lines: list[str]):
68
+ def show_summary_in_console(tables: list[str], log_lines: list):
66
69
  console = Console()
67
70
  t0 = Panel(
68
71
  Columns(tables, equal=True, expand=True),
heurist/log/constants.py CHANGED
@@ -1,4 +1,3 @@
1
1
  from pathlib import Path
2
2
 
3
3
  VALIDATION_LOG = Path.cwd().joinpath("validation.log")
4
- VALIDATION_LOG.touch(exist_ok=True)
@@ -8,7 +8,7 @@ from heurist.validators.detail_validator import DetailValidator
8
8
  from heurist.validators.exceptions import RepeatedValueInSingularDetailType
9
9
  from pydantic import BaseModel
10
10
 
11
- handlers = [logging.FileHandler(filename=VALIDATION_LOG, mode="w", delay=True)]
11
+ handlers = [logging.FileHandler(filename=VALIDATION_LOG, mode="w")]
12
12
  if os.getenv("HEURIST_STREAM_LOG") == "True":
13
13
  handlers.append(logging.StreamHandler())
14
14
 
@@ -1,9 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heurist-api
3
- Version: 0.2.1
4
- Dynamic: Description
5
- Dynamic: Description-Content-Type
6
- Summary: API wrapper and CLI for Heurist database.
3
+ Version: 0.2.2a0
4
+ Dynamic: Summary
7
5
  Project-URL: Homepage, https://lostma-erc.github.io/heurist-api/
8
6
  Project-URL: Documentation, https://lostma-erc.github.io/heurist-api/
9
7
  Project-URL: Repository, https://github.com/LostMa-ERC/heurist-api
@@ -465,3 +463,42 @@ Requires-Dist: pymdown-extensions>=10.15; extra == 'dev'
465
463
  Requires-Dist: pytest>=8.3.5; extra == 'dev'
466
464
  Requires-Dist: ruff>=0.11.10; extra == 'dev'
467
465
  Requires-Dist: uv>=0.7.5; extra == 'dev'
466
+ Description-Content-Type: text/markdown
467
+
468
+ # Heurist API & Data Pipeline
469
+
470
+ [![Python package](https://github.com/LostMa-ERC/heurist-etl-pipeline/actions/workflows/python-package.yml/badge.svg)](https://github.com/LostMa-ERC/heurist-etl-pipeline/actions/workflows/python-package.yml) [![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC_BY--SA_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-sa/4.0/)
471
+ [![coverage](https://github.com/LostMa-ERC/heurist-etl-pipeline/raw/main/docs/assets/coverage-badge.svg)](https://github.com/LostMa-ERC/heurist-etl-pipeline/raw/main/docs/assets/coverage-badge.svg)
472
+ [![tests](https://github.com/LostMa-ERC/heurist-etl-pipeline/raw/main/docs/assets/tests-badge.svg)](https://github.com/LostMa-ERC/heurist-etl-pipeline/raw/main/docs/assets/tests-badge.svg)
473
+
474
+ <img src="https://github.com/LostMa-ERC/heurist-etl-pipeline/raw/main/docs/assets/logo-transparent-1.png" style="width:300px" alt="Logo showing heurist on the left, a pipe in the middle, and output formats DuckDB, JavaScript and CSV on the right."/>
475
+
476
+ Extract, transform, and load data from your Heurist database into local formats. Great for freeing up your data analysis pipeline!
477
+
478
+ ## Quick Start
479
+
480
+ Install (Python version +3.10) with pip.
481
+
482
+ ```shell
483
+ pip install heurist-api
484
+ ```
485
+
486
+ Download your record types in a [DuckDB](https://duckdb.org/) database file.
487
+
488
+ ```shell
489
+ heurist -d 'YOUR.DATABASE' -u 'YOUR.LOGIN' -p 'YOUR.PASSWORD' download -f 'FILE.DB'
490
+ ```
491
+
492
+ ## Full Documentation
493
+
494
+ For detailed information about installation, usage, etc., navigate to the documentation site below:
495
+
496
+ - [Documentation](https://lostma-erc.github.io/heurist-api/)
497
+
498
+ ## License
499
+
500
+ [![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC_BY--SA_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-sa/4.0/)
501
+
502
+ ## Funding
503
+
504
+ The development of this pipeline tool was funded by the European Research Council. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council. Neither the European Union nor the granting authority can be held responsible for them.
@@ -9,7 +9,7 @@ heurist/api/url_builder.py,sha256=mT1hgZ-T38EPyHCSLfjFecbZVLsiPi18jemDuuMj21I,49
9
9
  heurist/api/utils.py,sha256=DT-BrdF7O2lmFSduRYOecx302dAlLWQTYgr2V9JoDYI,643
10
10
  heurist/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  heurist/cli/__main__.py,sha256=QG2gJG7zD3YIDRqbIp2MzTqPxqGLZ77RHCRYZ58SSjg,5975
12
- heurist/cli/load.py,sha256=q6QwZRtIQVoII1HHLW0iGklfXJlHEVxrDwb8UeX7la4,2610
12
+ heurist/cli/load.py,sha256=iiQ11EauKV93Z3YuGyspeOK9XQIVf5SqRzQ9b6V8KZQ,2685
13
13
  heurist/cli/parse_log.py,sha256=cZU9mpLbx5p-bdCwbII27T-ugTpecTgCFiBoYJip5f4,828
14
14
  heurist/cli/records.py,sha256=yKK3XIZrU1szo6X-HmGjZpD0IKk3a3rd3Kkyrg5AYGE,1345
15
15
  heurist/cli/schema.py,sha256=Dg8NcSdI7Xb6r-dkUC_razXlZNtxSG0x7awsr1m8Mcw,2766
@@ -17,7 +17,7 @@ heurist/database/__init__.py,sha256=JvQCGCi84AXUSIPCu4cTOqT_yZGDLmZFAUdsHDLbpKI,
17
17
  heurist/database/basedb.py,sha256=0MKfQOKTBDCc6qcl8BGl5OIpSA7SYgmfcKXCBVWBPes,4200
18
18
  heurist/database/database.py,sha256=rJPhGA4158eoIwe13QsSGZ8929dkRxMTesRRlMrn1tI,4057
19
19
  heurist/log/__init__.py,sha256=ubZl-2yMlvUYJwJtnk6C8AjmnU-9mbp96aHL1NSzbSg,149
20
- heurist/log/constants.py,sha256=5FaEnyXCEt1gga0pgwq4sfz_dX58BK1NixXQ2CsihNo,117
20
+ heurist/log/constants.py,sha256=8TsR_BxYL_TzZSQWwKAO8oWqBGZ0g3e-XNls5XWymDs,81
21
21
  heurist/log/iterator.py,sha256=nmpW3QQfwToADD4zffAm5iFyIUMFT56LRORdThYRoqE,519
22
22
  heurist/log/model.py,sha256=rOey1V6Vd_ehm8FTXxfi7Q4A4Mjq0V9ITl_GlNdB0y0,1085
23
23
  heurist/log/summary.py,sha256=n-skKRiFSPd3DieZMveJLCP96plVdgjW9wgBR0H_2BI,1113
@@ -54,7 +54,7 @@ heurist/validators/__init__.py,sha256=Im5z_Yg2VdKSZRPUOPSF5AFZ8AWgnyBZNKhy1o69lC
54
54
  heurist/validators/detail_validator.py,sha256=NVItrZ4Ysmgqab-B24hIeimGqpiaiqFiono5qwW20ko,4070
55
55
  heurist/validators/exceptions.py,sha256=tgoMn6R2CExT6mFg2qe4vRxP2D61cNdgEqc7YUQCFSE,1108
56
56
  heurist/validators/parse_heurist_date.py,sha256=S-NzuLZJwDrxRJkAd-fXpOlENlkc8HXKRILWCODmtIU,2161
57
- heurist/validators/record_validator.py,sha256=37xFdBwfgQY21jCtcm45_8AOu6DwC27AGC4ompykJUE,6265
57
+ heurist/validators/record_validator.py,sha256=2mPfX_57F3MsgVVxpJm6Na2JCGhEicYD2bN_X6fn2L0,6253
58
58
  heurist/workflows/__init__.py,sha256=aYN0UE_7rD9h0h74DMXkUTIDrxA0WcsWLEXWK123Gzc,81
59
59
  heurist/workflows/etl.py,sha256=IA97B1NOg_2btT_pynY64RYvbL4JraAy6wgIKJlNljM,2286
60
60
  mock_data/__init__.py,sha256=TGe3NjGTXVRQbakVGEWbDDzIkFQ72fTZhTcAoIH3DGQ,488
@@ -79,8 +79,8 @@ mock_data/geo/single.py,sha256=gbk_gOLfVlJuU3MhjY2Lu14bs9-FbZmNtevpiw9jArk,79867
79
79
  mock_data/resource/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
80
  mock_data/resource/repeated.py,sha256=Nf3nIL596pLVbKo20sQm5UITwBzqf-IHFzE_m2UCLbw,788
81
81
  mock_data/resource/single.py,sha256=SXVri1MM8UaJw7GejMEJ6seNEnMksdw_WKiOxQOdVFs,411
82
- heurist_api-0.2.1.dist-info/METADATA,sha256=INf5LbhdDjblw82g0TfLpwSC9E2oIQ4pRPjeme25sb0,25177
83
- heurist_api-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
- heurist_api-0.2.1.dist-info/entry_points.txt,sha256=37KBvqofapLaKDPFrcYxv_rfUM9H08Mbe6mxNdd_Xno,93
85
- heurist_api-0.2.1.dist-info/licenses/LICENSE,sha256=I-54yLrknPCOovDISUXGa5h-vkUgiB-1Gz2tT7Q9B8I,20137
86
- heurist_api-0.2.1.dist-info/RECORD,,
82
+ heurist_api-0.2.2a0.dist-info/METADATA,sha256=tMQ4GnFCobKMaeh3nZU2GcdnG5-fMilIOBx3ftrrUsU,27241
83
+ heurist_api-0.2.2a0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ heurist_api-0.2.2a0.dist-info/entry_points.txt,sha256=37KBvqofapLaKDPFrcYxv_rfUM9H08Mbe6mxNdd_Xno,93
85
+ heurist_api-0.2.2a0.dist-info/licenses/LICENSE,sha256=I-54yLrknPCOovDISUXGa5h-vkUgiB-1Gz2tT7Q9B8I,20137
86
+ heurist_api-0.2.2a0.dist-info/RECORD,,