[WIP] feat: 직업과 신체 부위로 메인 검색 화면을 바꿉니다 - #13
Draft
wagurano wants to merge 2 commits into
Draft
Conversation
KSCO 직업분류와 추출 데이터를 연동한 새 메인 검색 화면을 추가합니다. 판정서에 직업·근무조건·신체부위 정보를 추가하고 이를 이용한 검색 화면을 만듭니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
기존
/(전문 검색 화면)를/search로 옮기고, 그 자리에 직업·근무조건·신체부위·사망 여부·신청서 유형으로 판정서를 찾는 새 메인 검색 화면을 만듭니다.wip/extract_disease_cases_details_cerebras-ksco.csv(LLM으로 55,377건에서 추출한 직업·근무조건·KSCO 매핑)와wip/ksco-level-4-details.csv(한국표준직업분류 코드 체계)를 새로 활용합니다.DiseaseCase에 컬럼 18개 추가(job_name,job_description,employment_type,work_type,job_tenure_months,weekly_work_hours,daily_work_hours,burden_body_part,bad_posture,heavy_lifting,max_item_weight,daily_total_weight,other_harmful_factors,work_relevance_eval,aggravating_factors,main_reasoning,death_status,application_type)KscoCode·DiseaseCaseKscoCode(판정서 ↔ KSCO 코드 N:M, 유사도 포함)DiseaseCasesController#main(/), 기존#index는/search로 라우트만 이동app/mcp/tools/search_disease_cases_tool.rb에job_name/job_description/death_status/ksco_code구조화 필터 추가, 기존work_match?/symptom_match?같은 ad-hoc 키워드 매칭 제거DiseaseCase를 확장했습니다(근거는docs/workercare-search.plan.md2절).부담_신체_부위처럼 원본이 파이프(|) 구분 다중값인 필드는 별도 조인 테이블을 만들지 않고, 파이프 경계를 인식하는LIKE매칭으로 필터링하도록 결정했습니다 — 판정서 규모(5만여 건)에서 조인 테이블의 복잡도 대비 필터 정확도 이득이 크지 않다고 판단했습니다.ksco_codes·disease_case_ksco_codes신규 테이블,disease_cases컬럼 18개 추가,disease_cases_extracted_ftsFTS5 가상 테이블+트리거)가 있고, 데이터 임포트는 마이그레이션에 포함되지 않아 배포 후 rake task를 별도로 1회 실행해야 합니다(아래 체크리스트). 구현 중 기존 데이터(6만여 건) 위에 FTS5 external content 테이블을 트리거만 만들고 rebuild 없이 추가하면UPDATE시 DB가 손상되는 버그(SQLite3::CorruptException)를 발견해, 마이그레이션에서 트리거 생성 전에rebuild를 먼저 실행하도록 고쳤습니다(자세한 내용은docs/workercare-search.plan.md10절 리스크 표).work_type/application_type처럼 자유 텍스트인 필드의 enum 전환 여부는 실제 운영 데이터 profiling 후 결정하기로 미뤄뒀습니다.ksco_codes_json이 비어있을 때 기존 KSCO 매핑을 지우지 않는 안전한 기본값(10절 리스크 표)이 실제 재추출 주기에서도 계속 맞는 선택인지 재검토가 필요합니다.병합 전후 체크리스트
/에서 직업(직종명)·하는일(담당 업무) 텍스트 필터, 아픈 신체 부위 체크박스, 사망 여부 토글, 신청서 유형 드롭다운을 조합해 검색 결과가 기대대로 좁혀지는지 확인합니다./search(기존 전문 검색 화면)가 URL만 바뀌고 기능은 그대로인지 회귀 확인합니다.search_disease_cases툴에job_name/death_status/ksco_code파라미터를 넘겨 정상 필터링되는지 확인합니다.병합 시점
급하게 배포할 필요는 없습니다. 다만 병합 후 아래 데이터 임포트(약 5~10분, 55,377건)를 바로 실행할 수 있는 시점을 권장합니다.
배포 전후 체크리스트
bin/rails db:migrate로 새 마이그레이션 4개(특히disease_cases_extracted_fts가상 테이블)가 정상 적용됐는지 확인합니다.판정서 없음·KSCO 코드 없음경고는 참조 데이터 누락으로 소량이면 정상이지만, 대량으로 나오면 CSV 경로나 매칭을 다시 확인합니다.