|
1 |
| -import { clone } from './src/utils.js'; |
2 | 1 | import {csvParse} from 'd3';
|
3 | 2 | import fs from 'fs';
|
4 | 3 | import indexCore from './src/index-core.js';
|
5 | 4 |
|
6 |
| -const waterRootDir = 'data/wateroptimisation'; |
| 5 | +const simpleRootDir = 'data/simple-index-set'; |
7 | 6 |
|
8 |
| -const waterIndicators = csvParse(fs.readFileSync(`${waterRootDir}/indicators.csv`, 'utf-8')); |
9 |
| -const waterEntities = csvParse(fs.readFileSync(`${waterRootDir}/entities.csv`, 'utf-8')); |
| 7 | +const simpleIndicators = csvParse(fs.readFileSync(`${simpleRootDir}/indicators.csv`, 'utf-8')); |
| 8 | +const simpleEntities = csvParse(fs.readFileSync(`${simpleRootDir}/entities.csv`, 'utf-8')); |
10 | 9 |
|
11 |
| -// const waterOptimisationIndex = indexCore(waterIndicators, waterEntities); |
| 10 | +const simpleIndex = indexCore(simpleIndicators, simpleEntities, 100 ,true, true); |
| 11 | +const simpleIndexUnrestricted = indexCore(simpleIndicators, simpleEntities); |
12 | 12 |
|
13 |
| -const inclusiveIternetRootDir = 'data/inclusiveinternet/2021'; |
| 13 | +//console.log( simpleIndex.getEntity('Chinatown') ) |
| 14 | +console.log( simpleIndex.getEntity('Chinatown').value, 'vs', simpleIndexUnrestricted.getEntity('Chinatown').value ); |
| 15 | +console.log( simpleIndex.getEntity('Chinatown')['1'], 'vs', simpleIndexUnrestricted.getEntity('Chinatown')['1'] ) |
| 16 | +console.log( simpleIndex.getEntity('Chinatown')['1.4'], 'vs', simpleIndexUnrestricted.getEntity('Chinatown')['1.4'] ) |
14 | 17 |
|
15 |
| -const inclusiveInternetIndicators = csvParse(fs.readFileSync(`${inclusiveIternetRootDir}/indicators.csv`, 'utf-8')); |
16 |
| -const inclusiveInternetEntities = csvParse(fs.readFileSync(`${inclusiveIternetRootDir}/entities.csv`, 'utf-8')); |
17 |
| -const inclusiveInternetIndex = indexCore(inclusiveInternetIndicators, inclusiveInternetEntities); |
18 |
| - |
19 |
| - |
20 |
| -// console.log('value', inclusiveInternetIndex.indexedData['Singapore']['value']) |
21 |
| -// console.log('1', inclusiveInternetIndex.indexedData['Singapore']['1']) |
22 |
| -// console.log('1.2', inclusiveInternetIndex.indexedData['Singapore']['1.2']) |
23 |
| -// console.log('1.2.1', inclusiveInternetIndex.getEntityIndicator('Singapore','1.2.1')) |
24 |
| - |
25 |
| -console.log(inclusiveInternetIndex.adjustValue('Singapore','1.2.1',50)); |
26 |
| - |
27 |
| -// console.log('adjusted') |
28 |
| -// console.log('value', inclusiveInternetIndex.indexedData['Singapore']['value']) |
29 |
| -// console.log('1', inclusiveInternetIndex.indexedData['Singapore']['1']) |
30 |
| -// console.log('1.2', inclusiveInternetIndex.indexedData['Singapore']['1.2']) |
31 |
| -// console.log('1.2.1', inclusiveInternetIndex.getEntityIndicator('Singapore','1.2.1')) |
32 |
| - |
33 |
| -// const simpleRootDir = 'data/simple-index-set'; |
34 |
| - |
35 |
| -// const simpleIndicators = csvParse(fs.readFileSync(`${simpleRootDir}/indicators.csv`, 'utf-8')); |
36 |
| -// const simpleEntities = csvParse(fs.readFileSync(`${simpleRootDir}/entities.csv`, 'utf-8')); |
37 |
| - |
38 |
| -// const simpleIndex = indexCore(simpleIndicators, simpleEntities); |
39 |
| -// console.log(simpleIndex.indexedData['Monopoly'].value) |
40 |
| -// console.log(simpleIndex.indexedData['Monopoly']['1']) |
41 |
| -// console.log(simpleIndex.indexedData['Monopoly']['1.1']) |
42 |
| -// simpleIndex.adjustValue('Monopoly','1.1',10); |
43 |
| -// console.log('---'); |
44 |
| -// console.log(simpleIndex.indexedData['Monopoly'].value) |
45 |
| -// console.log(simpleIndex.indexedData['Monopoly']['1']) |
46 |
| -// console.log(simpleIndex.indexedData['Monopoly']['1.1']) |
0 commit comments