Parse the Line Items field (stored as JSON string in the schema).
(line_items_field: Any)
| 147 | |
| 148 | |
| 149 | def parse_line_items(line_items_field: Any) -> list[dict]: |
| 150 | """Parse the Line Items field (stored as JSON string in the schema).""" |
| 151 | if line_items_field is None: |
| 152 | return [] |
| 153 | if isinstance(line_items_field, list): |
| 154 | return line_items_field |
| 155 | if isinstance(line_items_field, str): |
| 156 | try: |
| 157 | parsed = json.loads(line_items_field) |
| 158 | return parsed if isinstance(parsed, list) else [] |
| 159 | except (json.JSONDecodeError, TypeError): |
| 160 | return [] |
| 161 | return [] |
| 162 | |
| 163 | |
| 164 | def compare_decision( |
no outgoing calls
no test coverage detected