ingen-lib 2.0.0__tar.gz → 2.1.0__tar.gz

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.
Files changed (104) hide show
  1. {ingen_lib-2.0.0/ingen_lib.egg-info → ingen_lib-2.1.0}/PKG-INFO +1 -1
  2. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/formatters/common_formatters.py +25 -2
  3. ingen_lib-2.1.0/ingen/pre_processor/not_equals_filter.py +64 -0
  4. ingen_lib-2.1.0/ingen/pre_processor/outer_join.py +50 -0
  5. {ingen_lib-2.0.0 → ingen_lib-2.1.0/ingen_lib.egg-info}/PKG-INFO +1 -1
  6. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen_lib.egg-info/SOURCES.txt +2 -0
  7. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/setup.py +1 -1
  8. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/LICENSE +0 -0
  9. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/MANIFEST.in +0 -0
  10. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/README.md +0 -0
  11. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/__init__.py +0 -0
  12. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/__main__.py +0 -0
  13. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/__init__.py +0 -0
  14. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/api_source.py +0 -0
  15. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/data_source_type.py +0 -0
  16. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/dataframe_store.py +0 -0
  17. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/file_source.py +0 -0
  18. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/json_source.py +0 -0
  19. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/mysql_source.py +0 -0
  20. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/rawdata_source.py +0 -0
  21. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/source.py +0 -0
  22. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/data_source/source_factory.py +0 -0
  23. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/formatters/__init__.py +0 -0
  24. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/formatters/formatter.py +0 -0
  25. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/formatters/utils.py +0 -0
  26. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/generators/__init__.py +0 -0
  27. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/generators/base_interface_generator.py +0 -0
  28. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/generators/interface_generator.py +0 -0
  29. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/lib/__init__.py +0 -0
  30. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/lib/cryptor.py +0 -0
  31. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/logger.py +0 -0
  32. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/metadata/__init__.py +0 -0
  33. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/metadata/metadata.py +0 -0
  34. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/metadata/metadata_parser.py +0 -0
  35. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/post_processor/__init__.py +0 -0
  36. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/post_processor/common_post_processor.py +0 -0
  37. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/post_processor/post_processor.py +0 -0
  38. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/__init__.py +0 -0
  39. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/aggregator.py +0 -0
  40. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/aggregators.py +0 -0
  41. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/drop_duplicates.py +0 -0
  42. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/filter.py +0 -0
  43. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/json_array_expander.py +0 -0
  44. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/mask.py +0 -0
  45. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/melt.py +0 -0
  46. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/merger.py +0 -0
  47. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/pre_processor.py +0 -0
  48. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/process.py +0 -0
  49. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/pre_processor/union.py +0 -0
  50. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/__init__.py +0 -0
  51. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/api_reader.py +0 -0
  52. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/data_source.py +0 -0
  53. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/file_reader.py +0 -0
  54. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/json_reader.py +0 -0
  55. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/mysql_reader.py +0 -0
  56. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/rawdata_reader.py +0 -0
  57. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/reader/xml_file_reader.py +0 -0
  58. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/__init__.py +0 -0
  59. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/app_http/__init__.py +0 -0
  60. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/app_http/aiohttp_retry.py +0 -0
  61. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/app_http/http_request.py +0 -0
  62. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/app_http/http_util.py +0 -0
  63. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/app_http/success_criterias.py +0 -0
  64. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/app_secrets.py +0 -0
  65. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/interpolators/Interpolator.py +0 -0
  66. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/interpolators/__init__.py +0 -0
  67. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/interpolators/common_interpolators.py +0 -0
  68. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/json_df_convertors.py +0 -0
  69. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/path_parser.py +0 -0
  70. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/properties.py +0 -0
  71. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/run_configuration.py +0 -0
  72. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/sql_query_parser.py +0 -0
  73. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/timer.py +0 -0
  74. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/url_constructor.py +0 -0
  75. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/utils/utils.py +0 -0
  76. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/validation/__init__.py +0 -0
  77. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/validation/common_validations.py +0 -0
  78. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/validation/notification.py +0 -0
  79. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/validation/send_email.py +0 -0
  80. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/validation/validations.py +0 -0
  81. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/__init__.py +0 -0
  82. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/dataframe_writer.py +0 -0
  83. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_util.py +0 -0
  84. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/__init__.py +0 -0
  85. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/convertors/__init__.py +0 -0
  86. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/convertors/convertor_factory.py +0 -0
  87. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/convertors/df_to_multiple_json_convertor.py +0 -0
  88. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/convertors/df_to_single_json_convertor.py +0 -0
  89. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/destinations/__init__.py +0 -0
  90. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/destinations/api_destination.py +0 -0
  91. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/destinations/destination_factory.py +0 -0
  92. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/destinations/file_destination.py +0 -0
  93. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/json_writer/json_writer.py +0 -0
  94. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/old_json_writer.py +0 -0
  95. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/split_file_writer.py +0 -0
  96. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/util.py +0 -0
  97. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen/writer/writer.py +0 -0
  98. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen_lib.egg-info/dependency_links.txt +0 -0
  99. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen_lib.egg-info/requires.txt +0 -0
  100. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/ingen_lib.egg-info/top_level.txt +0 -0
  101. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/pyproject.toml +0 -0
  102. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/requirements.txt +0 -0
  103. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/setup.cfg +0 -0
  104. {ingen_lib-2.0.0 → ingen_lib-2.1.0}/test/test_interface_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ingen-lib
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: A Python script suite that generates interface files based on the given interface metadata/config file
5
5
  Home-page: https://github.com/blackrock/interface-generator
