Conversation
|
closes #239 |
| "ReinsType": [ | ||
| "QS", | ||
| "CXL", | ||
| "PR" |
There was a problem hiding this comment.
using default config, I get those reinstype. So this must not be taken into account
QS
SS
AXL
It is also important because we currently don't support AXL. so on my machine, exposure run on the default fails.
| if prefix: | ||
| filename = f"{prefix}_{spec_key}" | ||
| else: | ||
| filename = f"Source{spec_key}OED" |
There was a problem hiding this comment.
I think default filename should correspond to the usual filename we have in ods_tools/oed/common.py
USUAL_FILE_NAME = {
'location': ['location'],
'account': ['account'],
'ri_info': ['ri_info', 'reinsinfo'],
'ri_scope': ['ri_scope', 'reinsscope'],
}
| "City" | ||
| ], | ||
| "fixed_values": {}, | ||
| "filename_prefix": "Test" |
There was a problem hiding this comment.
I would set the value of all filename_prefix to "", so that by default the files match the usual file name so you can exposure run directly on the folder without renaming
| if file_type == "ReinsScope": | ||
| if field_name == "ReinsNumber": | ||
| if self.context["reins_numbers"]: | ||
| return self.generator.rng.choice(self.context["reins_numbers"]) |
There was a problem hiding this comment.
the issue with the reinstype probably need to be handle here.
Not sure what the fixed_values logic is in the code. but we should explain it in the read me
sambles
left a comment
There was a problem hiding this comment.
seems pretty good, a few minor comments from me
|
|
||
| def _gen_reinsexpirydate(self, spec, file_type, row_idx, ctx): | ||
| base = datetime(2026, 1, 1) + timedelta(days=self.rng.randint(0, 365)) | ||
| return base.strftime("%Y-%m-%d") |
There was a problem hiding this comment.
I not a fan of these unused method params, i get that theses are fetched as needed.
But maybe def _gen_reinsexpirydate(self, **kwargs):
vs
def _gen_reinsexpirydate(self, spec, file_type, row_idx, ctx): ?
and only list when the param is used
| # --- Date generators --- | ||
|
|
||
| def _gen_locexpirydate(self, spec, file_type, row_idx, ctx): | ||
| return (datetime(2026, 1, 1) + timedelta(days=self.rng.randint(0, 365))).strftime("%Y-%m-%d") |
There was a problem hiding this comment.
also it might be a good idea to have the base year of the date fields configurable datetime(2026, 1, 1) ~ again, minor issue
| formatter_class=argparse.RawTextHelpFormatter) | ||
| generate_command.add_argument('--config', help='Path to JSON configuration file', default=None) | ||
| generate_command.add_argument('--output-dir', help='Output directory for generated files (default: ./oed_output)', | ||
| default='./oed_output') |
There was a problem hiding this comment.
./oed_output feels a bit too generic, maybe something like generated_oed_output/<timestamp> as a default, then it won't overwrite the same file sets.
Add OED test data generator CLI command
Add a new ods_tools generate CLI command that produces synthetic OED test data files
Loc, Acc, ReinsInfo, ReinsScope) from a JSON configuration. The generator creates files
with referential integrity across all four OED file types and supports configurable
portfolio structure, field selection, financial terms, and output format (csv/parquet).
Changes:
DataGenerator classes that produce synthetic OED data driven by a JSON config. Schema
loading updated to use the existing OedSchema class.
--output-dir, --format, --example-config, --list-versions, --list-fields, --oed-version.
Previously only convert and transform were documented.
Usage:
ods_tools generate --config config.json --output-dir ./outputods_tools generate --example-config > my_config.jsonods_tools generate --list-fields Loc --oed-version 4.0.0