code wiki / _hdl_build / nx_ciq_analyst.nx
nx_ciq_analyst.nx
buildroot/runtime/_hdl_build/nx_ciq_analyst.nx
about
nx_ciq_analyst.nx -- R1 of the CIQ arc, now MARKET-GENERIC: the ANALYST. Reads the markets registry
("ciq:markets" -> list) from the SOVEREIGN seg_store and, for EACH market, computes per entity the two
Gartner Magic-Quadrant axes in no-float permil (0..1000):
Ability-to-Execute = weighted level over the KNOWN E-axis cells / max possible
Completeness-of-Vision = weighted level over the KNOWN V-axis cells / max possible
plus an honest data-COMPLETENESS permil per entity. LIAR-KILL: a FULL cell (level==max) with NO cited
evidence is invalid -> RED. Scores are written back ("ciq:<market>:score:<entity>") for the placer.
Generic over markets via inline key-building (ciq:<market>:meta / :cap:<name> / :score:<entity>), so a
new market = a new ingest organ + a markets-list entry, ZERO change here. Thresholds = NAMED consts
(rule #11). Mirrors nx_codata_ingest's sovereign store idiom. license_tier: ORIGINAL expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_canon_cid.nxnx_seg_store.nxnx_uxf_decode.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 15 | const AQ_MAGIC_1024: i64 = 1024 |
| 16 | const AQ_MAGIC_8192: i64 = 8192 |
| 18 | const AQ_STORE: *u8 = "knowledge/store/ciq-" |
| 19 | const AQ_MAXLEVEL: i64 = 2 |
| 20 | const AQ_COMPL_FLOOR: i64 = 400 |
functions
| 22 | func aw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 23 | func an(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 24 | func aq_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 } |
| 25 | func aq_itoa(v: i64, b: *u8) -> i64 { var m: i64=v; if m<0{m=0-m} let t: *u8=sys_mmap(32); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} b[k]=0 as u8; return k } |
| 26 | func aq_pint(s: *u8) -> i64 { var v: i64=0; var i: i64=0; var go: i64=1; while go==1 { let c: i64=s[i]; if c>=48 { if c<=57 { v=v*10+(c-48); i=i+1 } else { go=0 } } else { go=0 } } return v } called by 1: score_market |
| 27 | func aq_field(dk: *i64, dv: *i64, nf: i64, name: *u8) -> *u8 { var f: i64=0; while f<nf { if aq_streq(dk[f] as *u8, name)==1 { return dv[f] as *u8 } f=f+1 } return 0 as *u8 } |
| 28 | func aq_split(buf: *u8, delim: i64, out: *i64, maxn: i64) -> i64 { var n: i64=0; var i: i64=0; var intok: i64=0; while buf[i]!=(0 as u8) { let c: i64=buf[i]; if c==delim { buf[i]=0 as u8; intok=0 } else { if intok==0 { if n<maxn { out[n]=(buf as i64)+i; n=n+1 } intok=1 } } i=i+1 } return n } |
| 29 | func aq_copy(src: *u8, dst: *u8) -> i64 { var i: i64=0; while src[i]!=(0 as u8){ dst[i]=src[i]; i=i+1 } dst[i]=0 as u8; return i } |
| 30 | func aq_hasev(cell: *u8) -> i64 { var i: i64=0; while cell[i]!=(0 as u8){ if cell[i]==(33 as u8){ if cell[i+1]!=(0 as u8){ return 1 } } i=i+1 } return 0 } called by 1: score_market |
| 31 | func aq_invalid(level: i64, has_ev: i64) -> i64 { if level==AQ_MAXLEVEL { if has_ev==0 { return 1 } } return 0 } |
| 33 | func aq_key(buf: *u8, market: *u8, suffix: *u8) -> i64 { var o: i64=0; o=ss_cat(buf,o,"ciq:" as *u8); o=ss_cat(buf,o,market); o=ss_cat(buf,o,":" as *u8); o=ss_cat(buf,o,suffix); buf[o]=0 as u8; return o } |
| 36 | func score_market(market: *u8, sw: *i64) -> i64 |
| 134 | func main() -> i64 |