6
6
  Maintainer: Swarna Dhakad, Piyush Ranjan, Jatin Varlyani, Pooja Katariya
@@ -422,11 +422,16 @@ def replace_value(dataframe, col_name, format_options, runtime_params):
422
422
  :param runtime_params: command line arguments
423
423
  :return: new dataframe with 'from_value' replaced in column 'col_name' with the 'to_value'
424
424
  """
425
+ replace_missing = format_options.get('replace_missing', False)
425
426
  if col_name not in dataframe.columns:
426
427
  raise KeyError(f"Column '{col_name}' not found.")
427
428
  for from_value, to_value in zip(format_options.get('from_value'), format_options.get('to_value')):
428
- dataframe[col_name] = dataframe[col_name].replace(
429
- {from_value: to_value})
429
+ if replace_missing and from_value is None:
430
+ # Replace all missing values (None, NaN) - useful for merge operations
431
+ dataframe[col_name] = dataframe[col_name].fillna(to_value)
432
+ else:
433
+ dataframe[col_name] = dataframe[col_name].replace(
434
+ {from_value: to_value})
430
435
  return dataframe
431
436
 
432
437
 
@@ -535,6 +540,23 @@ def sub_string(dataframe, col_name, format_options, runtime_params):
535
540
  dataframe[col_name] = dataframe[col_name].astype(str).str[start:end]
536
541
  return dataframe
537
542
 
543
+ def decode_bytes_formatter(dataframe, col_name, format_options, runtime_params):
544
+ 'Decode bytes in a column using the provided encoding.'
545
+ encoding = format_options.get('encoding', 'utf-8')
546
+ strip_whitespace = format_options.get('strip_whitespace', True)
547
+ if col_name not in dataframe.columns:
548
+ raise KeyError (f"Column '{col_name}' not found.")
549
+ def decode(value):
550
+ if isinstance(value, bytes):
551
+ decoded = value.decode(encoding, errors='replace')
552
+ else:
553
+ decoded = value
554
+ if strip_whitespace and isinstance(decoded, str):
555
+ return decoded.strip()
556
+ return decoded
557
+ dataframe[col_name] = dataframe[col_name].map(decode)
558
+ return dataframe
559
+
538
560
 
539
561
  def float_precision(dataframe, col_name, format_options, runtime_params):
540
562
  """
