genelastic 0.9.0__py3-none-any.whl → 0.10.0__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.
genelastic/common/cli.py CHANGED
@@ -66,17 +66,10 @@ def add_es_connection_args(parser: argparse.ArgumentParser) -> None:
66
66
  Arguments are added to the parser by using its reference.
67
67
  """
68
68
  parser.add_argument(
69
- "--es-host",
70
- dest="es_host",
71
- default="localhost",
72
- help="Address of Elasticsearch host.",
73
- )
74
- parser.add_argument(
75
- "--es-port",
76
- type=int,
77
- default=9200,
78
- dest="es_port",
79
- help="Elasticsearch port.",
69
+ "--es-url",
70
+ dest="es_url",
71
+ default="https://localhost:9200/",
72
+ help="URL of the Elasticsearch host.",
80
73
  )
81
74
  parser.add_argument(
82
75
  "--es-usr", dest="es_usr", default="elastic", help="Elasticsearch user."
@@ -96,13 +96,12 @@ def main() -> None:
96
96
  configure_logging(args.verbose)
97
97
 
98
98
  logger.info(
99
- "Connecting to Elasticsearch at https://%s:%s ...",
100
- args.es_host,
101
- args.es_port,
99
+ "Connecting to Elasticsearch at %s...",
100
+ args.es_url,
102
101
  )
103
102
 
104
103
  es = ElasticQueryConn(
105
- f"https://{args.es_host}:{args.es_port}",
104
+ args.es_url,
106
105
  args.es_cert_fp,
107
106
  args.es_index_prefix,
108
107
  basic_auth=(args.es_usr, args.es_pwd),
@@ -234,10 +234,9 @@ def main() -> None:
234
234
  logger.debug("LOGGERS: %s", logging.root.manager.loggerDict)
235
235
 
236
236
  # Open connection to ES
237
- addr = f"https://{args.es_host}:{args.es_port}"
238
- logger.info("Connecting to Elasticsearch at %s...", addr)
237
+ logger.info("Connecting to Elasticsearch at %s...", args.es_url)
239
238
  es_import_conn = ElasticImportConn(
240
- addr,
239
+ args.es_url,
241
240
  args.es_cert_fp,
242
241
  args.es_index_prefix,
243
242
  args.dryrun,
@@ -209,10 +209,9 @@ def main() -> None:
209
209
  configure_logging(args.verbose)
210
210
  logger.debug("Arguments: %s", args)
211
211
 
212
- addr = f"https://{args.es_host}:{args.es_port}"
213
- logger.info("Connecting to Elasticsearch at %s...", addr)
212
+ logger.info("Connecting to Elasticsearch at %s...", args.es_url)
214
213
  es_query_conn = ElasticQueryConn(
215
- addr,
214
+ args.es_url,
216
215
  args.es_cert_fp,
217
216
  args.es_index_prefix,
218
217
  basic_auth=(args.es_usr, args.es_pwd),
@@ -366,10 +366,9 @@ def main() -> None:
366
366
  wet_processes_index = f"{args.es_index_prefix}-wet_processes"
367
367
  bi_processes_index = f"{args.es_index_prefix}-bi_processes"
368
368
 
369
- addr = f"https://{args.es_host}:{args.es_port}"
370
- logger.info("Connecting to Elasticsearch at %s...", addr)
369
+ logger.info("Connecting to Elasticsearch at %s...", args.es_url)
371
370
  es_query_conn = ElasticQueryConn(
372
- addr,
371
+ args.es_url,
373
372
  args.es_cert_fp,
374
373
  args.es_index_prefix,
375
374
  args.dryrun,
@@ -72,7 +72,12 @@ class BaseImporter(ABC, Generic[T]):
72
72
  """Load and parse raw data from the file."""
73
73
 
74
74
  def _validate(self, data: T) -> None:
75
- """Validate the data structure (optional)."""
75
+ """Validate the data structure (optional).
76
+
77
+ Note: Do not implement for streaming-based importers (generators).
78
+ Generators should not be consumed here; validate per-record in
79
+ ``_transform`` if needed.
80
+ """
76
81
 
77
82
  @abstractmethod
78
83
  def _transform(self, data: T) -> Iterable[dict[str, Any]]:
@@ -77,15 +77,26 @@ class VCFImporter(BaseImporter[Iterable[_Record]]):
77
77
  :raises ImporterError: If the file could not be opened, decoded or is empty.
78
78
  """
79
79
  try:
