def build_overlay_rows(*, case_uuid, sop_instance_uid, source_id, source_relpath, output_dicom_relpath, overlays, image_shape): h, w = image_shape rows = [] for ov in overlays: x, y, ow, oh = ov["bbox"] rows.append({ "case_uuid": case_uuid, "sop_instance_uid": sop_instance_uid, "source_id": source_id, "source_relpath": source_relpath, "output_dicom_relpath": output_dicom_relpath, "image_h": h, "image_w": w, "region": "top_left_banner", "phi_category": ov["phi_category"], "phi_value": ov["phi_value"], "rendered_text": ov["rendered_text"], "bbox_x": x, "bbox_y": y, "bbox_w": ow, "bbox_h": oh, "dicom_tag": ov["dicom_tag"], "seed": SEED, "pipeline_version": PIPELINE_VERSION, "run_id": RUN_ID, }) return rows