@@ -671,6 +693,7 @@ formatter_map = {
671
693
  'conditional_replace_formatter': conditional_replace_formatter,
672
694
  'bus_day': business_day_formatter,
673
695
  'split_col': split_column_formatter,
696
+ 'decode_bytes': decode_bytes_formatter,
674
697
  'float_precision': float_precision,
675
698
  'extract_from_pattern': extract_from_pattern,
676
699
  'index_counter': index_counter,
@@ -0,0 +1,64 @@
1
+ import pandas as pd
2
+
3
+ from ingen.pre_processor.process import Process
4
+
5
+ class NotEqualsFilter(Process):
6
+
7
+ """
8
+ Filter pre_processor that excludes roes where column values match specified values.
9
+ This is the inverse of the standard 'filter' preprocessor.
10
+
11
+ Usage in YAML:
12
+ pre_processing:
13
+ - type: not_equals_filter
14
+ source: <source>
15
+ cols:
16
+ - col: <column_name>
17
+ val: ["value_to_exclude]
18
+ output_alias: <output_alias>
19
+
20
+ This will keep all rows where <column_name> is NOT in ["value_to_exclude]
21
+ """
22
+ def execute(self, config, sources_data, data):
23
+ source = config.get('source')
24
+ cols = config.get('cols', [])
25
+
26
+ #Get source data or use current data
27
+ if source and source in sources_data:
28
+ df = sources_data.get(source)
29
+ else:
30
+ df = data
31
+
32
+ if df is None or df.empty:
33
+ return pd.DataFrame()
34
+
35
+ return self.not_equals_filter(df, cols)
36
+
37
+ def not_equals_filter(self, data, cols):
38
+ """
39
+ Filter out rows where column values match any of the specified values
40
+
41
+ Args:
42
+ data: pandas Dataframe
43
+ cols: list of dicts with 'col' (column name) and 'val' (list of values to exclude)
44
+
45
+ Returns:
46
+ Dataframe with rows excluded where column matches any specified values
47
+ """
48
+ if not cols:
49
+ return data
50
+
51
+ mask = pd.Series([True] * len(data), index=data.index)
52
+
53
+ for col_config in cols:
54
+ col_name = col_config.get('col')
55
+ values_to_exclude = col_config.get('val', [])
56
+
57
+ if col_name not in data.columns:
58
+ continue
59
+
60
+ # Exclude rows where column value is in the exclusion list
61
+ # Using ~isin() to get NOT IN behavior
62
+ mask &= ~data[col_name].isin(values_to_exclude)
63
+
64
+ return data[mask].reset_index(drop=True)
@@ -0,0 +1,50 @@
1
+ import pandas as pd
2
+ from ingen.pre_processor.process import Process
3
+
4
+
5
+ class OuterJoin(Process):
6
+ """
7
+ Pre-processor that performs a full outer join between two data sources.
8
+
9
+ Usage in YAML:
10
+ pre_processing:
11
+ - type: outer_join
12
+ source: «right_source_id> left_key: ‹left_column_name> right_key: <right_column_name> output_alias: <output_alias>
13
+ Columns from left source get '_x' suffix if duplicated.
14
+ Columns from right source get '-y' suffix if duplicated.
15
+
16
+ """
17
+
18
+ def execute(self, config, sources_data, data):
19
+ """
20
+ Method responsible for calling the appropriate function to execute the outer join process.
21
+ :param config: configuration to use for outer join
22
+ :param sources_data: dictionary of data fetched from sources
23
+ :param data: pre-processed data till now
24
+ :return: A Pandas dataframe which is the result of the outer join process
25
+ """
26
+ left_dataframe = data
27
+ right_dataframe = sources_data.get(config.get('source'))
28
+ left_key = config.get('left_key')
29
+ right_key = config.get('right_key')
30
+
31
+ if left_key is not None and left_key not in left_dataframe.columns:
32
+ raise KeyError(f"Column '{left_key}' not present in left dataframe")
33
+ if right_key is not None and right_key not in right_dataframe.columns:
34
+ raise KeyError(f"Column '{right_key}' not present in right dataframe")
35
+
36
+ return self.outer_merge(left_dataframe, right_dataframe, left_key, right_key)
37
+
38
+ def outer_merge(self, left_df, right_df, left_key, right_key):
39
+ """Perform a full outer join on the two dataframes.
40
+
41
+ :param: left_df: The left dataframe
42
+ :param: right_df: The right dataframe
43
+ :param: left_key: column name to join on in left dataframe
44
+ :param: right_key: column name to join on in right dataframe
45
+ :return: outer joined dataframe with NaN values converted to empty strings
46
+ """
47
+ result = pd.merge(left_df, right_df, how='outer', left_on=left_key, right_on=right_key)
48
+ # Convert NaN to empty strings so column_condition formatters can compare with ""
49
+ result = result.fillna('')
50
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ingen-lib
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: A Python script suite that generates interface files based on the given interface metadata/config file
5
5
  Home-page: https://github.com/blackrock/interface-generator
6
6
  Maintainer: Swarna Dhakad, Piyush Ranjan, Jatin Varlyani, Pooja Katariya
@@ -41,6 +41,8 @@ ingen/pre_processor/json_array_expander.py
41
41
  ingen/pre_processor/mask.py
42
42
  ingen/pre_processor/melt.py
43
43
  ingen/pre_processor/merger.py
44
+ ingen/pre_processor/not_equals_filter.py
45
+ ingen/pre_processor/outer_join.py
44
46
  ingen/pre_processor/pre_processor.py
45
47
  ingen/pre_processor/process.py
46
48
  ingen/pre_processor/union.py
@@ -11,7 +11,7 @@ MAIN_PKG = 'ingen'
11
11
  VERSION_PY_FILE = os.path.join(MAIN_PKG, 'version.py')
12
12
 
13
13
  setup(name=PKG_NAME,
14
- version='v2.0.0',
14
+ version='v2.1.0',
15
15
  packages=setuptools.find_packages(include=['ingen', 'ingen.*']),
16
16
  package_data={},
17
17
  description='A Python script suite that generates interface files based on the given interface metadata/config '
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes