본문으로 건너뛰기

레시피 수집(ETL)

이 문서로 해결할 질문

  • Mealio 레시피 데이터는 어디서 오고 어떻게 가공되나요?
  • fetch·parse-submit·parse-retrieve·persist·embed-submit·embed-retrieve 단계는 각각 무엇을 하나요?
  • 로컬에서 파이프라인 job을 어떻게 실행하나요?

목적

식약처 공공데이터 레시피를 수집하고, OpenAI Batch API로 정규화·매핑한 뒤 PostgreSQL에 영속화합니다.

단계 요약

단계실행결과
fetchcron / CLIstatus: fetched
parse-submitcron / CLIparse_batch_id, parse_submitted
parse-retrievecron / CLIparse_retrieved + Kafka 이벤트
persistalways-on consumerpersisted + Recipe row
embed-submitcron / CLI + Kafkaembed_batch_id, embed_submitted
embed-retrievecron / CLIRecipeEmbedding(pgvector) upsert + embed_retrieved

저장소

저장소내용
MongoDB recipe_ingestion_jobs파이프라인 job 문서
MongoDB recipe_ingestion_stateAPI 페이징 커서
PostgreSQL최종 Recipe 도메인·RecipeEmbedding(pgvector)

운영 특성

  • fetch, parse-submit, parse-retrieve, embed-submit, embed-retrieve독립 job이며 cron으로 조율합니다.
  • fetch·submit cron 주기와 fetchLimit는 운영 runbook에서 조율합니다.
  • persist는 always-on Consumer가 Kafka 이벤트를 소비해 PostgreSQL에 반영합니다.

로컬 실행 (CLI)

인프라·Consumer가 기동된 상태에서 루트 스크립트로 각 단계를 실행할 수 있습니다.

pnpm run recipe-ingestion:fetch
pnpm run recipe-ingestion:parse-submit
pnpm run recipe-ingestion:parse-retrieve
pnpm run recipe-ingestion:embed-submit
pnpm run recipe-ingestion:embed-retrieve

관련 문서