Skip to content

Commit

Permalink
Let ConvertRepresentationStep ignore unspecified result properties
Browse files Browse the repository at this point in the history
  • Loading branch information
shirte committed Dec 8, 2024
1 parent d8d094b commit 1c01cec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nerdd_module/model/convert_representations_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ def __init__(
self, result_properties: List[ResultProperty], output_format: str, **kwargs: Any
) -> None:
super().__init__()
self._result_properties = result_properties
self._converter_map = {
p.name: Converter.get_converter(p, output_format, **kwargs) for p in result_properties
}

def _process(self, record: dict) -> dict:
result = {
k: self._converter_map[k].convert(input=v, context=record) for k, v in record.items()
k.name: self._converter_map[k.name].convert(
input=record.get(k.name, None), context=record
)
for k in self._result_properties
}

return {k: v for k, v in result.items() if v is not Converter.HIDE}

0 comments on commit 1c01cec

Please sign in to comment.