80
- yield from vcf.Reader(
80
+ # StopIteration can come from two sources:
81
+ # 1. vcf.Reader() constructor if file is empty
82
+ # (unhandled in header parsing)
83
+ # 2. next() if file has valid headers but no variant records
84
+ reader = vcf.Reader(
81
85
  filename=str(self._data_file.path), encoding="utf-8"
82
86
  )
87
+ first_record = next(reader)
83
88
  except StopIteration:
84
- msg = f"VCF file '{self._data_file.path}' is empty."
89
+ msg = (
90
+ f"VCF file '{self._data_file.path}' is empty or "
91
+ f"contains no variant records."
92
+ )
85
93
  raise ImporterError(msg) from None
86
94
  except (OSError, UnicodeDecodeError) as e:
87
95
  raise ImporterError(e) from None
88
96
 
97
+ yield first_record
98
+ yield from reader
99
+
89
100
  def _transform(self, data: Iterable[_Record]) -> Iterable[dict[str, Any]]:
90
101
  """Transform each VCF file record into a JSON document."""
91
102
  for record in data:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genelastic
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: Generate and store genetic data into an Elasticsearch database.
5
5
  Keywords: CNRGH,genelastic,generation,storage,elasticsearch,database
6
6
  Author: CNRGH, Pierrick ROGER, Maxime BLANCHON
@@ -11,7 +11,7 @@ genelastic/api/server.py,sha256=3zkxOmm5L9-phdZcmPTsFQo_Uy9tzdGKRlYyWTkxv4Q,2571
11
11
  genelastic/api/settings.py,sha256=dbKQib2QQisxvi4riwJ67iB9imu-x7ZXOcKjeXuO0rU,316
12
12
  genelastic/api/specification.yml,sha256=dRo5Ttenp5-Nu3rNs9VWXpktHf4UCgvbgkBY5MAvwW8,15659
13
13
  genelastic/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- genelastic/common/cli.py,sha256=1X9e3zWSOy_9i5IVWJKdro2sp6xOlukuErjGopd7ET4,4539
14
+ genelastic/common/cli.py,sha256=czzdvij007oHgqwF8iO8kfgcCkU9PuZMDrLrdSJ2agI,4399
15
15
  genelastic/common/elastic.py,sha256=tpmHeYUMgGS6ZMdowB1h5JO9eAkcK5H4_0Z0CRS-woA,17550
16
16
  genelastic/common/exceptions.py,sha256=hl2KNGOc88Rf0zdIAtS9Y4b4lghUZmqoiSD6VSMpDs8,961
17
17
  genelastic/common/server.py,sha256=qirZaMrgvF9VHS7c8zB3-NOVzV26LonSvgKKxCh5qLE,1561
@@ -20,20 +20,20 @@ genelastic/import_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
20
20
  genelastic/import_data/checker.py,sha256=IbtlJ7SDFYgScu2-KuBx3RZh9B73L643p-T497wUxIA,3737
21
21
  genelastic/import_data/checker_observer.py,sha256=0BQFNqtC12rcuihTR8IYYcxTm0D4cMIX2UPFEL8HjYA,416
22
22
  genelastic/import_data/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- genelastic/import_data/cli/cli_check.py,sha256=5_YNTAZucuHfzUasZ1coX31Jl_WWLTSw9wvRphPjO1o,3509
23
+ genelastic/import_data/cli/cli_check.py,sha256=Xy76YYLvrPDUbk9rrWPyOqYLR0HEZ-n8OBvUwlwacPQ,3445
24
24
  genelastic/import_data/cli/gen_data.py,sha256=wCCZutbhl2yYQb3-JBgcgrtrhk72BrIDUmojv-STSVU,4071
25
- genelastic/import_data/cli/import_data.py,sha256=SXi_vjBKiUvpfasKzD1AUOFoivUQJefeqqRv7trx6L4,10672
26
- genelastic/import_data/cli/info.py,sha256=Blx402DlvAuwPT-5GiBEX1tFj3_jZm_t6H66B9CXc54,7097
27
- genelastic/import_data/cli/integrity.py,sha256=Hxk71nKBHStDo7ZnZOUlzw3tZgpDPzWFQokA3X-m1CQ,12915
25
+ genelastic/import_data/cli/import_data.py,sha256=dJ-Val5vlbB1J7K0Fj7BqBEil70P9XBIrD5WCkH3Hrs,10634
26
+ genelastic/import_data/cli/info.py,sha256=_76XDvfLoxT9ibBihy2MdfRis8D4SEU-_f9wtCWk3-I,7059
27
+ genelastic/import_data/cli/integrity.py,sha256=zzYbGioyLu0VzJWTzGPC0zlL2Udy1l6EsP4d21xUaSU,12877
28
28
  genelastic/import_data/cli/validate.py,sha256=2pLX7hTElqY6V-Cc7VQgNBQGzQtFoTbOr_bPnoABJOc,4178
29
29
  genelastic/import_data/collect.py,sha256=XU1JraaBuMUuM69Nr10MRanqwK-LlgC9nUIXDy3znbM,6288
30
30
  genelastic/import_data/constants.py,sha256=A1nT9dCJhfwB4D2_x1FVtwGPa0_p-zgEjNIFt5-j-9s,4659
31
31
  genelastic/import_data/import_bundle.py,sha256=uxPxn-c7EkEqhhhzKXmQqRNDBFBJVORBrkx2BaNmy5M,6683
32
32
  genelastic/import_data/import_bundle_factory.py,sha256=sQncdNtoUWzi-v4VMfWkwV_ngTymBJAO1tt8h8xqP-E,7516
33
33
  genelastic/import_data/importers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- genelastic/import_data/importers/importer_base.py,sha256=S2KhKnOT2gP5hAfs1rKOsB1t_Tl-mGqrwRrz2adHQ7o,4131
34
+ genelastic/import_data/importers/importer_base.py,sha256=WgeI7y0cMpCj4fAdbj61vzJ44wAktDXpSrcXgOSD-L4,4321
35
35
  genelastic/import_data/importers/importer_factory.py,sha256=9tP2EGRYxa-92wvZMzIMlwzFNj7MtOeP80zt9O5lr7s,2984
36
- genelastic/import_data/importers/importer_types.py,sha256=vdWJodd2u_HSeQBZLwK1xs9mTmxQqvKt7KDsoGtrc7Y,7827
36
+ genelastic/import_data/importers/importer_types.py,sha256=4wGemKk1c6z3RvttpvIo7stX9CwsT-muDOjPr2GiKNg,8233
37
37
  genelastic/import_data/logger.py,sha256=VfoMU8ESvcohqesqEsLz_cDd3HJkublqYh_q7VnxkOA,1946
38
38
  genelastic/import_data/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  genelastic/import_data/models/analyses.py,sha256=AqZGVgoOd3fAoB4YCMST_SXxg6wJ-ROokZmyQu-svUM,6816
@@ -69,8 +69,8 @@ genelastic/ui/templates/layout.html,sha256=IOhrnchqOhdqyrJITyp1r6JaJAj7_Ll5_f_Kj
69
69
  genelastic/ui/templates/version.html,sha256=cP8RLUFXWuN1KkrN4vlK7v4o97PCTu92-6p_FMVpYsA,599
70
70
  genelastic/ui/templates/wet_process_detail.html,sha256=vtjmIl1o4XOt850eGuCjqN1D1PHZSQAZR-NBWjpUd0g,5906
71
71
  genelastic/ui/templates/wet_processes.html,sha256=DJKdMG6KyC6Qq3pNhdJ2LoO0rouAZgqhvpXV5tmuiBY,4929
72
- genelastic-0.9.0.dist-info/licenses/LICENSE,sha256=9Ip7fr8UdH7_fKYaL2LmieyBUV1xZihhhYXaU6L95iw,21779
73
- genelastic-0.9.0.dist-info/WHEEL,sha256=3id4o64OvRm9dUknh3mMJNcfoTRK08ua5cU6DFyVy-4,79
74
- genelastic-0.9.0.dist-info/entry_points.txt,sha256=ZyrFPza2Zwka9lc0lHTt56KfSqNtlE_b_I3xEXH2mJM,441
75
- genelastic-0.9.0.dist-info/METADATA,sha256=pjfWvmRClh7ItL9lE7URNOxyXB2XAKRRxaFtbMtah74,22010
76
- genelastic-0.9.0.dist-info/RECORD,,
72
+ genelastic-0.10.0.dist-info/licenses/LICENSE,sha256=9Ip7fr8UdH7_fKYaL2LmieyBUV1xZihhhYXaU6L95iw,21779
73
+ genelastic-0.10.0.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
74
+ genelastic-0.10.0.dist-info/entry_points.txt,sha256=ZyrFPza2Zwka9lc0lHTt56KfSqNtlE_b_I3xEXH2mJM,441
75
+ genelastic-0.10.0.dist-info/METADATA,sha256=G7Z-M6_Rs6pTOjXpo2kjGpAT6mssQ5xR4ahfnD16DYQ,22011
76
+ genelastic-0.10.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.13
2
+ Generator: uv 0.9.26
3
3
  Root-Is-Purelib: true
4
- Tag: py3-none-any
4
+ Tag: py3-none-any