cd `dirname $0`
cd ../dstore

mkdir cache
if [ ! -f cache/datastore_bd.xml ]; then
   wget --ignore-length -O cache/datastore_bd.xml http://datastore.iatistandard.org/api/1/access/activity.xml?recipient-country=bd\&stream=True
fi

if [ ! -f cache/datastore_ug.xml ]; then
   wget --ignore-length -O cache/datastore_ug.xml http://datastore.iatistandard.org/api/1/access/activity.xml?recipient-country=ug\&stream=True
fi

if [ ! -f cache/datastore_hn.xml ]; then
   wget --ignore-length -O cache/datastore_hn.xml http://datastore.iatistandard.org/api/1/access/activity.xml?recipient-country=hn\&stream=True
fi

node js/cmd import "cache/datastore_bd.xml"
node js/cmd import "cache/datastore_ug.xml"
node js/cmd import "cache/datastore_hn.xml"
node js/cmd analyze
