Skip to content

[ocr-lambda] 혼합 학기 병합 행 과목별 학기 판정 수정 - #505

Merged
s2yeons merged 5 commits into
developfrom
fix/ocr-mixed-semester-row-handling
Sep 28, 2026
Merged

s2yeons merged 5 commits into
developfrom
fix/ocr-mixed-semester-row-handling

Conversation

@s2yeons

@s2yeons s2yeons commented Sep 27, 2026

Copy link
Copy Markdown
Member

개요 💡

생기부 OCR 변환 과정에서 kordoc이 여러 과목을 하나의 표 행으로 병합할 때, 학기 칸에도 과목 수만큼 숫자가 이어붙어 나옵니다(예: "1122"). 기존 achievementTextConverter.ts는 이 문자열 전체에 다수결을 적용해 행의 모든 과목에 같은 학기를 강제로 부여하였습니다. 실제로 학기가 섞인 행(앞 과목은 1학기, 뒤 과목은 2학기)에서는 소수 학기 과목이 잘못된 학기로 오염되었습니다. #496 이슈에 따라 이 로직을 검증하고 안전하게 처리하였습니다.

작업내용 ⌨️

  • convertTable에서 학기 숫자 문자열 길이가 과목 수(expectedCount)와 정확히 일치할 때는, 다수결 대신 각 글자를 같은 위치의 과목에 대응시켜 과목별로 정확한 학기를 부여하도록 변경하였습니다. 학기가 바뀌는 경계마다 별도 블록으로 나누어 출력합니다.
  • 문자열 길이가 과목 수보다 짧아 귀속을 확정할 수 없는 경우, 자동으로 채워 넣지 않고 unrecognizedSubjectBlobs(기존 검수 큐)에 원문을 남기도록 하였습니다.
  • 더 이상 쓰이지 않는 majoritySemesterDigit 함수를 제거하였습니다.
  • 이 모노레포에 단위 테스트 프레임워크가 없어, node:test와 tsx(신규 최소 devDependency)로 achievementTextConverter.test.ts를 추가하였습니다. 단일/혼합 학기 행, 이월(carry) 조합, 귀속 불가, 이력 기반 추론 등 5가지 케이스를 회귀 테스트로 검증하였습니다.
  • turbo.json의 test 태스크, 루트 package.json의 test 스크립트, ci.yml의 Run Unit Tests 스텝을 추가해 테스트가 CI에서 실행되도록 배선하였습니다.

관련 이슈 🚨

  • Closes #496

리뷰 요청사항 👀

  • "학기 숫자 문자열의 각 글자가 같은 순서의 과목에 1:1 대응한다"는 가정으로 구현하였습니다. 기존 코드 주석의 관찰 사례에 근거하였으나, 실제 PDF/kordoc 출력으로 직접 검증하지는 못하였습니다. 실제 생기부 샘플이 있다면 이 가정을 함께 확인 부탁드립니다.
  • unrecognizedSubjectBlobs에 남기는 블롭 포맷이 검수 화면에서 소비하기 적절한지 확인 부탁드립니다.

@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hellogsm-client-26 Ready Ready Preview Sep 28, 2026 12:47am UTC
hellogsm-client-26-admin Ready Ready Preview Sep 28, 2026 12:47am UTC

Request Review

@pr-agent-demo

pr-agent-demo Bot commented Sep 27, 2026

Copy link
Copy Markdown

⚠️ Auto-review failed: Summary generation failed: summary generation failed: terminated. Retry with /review.

@s2yeons s2yeons self-assigned this Sep 28, 2026
@s2yeons

s2yeons commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

/review

@pr-agent-demo pr-agent-demo Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Overview
    생기부 OCR 변환 로직을 수정해, 한 표 행에 여러 과목이 병합되고 학기 숫자도 이어붙여 나오는 경우를 과목별 위치 기준으로 해석하도록 변경했습니다.
    또한 길이 불일치로 학기 귀속을 확신할 수 없는 경우 자동 처리 대신 검수 대상(unrecognizedSubjectBlobs)으로 넘기고, 이를 검증하기 위한 단위 테스트와 CI 배선을 추가했습니다.

  • Intent
    기존 다수결 기반 학기 판정이 혼합 학기 행에서 일부 과목의 학기를 잘못 적용하는 문제를 수정하고, 관련 시나리오에 대한 회귀 테스트를 확보하려는 의도로 보입니다.

  • Risk

    • 중간 수준:
      • “학기 숫자 문자열의 각 글자가 같은 순서 과목에 1:1 대응한다”는 가정이 실제 kordoc/PDF 출력과 항상 일치하지 않으면 과목별 학기 오할당이 발생할 수 있습니다.
      • 한 행 안에서 학기 경계마다 분할 출력하는 방식은 기존 파서/서버 계약과 호환되는지 확인이 필요합니다.
      • unrecognizedSubjectBlobs 포맷이 검수 화면에서 적절히 소비되는지, 기존 동작과 충돌이 없는지 점검이 필요합니다.
      • 테스트 인프라(tsx, node:test, CI 스크립트) 추가는 부수적 의존성/빌드 영향만 있고, 코드 로직 변경 자체는 비교적 국소적입니다.

0 inline comment(s)

@junjuny0227 junjuny0227 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

실제 실행으로 확인한 학기 오귀속 1건(P1)과 검수 경로 누락 1건(P2)이 있어 수정 요청합니다. pnpm test(5/5), OCR 타입 검사, pnpm lint, pnpm build는 통과했습니다. 실제 PDF/kordoc 출력의 과목-학기 1:1 순서 대응은 샘플이 없어 확인하지 못했습니다.

@junjuny0227 junjuny0227 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다

@s2yeons
s2yeons merged commit a2ef954 into develop Sep 28, 2026
5 checks passed
@s2yeons
s2yeons deleted the fix/ocr-mixed-semester-row-handling branch September 28, 2026 01:50

This branch was successfully deployed

2 active deployments
Preview – hellogsm-client-26-admin — 8e626a78 Deployed Sep 28, 2026 by vercel[bot]
Preview – hellogsm-client-26 — 8e626a78 Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants