From 2a4b71fa0f769a9d8cc7bd172ba85b622c539609 Mon Sep 17 00:00:00 2001 From: ThatcherK Date: Wed, 18 Oct 2023 11:07:22 +0300 Subject: [PATCH] Revert back to main data branch --- assets/core.js | 2 +- src/core/oecd/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/core.js b/assets/core.js index b5ab9c48..4c78b82f 100644 --- a/assets/core.js +++ b/assets/core.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{10:function(t,e,n){},19:function(t,e,n){"use strict";n.r(e);n(9);var a=n(5),r=n(2),o=function(){function t(){this.id=Math.random(),this.state={},this.listeners=[],Object(r.d)(this,{state:r.e,setState:r.a,getState:r.c})}var e=t.prototype;return e.setState=function(t,e){void 0===e&&(e=!0),this.state=e?Object.assign({},this.state,t):t},e.addListener=function(t){return this.listeners=this.listeners.concat(Object(r.b)(t)),this.listeners.length-1},e.removeListener=function(t){t0})))))},s=["Reproductive health","Maternal and newborn health","Child health","RMNCH (total)"],f=["% of RMNCH","% of Health ODA","% of total ODA"],h=["Reproductive health","Maternal and newborn health","Child health","Core contributions to multilaterals benefiting RMNCH"],m=[2012,2021],p=["African Development Fund","Arab Fund (AFESD)","Asian Development Bank","EU Institutions","Global Environment Facility","Inter-American Development Bank","International Development Association","Islamic Development Bank","OPEC Fund for International Development","UN Peacebuilding Fund","UNDP","UNECE","UNFPA","UNICEF","World Health Organisation","All donors (total)","Multilateral donors (total)"],b=n(6);function v(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0;return function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n"+t.title+""}}}},color:M.rainbow,xAxis:{axisLabel:{fontFamily:"Geomanist Regular,sans-serif",fontSize:13},splitLine:{show:!1}},yAxis:{axisLabel:{fontFamily:"Geomanist Regular,sans-serif",fontSize:13},splitLine:{show:!1}},axisPointer:{type:"none"},grid:{top:10}},j=c.a.createElement("div",{className:"no-data"},"No Data"),U=function(){return j},H=function(t,e,n,a,r){return function(t,e,n){return e.reduce((function(e,a){var r=t.filter((function(t){return""+t.Year==""+a})).reduce((function(t,e){return t+Number(e[n]||0)}),0);return e.concat(r)}),[])}(N(t,[e],r),n,a)},_=function(t,e){void 0===e&&(e=!0),e?t.classList.remove("invisible"):t.classList.add("invisible")},T=c.a.createElement(U,null),G=function(t,e){var n=h.slice();if(p.includes(t[0]["Donor.Name"]))for(var a=0;a0})))))};function z(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return J(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0;return function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n=1){var r=e.reduce((function(t,e){return Number(t[2021])=1){var c=e.reduce((function(t,e){return Number(t[2021])=1&&e.push([n+1,t[n].recipient_name,g(Number(t[n][2017]),0),g(Number(t[n][2018]),0),g(Number(t[n][2019]),0),g(Number(t[n][2020]),0),g(Number(t[n][2021]),0)]);return e}for(var a=0;a<10;a++)t.length>=1&&e.push([a+1,t[a].recipient_name,g(Number(t[a][2017]),0),g(Number(t[a][2018]),0),g(Number(t[a][2019]),0),g(Number(t[a][2020]),0),g(Number(t[a][2021]),0)]);return e}(h)).concat([["Total of all other recipients"].concat(m)]);a.render(c.a.createElement($,{rows:p}))},W=function(t){window.DICharts.handler.addChart({className:t,echarts:{onAdd:function(t){Array.prototype.forEach.call(t,(function(t){var e=new window.DICharts.Chart(t.parentElement);e.showLoading();var n,a=L(t),r="Reproductive health",o="United States",i=Object(l.createRoot)(t);window.DIState?window.DIState.addListener((function(){e.showLoading();var c=window.DIState.getState,l=c.country,u=c.dataTwo;(o=l)&&u&&(n||(n=O({wrapper:a,options:u.reduce((function(t,e){var n=e["Code type"];return n&&!t.includes(n)?t.concat(n):t}),[]),defaultOption:r,className:"purpose-code-filter",label:"Select RMNCH category"})).addEventListener("change",(function(t){r=t.target.value,Y(u,o,r,i)})),Y(u,o,r,i),e.hideLoading(),t.parentElement.classList.add("auto-height"))})):(console.log("State is not defined"),e.hideLoading())}))}}})},q=function(t){window.DICharts.handler.addChart({className:t,d3:{onAdd:function(t){Array.prototype.forEach.call(t,(function(t){var e=new window.DICharts.Chart(t.parentElement);e.showLoading();D("https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/year_dropdown.csv").then((function(n){n=n.filter((function(t){return""!==t.year}));var a=L(t),r=O({wrapper:a,options:n.map((function(t){return t.year})),defaultOption:"2021",className:"year-filter",label:"Select year"});window.DIState&&window.DIState.setState({year:"2021"}),r.addEventListener("change",(function(t){var e=t.currentTarget.value;window.DIState&&window.DIState.setState({year:e})})),e.hideLoading(),t.parentElement.classList.add("auto-height")}))}))}}})},K=function(t){var e=function(t,e){return void 0===e&&(e=!1),t.map((function(t,n){return c.a.createElement("tr",{key:n},t.map((function(t,n){return e?c.a.createElement("th",{key:n},t):c.a.createElement("td",{key:n},t)})))}))};return c.a.createElement(u,null,c.a.createElement("thead",null,e(t.rows.filter((function(t,e){return 0===e})),!0)),c.a.createElement("tbody",null,e(t.rows.filter((function(t,e){return e>0})))))},Q=function(t,e,n){var a,r,o;void 0===e[0]?(a=0,r=0,o=0):(void 0!==typeof e[0]["RMNCH (total)"]?(a=String(Number(e[0]["RMNCH (total)"]).toFixed(1)),isNaN(a)&&(a=0)):a=0,void 0!==typeof e[0].health?(r=String(Number(e[0].health).toFixed(1)),isNaN(r)&&(r=0)):r=0,void 0!==typeof e[0].total?(o=String(Number(e[0].total).toFixed(1)),isNaN(o)&&(o=0)):o=0);var i=["RMNCH category","% of RMNCH".concat(" (",a,")"),"% of Health ODA".concat(" (",r,")"),"% of total ODA".concat(" (",o,")")],l=s.map((function(t){var n=N(e,t,"x_variable");return[t].concat(function(t,e,n,a){return e.map((function(e){var r=t.find((function(t){return""+t.y_variable==""+e}));if(r&&"NA"!==r[n]){var o=String(Math.round(1e4*r[n])/100),i=String(parseFloat(r[a]).toFixed(1));return o.concat("%"," (",i,")")||""}return 0}))}(n,f,"percentage_value","absolute_value"))})).map((function(t){return t.map((function(t){return"number"==typeof t?g(t):t}))})),u=[i].concat(l);t.render(c.a.createElement(K,{country:n,rows:u}))},V=function(t){window.DICharts.handler.addChart({className:t,d3:{onAdd:function(t){Array.prototype.forEach.call(t,(function(t){var e=new window.DICharts.Chart(t.parentElement);e.showLoading();var n=Object(l.createRoot)(t);window.DIState?window.DIState.addListener((function(){e.showLoading();var a=window.DIState.getState,r=a.year,o=a.country,i=a.dataThree;if(o&&i){var c=function(t,e,n){var a=e.toString();return t.filter((function(t){return a.includes(t[n])}))}(S(i,o||"United States","donor_name"),r||"2020","year");Q(n,c,o||"United States"),e.hideLoading(),t.parentElement.classList.add("auto-height")}})):console.log("State is not defined")}))}}})},X=function(){var t,e;t=[{url:"https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/data_1.csv",state:"dataOne"},{url:"https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/data_2.csv",state:"dataTwo"},{url:"https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/data_3.csv",state:"dataThree"}],e={country:"United States"},window.DIState&&t.length?(e&&window.DIState.setState(e),t.forEach((function(t){var e=t.url,n=t.state;y(e).then((function(t){var e;window.DIState.setState(((e={})[n]=t||[],e))}))}))):console.log("State is not defined"),x("dicharts--donor-selector"),I("dicharts--table-one"),B("dicharts--chart-one"),W("dicharts--table-two"),q("dicharts--year-selector"),V("dicharts--table-three")};window.addEventListener("load",(function(){X()}))},8:function(t,e,n){t.exports=n(19)},9:function(t,e,n){}},[[8,1,2]]]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{10:function(t,e,n){},19:function(t,e,n){"use strict";n.r(e);n(9);var a=n(5),r=n(2),o=function(){function t(){this.id=Math.random(),this.state={},this.listeners=[],Object(r.d)(this,{state:r.e,setState:r.a,getState:r.c})}var e=t.prototype;return e.setState=function(t,e){void 0===e&&(e=!0),this.state=e?Object.assign({},this.state,t):t},e.addListener=function(t){return this.listeners=this.listeners.concat(Object(r.b)(t)),this.listeners.length-1},e.removeListener=function(t){t0})))))},s=["Reproductive health","Maternal and newborn health","Child health","RMNCH (total)"],f=["% of RMNCH","% of Health ODA","% of total ODA"],m=["Reproductive health","Maternal and newborn health","Child health","Core contributions to multilaterals benefiting RMNCH"],h=[2012,2021],p=["African Development Fund","Arab Fund (AFESD)","Asian Development Bank","EU Institutions","Global Environment Facility","Inter-American Development Bank","International Development Association","Islamic Development Bank","OPEC Fund for International Development","UN Peacebuilding Fund","UNDP","UNECE","UNFPA","UNICEF","World Health Organisation","All donors (total)","Multilateral donors (total)"],b=n(6);function v(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0;return function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n"+t.title+""}}}},color:M.rainbow,xAxis:{axisLabel:{fontFamily:"Geomanist Regular,sans-serif",fontSize:13},splitLine:{show:!1}},yAxis:{axisLabel:{fontFamily:"Geomanist Regular,sans-serif",fontSize:13},splitLine:{show:!1}},axisPointer:{type:"none"},grid:{top:10}},j=c.a.createElement("div",{className:"no-data"},"No Data"),U=function(){return j},H=function(t,e,n,a,r){return function(t,e,n){return e.reduce((function(e,a){var r=t.filter((function(t){return""+t.Year==""+a})).reduce((function(t,e){return t+Number(e[n]||0)}),0);return e.concat(r)}),[])}(N(t,[e],r),n,a)},_=function(t,e){void 0===e&&(e=!0),e?t.classList.remove("invisible"):t.classList.add("invisible")},T=c.a.createElement(U,null),G=function(t,e){var n=m.slice();if(p.includes(t[0]["Donor.Name"]))for(var a=0;a0})))))};function z(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return J(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0;return function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n=1){var r=e.reduce((function(t,e){return Number(t[2021])=1){var c=e.reduce((function(t,e){return Number(t[2021])=1&&e.push([n+1,t[n].recipient_name,g(Number(t[n][2017]),0),g(Number(t[n][2018]),0),g(Number(t[n][2019]),0),g(Number(t[n][2020]),0),g(Number(t[n][2021]),0)]);return e}for(var a=0;a<10;a++)t.length>=1&&e.push([a+1,t[a].recipient_name,g(Number(t[a][2017]),0),g(Number(t[a][2018]),0),g(Number(t[a][2019]),0),g(Number(t[a][2020]),0),g(Number(t[a][2021]),0)]);return e}(m)).concat([["Total of all other recipients"].concat(h)]);a.render(c.a.createElement($,{rows:p}))},W=function(t){window.DICharts.handler.addChart({className:t,echarts:{onAdd:function(t){Array.prototype.forEach.call(t,(function(t){var e=new window.DICharts.Chart(t.parentElement);e.showLoading();var n,a=L(t),r="Reproductive health",o="United States",i=Object(l.createRoot)(t);window.DIState?window.DIState.addListener((function(){e.showLoading();var c=window.DIState.getState,l=c.country,u=c.dataTwo;(o=l)&&u&&(n||(n=O({wrapper:a,options:u.reduce((function(t,e){var n=e["Code type"];return n&&!t.includes(n)?t.concat(n):t}),[]),defaultOption:r,className:"purpose-code-filter",label:"Select RMNCH category"})).addEventListener("change",(function(t){r=t.target.value,Y(u,o,r,i)})),Y(u,o,r,i),e.hideLoading(),t.parentElement.classList.add("auto-height"))})):(console.log("State is not defined"),e.hideLoading())}))}}})},q=function(t){window.DICharts.handler.addChart({className:t,d3:{onAdd:function(t){Array.prototype.forEach.call(t,(function(t){var e=new window.DICharts.Chart(t.parentElement);e.showLoading();D("https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/year_dropdown.csv").then((function(n){n=n.filter((function(t){return""!==t.year}));var a=L(t),r=O({wrapper:a,options:n.map((function(t){return t.year})),defaultOption:"2021",className:"year-filter",label:"Select year"});window.DIState&&window.DIState.setState({year:"2021"}),r.addEventListener("change",(function(t){var e=t.currentTarget.value;window.DIState&&window.DIState.setState({year:e})})),e.hideLoading(),t.parentElement.classList.add("auto-height")}))}))}}})},K=function(t){var e=function(t,e){return void 0===e&&(e=!1),t.map((function(t,n){return c.a.createElement("tr",{key:n},t.map((function(t,n){return e?c.a.createElement("th",{key:n},t):c.a.createElement("td",{key:n},t)})))}))};return c.a.createElement(u,null,c.a.createElement("thead",null,e(t.rows.filter((function(t,e){return 0===e})),!0)),c.a.createElement("tbody",null,e(t.rows.filter((function(t,e){return e>0})))))},Q=function(t,e,n){var a,r,o;void 0===e[0]?(a=0,r=0,o=0):(void 0!==typeof e[0]["RMNCH (total)"]?(a=String(Number(e[0]["RMNCH (total)"]).toFixed(1)),isNaN(a)&&(a=0)):a=0,void 0!==typeof e[0].health?(r=String(Number(e[0].health).toFixed(1)),isNaN(r)&&(r=0)):r=0,void 0!==typeof e[0].total?(o=String(Number(e[0].total).toFixed(1)),isNaN(o)&&(o=0)):o=0);var i=["RMNCH category","% of RMNCH".concat(" (",a,")"),"% of Health ODA".concat(" (",r,")"),"% of total ODA".concat(" (",o,")")],l=s.map((function(t){var n=N(e,t,"x_variable");return[t].concat(function(t,e,n,a){return e.map((function(e){var r=t.find((function(t){return""+t.y_variable==""+e}));if(r&&"NA"!==r[n]){var o=String(Math.round(1e4*r[n])/100),i=String(parseFloat(r[a]).toFixed(1));return o.concat("%"," (",i,")")||""}return 0}))}(n,f,"percentage_value","absolute_value"))})).map((function(t){return t.map((function(t){return"number"==typeof t?g(t):t}))})),u=[i].concat(l);t.render(c.a.createElement(K,{country:n,rows:u}))},V=function(t){window.DICharts.handler.addChart({className:t,d3:{onAdd:function(t){Array.prototype.forEach.call(t,(function(t){var e=new window.DICharts.Chart(t.parentElement);e.showLoading();var n=Object(l.createRoot)(t);window.DIState?window.DIState.addListener((function(){e.showLoading();var a=window.DIState.getState,r=a.year,o=a.country,i=a.dataThree;if(o&&i){var c=function(t,e,n){var a=e.toString();return t.filter((function(t){return a.includes(t[n])}))}(S(i,o||"United States","donor_name"),r||"2020","year");Q(n,c,o||"United States"),e.hideLoading(),t.parentElement.classList.add("auto-height")}})):console.log("State is not defined")}))}}})},X=function(){var t,e;t=[{url:"https://raw.githubusercontent.com/devinit/di-website-data/main/2022/data_1.csv",state:"dataOne"},{url:"https://raw.githubusercontent.com/devinit/di-website-data/main/2022/data_2.csv",state:"dataTwo"},{url:"https://raw.githubusercontent.com/devinit/di-website-data/main/2022/data_3.csv",state:"dataThree"}],e={country:"United States"},window.DIState&&t.length?(e&&window.DIState.setState(e),t.forEach((function(t){var e=t.url,n=t.state;y(e).then((function(t){var e;window.DIState.setState(((e={})[n]=t||[],e))}))}))):console.log("State is not defined"),x("dicharts--donor-selector"),I("dicharts--table-one"),B("dicharts--chart-one"),W("dicharts--table-two"),q("dicharts--year-selector"),V("dicharts--table-three")};window.addEventListener("load",(function(){X()}))},8:function(t,e,n){t.exports=n(19)},9:function(t,e,n){}},[[8,1,2]]]); \ No newline at end of file diff --git a/src/core/oecd/index.js b/src/core/oecd/index.js index 458ce89c..e1518aab 100644 --- a/src/core/oecd/index.js +++ b/src/core/oecd/index.js @@ -12,9 +12,9 @@ import { fetchCoreData } from '../../utils/data'; const init = () => { fetchCoreData([ - { url: 'https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/data_1.csv', state: 'dataOne' }, - { url: 'https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/data_2.csv', state: 'dataTwo' }, - { url: 'https://raw.githubusercontent.com/devinit/di-website-data/feature/update-rhfp-files/2022/data_3.csv', state: 'dataThree' }, + { url: 'https://raw.githubusercontent.com/devinit/di-website-data/main/2022/data_1.csv', state: 'dataOne' }, + { url: 'https://raw.githubusercontent.com/devinit/di-website-data/main/2022/data_2.csv', state: 'dataTwo' }, + { url: 'https://raw.githubusercontent.com/devinit/di-website-data/main/2022/data_3.csv', state: 'dataThree' }, ], { country: 'United States' }); initDonorFilter('dicharts--donor-selector'); initTableOne('dicharts--table-one');