Spaces:
Running
Running
Download demo-data.js from Hugdrigo/education-data-lab: direct link, hf CLI and curl.
- Browser
- Download file 978 Bytes
-
https://huggingface.co/spaces/Hugdrigo/education-data-lab/resolve/main/demo-data.js
- Command line
-
hf download hf://spaces/Hugdrigo/education-data-lab/demo-data.js
-
curl -L -o demo-data.js https://huggingface.co/spaces/Hugdrigo/education-data-lab/resolve/main/demo-data.js
978 Bytes
| import {IDS,COUNTRY_IDS,normalizeRows} from './core.js'; | |
| // Generated for interface tests only. Values are NOT World Bank observations. | |
| function noise(a,b,c){let x=Math.sin((a+1)*12.9898+(b+1)*78.233+(c+1)*37.719)*43758.5453;return (x-Math.floor(x)-0.5)*2;} | |
| export function createDemo(){const codes=COUNTRY_IDS,rows=[];for(let c=0;c<codes.length;c++)for(let year=2005;year<=2025;year++)for(let j=0;j<IDS.length;j++){ | |
| const t=year-2005, v=noise(c,t,j),slow=(c%5)*2.8, base=[73+slow,68+slow,31+slow,3.1+(c%4)*0.35,82+slow,29+slow,4500+c*1400,3900000+c*5200000][j]; | |
| const step=[0.64,0.66,0.96,0.025,0.32,2.6,210,11000][j]; | |
| const amp=[2.1,2.3,3.5,0.3,1.3,2.2,600,4000][j]; | |
| if(noise(c+7,t+11,j+3)>.70 && (j===3||j===4||j===2))continue; | |
| let value=base+step*t+v*amp; | |
| if(j===3)value=Math.max(0.6,value);if(j===4||j===5)value=Math.min(99.9,Math.max(0,value)); | |
| rows.push({iso3:codes[c],year,indicator:IDS[j],value:Number(value.toFixed(j===7?0:2))}); | |
| }return normalizeRows(rows);} | |