Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / db/queries/opportunity_records.sql |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | db/queries/opportunity_records.sql |
| Original SHA-256 | d4ef23e855ef4fcc0047bccb8041c6094847086b7bd23abf7926eea7734a0188 |
| Git blob SHA | ea43ed6faf9410e6a629e1572f44fe2b3e30c8a3 |
| Reading-copy SHA-256 | d4ef23e855ef4fcc0047bccb8041c6094847086b7bd23abf7926eea7734a0188 |
Every recorded occurrence
These 15 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / db/queries/opportunity_records.sql | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / db/queries/opportunity_records.sql | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓74 lines · 3.9 KB
-- Opportunity Intelligence unified records. Global public catalog (no organization_id, outside RLS):
-- reads run straight off the pool, writes come from cmd/opp-sync as the migrator role.
-- name: UpsertOpportunityRecord :exec
INSERT INTO opportunity_records (
source_name, source_record_id, dedupe_key, record_kind, title, agency, sub_agency,
naics, psc, pop_city, pop_state, pop_country, pop_zip, set_aside, set_aside_code,
contract_vehicle, estimated_value, value_source, incumbent_name, incumbent_uei,
posted_date, response_deadline, award_date, estimated_award_date, pop_start_date, pop_end_date,
ui_link, is_planning, raw_object_key, raw_sha256, fetched_at, synced_at
) VALUES (
$1, $2, $3, $4, $5, $6, $7,
$8, $9, $10, $11, $12, $13, $14, $15,
$16, $17, $18, $19, $20,
$21, $22, $23, $24, $25, $26,
$27, $28, $29, $30, $31, now()
)
ON CONFLICT (source_name, source_record_id) DO UPDATE SET
dedupe_key = EXCLUDED.dedupe_key,
record_kind = EXCLUDED.record_kind,
title = EXCLUDED.title,
agency = EXCLUDED.agency,
sub_agency = EXCLUDED.sub_agency,
naics = EXCLUDED.naics,
psc = EXCLUDED.psc,
pop_city = EXCLUDED.pop_city,
pop_state = EXCLUDED.pop_state,
pop_country = EXCLUDED.pop_country,
pop_zip = EXCLUDED.pop_zip,
set_aside = EXCLUDED.set_aside,
set_aside_code = EXCLUDED.set_aside_code,
contract_vehicle = EXCLUDED.contract_vehicle,
estimated_value = EXCLUDED.estimated_value,
value_source = EXCLUDED.value_source,
incumbent_name = EXCLUDED.incumbent_name,
incumbent_uei = EXCLUDED.incumbent_uei,
posted_date = EXCLUDED.posted_date,
response_deadline = EXCLUDED.response_deadline,
award_date = EXCLUDED.award_date,
estimated_award_date = EXCLUDED.estimated_award_date,
pop_start_date = EXCLUDED.pop_start_date,
pop_end_date = EXCLUDED.pop_end_date,
ui_link = EXCLUDED.ui_link,
is_planning = EXCLUDED.is_planning,
raw_object_key = EXCLUDED.raw_object_key,
raw_sha256 = EXCLUDED.raw_sha256,
fetched_at = EXCLUDED.fetched_at,
synced_at = now();
-- name: GetOpportunityRecord :one
SELECT * FROM opportunity_records WHERE id = $1;
-- name: OpportunityRecordMeta :one
SELECT COUNT(*)::bigint AS total, MAX(synced_at) AS last_synced FROM opportunity_records;
-- name: ListOpportunityRecords :many
-- Optional filters (NULL array = no filter). Soonest closing first, then most recently posted, then id
-- as a unique tiebreaker so the order is deterministic. Text equality filters compare upper() on both
-- sides; the service upper cases the params so casing drift cannot silently zero out results. The
-- optional missions filter keeps a record only when a federal_mission_tag links it to one of the named
-- mission codes; a NULL missions array means no mission filter, so the default path is unchanged.
SELECT * FROM opportunity_records
WHERE (sqlc.narg('kinds')::text[] IS NULL OR record_kind = ANY(sqlc.narg('kinds')::text[]))
AND (sqlc.narg('naics')::text[] IS NULL OR naics = ANY(sqlc.narg('naics')::text[]))
AND (sqlc.narg('agencies')::text[] IS NULL OR upper(agency) = ANY(sqlc.narg('agencies')::text[]))
AND (sqlc.narg('states')::text[] IS NULL OR upper(pop_state) = ANY(sqlc.narg('states')::text[]))
AND (sqlc.narg('missions')::text[] IS NULL OR EXISTS (
SELECT 1 FROM federal_mission_tags t
WHERE t.record_table = 'opportunity_records'
AND t.record_id = opportunity_records.id::text
AND t.mission_code = ANY(sqlc.narg('missions')::text[])))
ORDER BY (response_deadline IS NULL OR response_deadline < now()), response_deadline ASC, posted_date DESC NULLS LAST, id
LIMIT sqlc.arg('lim')::int;