(
section_map: dict[str, str],
section_sources: dict[str, str],
)
| 106 | |
| 107 | |
| 108 | def build_section_extraction_coverage( |
| 109 | section_map: dict[str, str], |
| 110 | section_sources: dict[str, str], |
| 111 | ) -> dict: |
| 112 | core_sections_found = [section for section in CORE_SECTIONS if section_map.get(section)] |
| 113 | missing_core_sections = [section for section in CORE_SECTIONS if section not in core_sections_found] |
| 114 | fallback_sections = [ |
| 115 | section |
| 116 | for section, source in section_sources.items() |
| 117 | if section != "abstract" and source == "abstract" |
| 118 | ] |
| 119 | if len(core_sections_found) >= len(CORE_SECTIONS): |
| 120 | coverage_status = "good" |
| 121 | elif core_sections_found: |
| 122 | coverage_status = "partial" |
| 123 | else: |
| 124 | coverage_status = "poor" |
| 125 | return { |
| 126 | "coverage_status": coverage_status, |
| 127 | "recognized_sections": list(section_map.keys()), |
| 128 | "core_sections_found": core_sections_found, |
| 129 | "missing_core_sections": missing_core_sections, |
| 130 | "section_text_chars": { |
| 131 | section: len(normalize_whitespace(text)) |
| 132 | for section, text in section_map.items() |
| 133 | if normalize_whitespace(text) |
| 134 | }, |
| 135 | "fallback_sections": fallback_sections, |
| 136 | } |
| 137 | |
| 138 | |
| 139 | def empty_appendix_evidence() -> dict[str, list[dict]]: |
no test coverage detected