@@ -10,39 +10,37 @@ const waterEntities = csvParse(fs.readFileSync(`${waterRootDir}/entities.csv`, '
10
10
11
11
// const waterOptimisationIndex = indexCore(waterIndicators, waterEntities);
12
12
13
- const inclusiveIternetRootDir = 'data/inclusiveinternet' ;
13
+ const inclusiveIternetRootDir = 'data/inclusiveinternet/2021 ' ;
14
14
15
15
const inclusiveInternetIndicators = csvParse ( fs . readFileSync ( `${ inclusiveIternetRootDir } /indicators.csv` , 'utf-8' ) ) ;
16
16
const inclusiveInternetEntities = csvParse ( fs . readFileSync ( `${ inclusiveIternetRootDir } /entities.csv` , 'utf-8' ) ) ;
17
-
18
17
const inclusiveInternetIndex = indexCore ( inclusiveInternetIndicators , inclusiveInternetEntities ) ;
19
18
20
19
21
- const simpleRootDir = 'data/simple-index-set' ;
22
-
23
- const simpleIndicators = csvParse ( fs . readFileSync ( ` ${ simpleRootDir } /indicators.csv` , 'utf-8' ) ) ;
24
- const simpleEntities = csvParse ( fs . readFileSync ( ` ${ simpleRootDir } /entities.csv` , 'utf-8' ) ) ;
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' ) )
25
24
26
- const simpleIndex = indexCore ( simpleIndicators , simpleEntities ) ;
25
+ inclusiveInternetIndex . adjustValue ( 'Singapore' , '1.2.1' , 50 ) ;
27
26
28
- console . log ( simpleIndex . indexedData )
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' ) )
29
32
30
- // console.log(waterOptimisationIndex.indexedData['Abu Dhabi']['1']);
31
- // console.log(waterOptimisationIndex.indexedData['Abu Dhabi'].value);
32
- // console.log(waterOptimisationIndex.indexStructure);
33
- // console.log(waterOptimisationIndex.getIndexMean('1.1'))
34
- // console.log(waterOptimisationIndex.getIndexMean('2.1.1'))
35
- // console.log(waterOptimisationIndex.getIndexMean())
33
+ // const simpleRootDir = 'data/simple-index-set';
36
34
37
- // indicator 3.4.4 in the water index has .a and .b sub indicators
38
- // for this indicator abu dhabi has different values for a and b
39
- // const before = JSON.stringify(waterOptimisationIndex.getEntity('Abu Dhabi'), null, ' ')
40
- // delete before.data;
41
- // waterOptimisationIndex.filterIndicators(indicator=>{
42
- // return String(indicator.id).indexOf('b')>0; // if the indicator includes "b" in it's id ignore it
43
- // })
44
- // const after = JSON.stringify(waterOptimisationIndex.getEntity('Abu Dhabi'), null, ' ')
45
- // delete after.data; // just for neater output (note data is the original data for an entity used to calculate the index)
35
+ // const simpleIndicators = csvParse(fs.readFileSync(`${simpleRootDir}/indicators.csv`, 'utf-8'));
36
+ // const simpleEntities = csvParse(fs.readFileSync(`${simpleRootDir}/entities.csv`, 'utf-8'));
46
37
47
- // console.log('BEFORE', before);
48
- // console.log('AFTER', after);
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