gov-scraper: 마스터 사업계획서 + 공고 매칭/추출 스크립트 추가
- docs/business-plans.md: Tasteby/Lyricsy/Parents Story 3개 앱 PSST 사업계획서 초안 - scripts/match.js: 앱별 주제 키워드 매칭 조회 - scripts/eligible.js: 예비창업자 자격 + 현재 열린 공고 목록 - scripts/export_eligible_csv.js: 신청 추적용 CSV(exports/) 생성 - exports/ gitignore Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
37
government/scripts/eligible.js
Normal file
37
government/scripts/eligible.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// 예비창업자가 지원 가능(자격에 '예비창업' 명시)하고 현재 열린 공고 전체를 마감일 순으로.
|
||||
// 실행: LD_LIBRARY_PATH=$ORACLE_IC_LIB_DIR node scripts/eligible.js
|
||||
import { withConnection, closePool, oracledb } from '../src/db.js';
|
||||
|
||||
const SQL = `
|
||||
SELECT * FROM (
|
||||
SELECT title, category, agency, source_code, detail_url, apply_end,
|
||||
CASE WHEN apply_end IS NULL THEN 9999 ELSE (apply_end - TRUNC(SYSDATE)) END AS dleft,
|
||||
ROW_NUMBER() OVER (PARTITION BY title ORDER BY CASE source_code WHEN 'kstartup' THEN 1 WHEN 'bizinfo' THEN 2 ELSE 3 END) rn
|
||||
FROM gov_opportunity
|
||||
WHERE (apply_end IS NULL OR apply_end >= TRUNC(SYSDATE))
|
||||
AND (
|
||||
target LIKE '%' || :k1 || '%'
|
||||
OR target LIKE '%' || :k2 || '%'
|
||||
OR DBMS_LOB.INSTR(body_text, :k1) > 0
|
||||
OR DBMS_LOB.INSTR(body_text, :k2) > 0
|
||||
)
|
||||
)
|
||||
WHERE rn = 1
|
||||
ORDER BY dleft ASC
|
||||
FETCH FIRST 80 ROWS ONLY`;
|
||||
|
||||
await withConnection(async (conn) => {
|
||||
const r = await conn.execute(
|
||||
SQL,
|
||||
{ k1: '예비창업', k2: '예비 창업' },
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
||||
);
|
||||
console.log(`현재 신청가능(예비창업자 자격) 공고: ${r.rows.length}건\n`);
|
||||
for (const x of r.rows) {
|
||||
const tag = x.DLEFT === 9999 ? '[상시]' : `[D-${x.DLEFT}]`;
|
||||
console.log(
|
||||
`${tag}\t${x.SOURCE_CODE}\t${(x.CATEGORY || '-').slice(0, 8)}\t${x.TITLE.slice(0, 52)}\t${x.DETAIL_URL}`
|
||||
);
|
||||
}
|
||||
});
|
||||
await closePool();
|
||||
Reference in New Issue
Block a user