Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c6be271
Update CNAME
srmsoumya Oct 26, 2021
2065702
Modify links to refer covid19bharat.org
srmsoumya Oct 30, 2021
3b278ba
update the sheet published key to use datakind covid19bharat sheet
srmsoumya Oct 30, 2021
035214e
Update links in README
srmsoumya Oct 31, 2021
fc8748c
Change published SheetID to cover data till 31st October
srmsoumya Nov 1, 2021
2f9442e
Update README
srmsoumya Nov 1, 2021
cb4590f
Update main.sh
srmsoumya Nov 30, 2021
7b7fe10
Update main.sh
srmsoumya Nov 30, 2021
aa73136
Update main.sh
srmsoumya Nov 30, 2021
dd6c563
removing lock file to fix repo error
kaizer1v Nov 30, 2021
692a2ab
added new sheet v36
kaizer1v Dec 2, 2021
2f5a604
synch all sheets for v35 and v36
kaizer1v Dec 2, 2021
dc54653
fixed typo
kaizer1v Dec 2, 2021
45afd0e
visibility of the table description
kaizer1v Dec 21, 2021
49a8ea9
moving v37 sheet
kaizer1v Dec 24, 2021
76e467a
synching only v37
kaizer1v Dec 24, 2021
37c4394
moving to v38
kaizer1v Jan 3, 2022
254afd9
architecture
kaizer1v Jan 11, 2022
064aee3
Introducing env file and adding comments
PraveenKPandu Jan 15, 2022
9c956a3
Uncommenting instructions
PraveenKPandu Jan 15, 2022
be37f54
renamed env template
PraveenKPandu Jan 15, 2022
32deab3
Added .env file to gitgnore
PraveenKPandu Jan 15, 2022
fb3c7ce
Adding Github Actor
PraveenKPandu Jan 15, 2022
a8f6ed8
Unbound variable issues for gh_pages_branch
Jan 15, 2022
28c80f1
Adding code folder to clone repos
Jan 15, 2022
b7183e6
A bit of housekeeping & code dir houses files
Jan 16, 2022
5538c57
Added the Precautionary doses in API
Jan 16, 2022
d7552d8
Added env files without the variables from github
Jan 16, 2022
efa5db8
Ignoring the environment file changes
Jan 16, 2022
f4ccad3
Introduced Developer mode
Jan 22, 2022
cc8f720
Precautionary data support in districtwise data
Jan 22, 2022
3588aed
Implementation of Dev mode for the parser
Jan 22, 2022
eeb554b
Ignoring Env file
Jan 22, 2022
4c21a0a
Github configurations updated for dev/prod
Jan 22, 2022
e07cd02
Traceback implementation to print trace stack
Jan 22, 2022
3e8f3c3
Log4bash implemented to track and trace bash error
Jan 22, 2022
295cdca
bash if condition error fixed
PraveenKPandu Jan 22, 2022
c947a29
Env ignored
PraveenKPandu Jan 22, 2022
8c83f36
Bash dev mode error removed
PraveenKPandu Jan 22, 2022
b1633ef
Comment added for process visibilty
PraveenKPandu Jan 22, 2022
dcaa219
data updated on - Sat 22 Jan 2022 20:50:23 GMT
Jan 22, 2022
2e65f57
Removed unwanted comments
Jan 22, 2022
4fa1a89
Dev/prod issue fixed
Jan 22, 2022
e7a445e
Removing env file
PraveenKPandu Jan 22, 2022
af516a1
Root dir changed for production mode
PraveenKPandu Jan 22, 2022
544cbe1
Precautionary dose column added to ICMR
PraveenKPandu Jan 22, 2022
b71fa90
Dev mode branching optimisation for devs
PraveenKPandu Jan 22, 2022
c4c125d
Github name added to environment variable
PraveenKPandu Jan 22, 2022
044f713
Validations before checkout by git for devs
PraveenKPandu Jan 22, 2022
5ded437
Validation of keys in ICMR data for precautionary
PraveenKPandu Jan 22, 2022
4e1066c
Removing non existent fiir - fixed
PraveenKPandu Jan 22, 2022
b58aece
Root directory changed for parser
PraveenKPandu Jan 22, 2022
7013078
Root directory fix
PraveenKPandu Jan 22, 2022
e731cf8
Pointers to directory before checkout
PraveenKPandu Jan 22, 2022
f456a27
Non Existent branch Code fixed
PraveenKPandu Jan 23, 2022
20d6396
Active branch checking - fixed
PraveenKPandu Jan 23, 2022
8fa5d1d
Missing files due to tmp being removed
PraveenKPandu Jan 23, 2022
d4aca5a
Parser from root can be used instead of branch
PraveenKPandu Jan 23, 2022
adabf57
Root directory config changed
PraveenKPandu Jan 23, 2022
fddde29
Reverting back to source files in code dir
PraveenKPandu Jan 23, 2022
b7c9c99
Comments..
PraveenKPandu Jan 23, 2022
860abf4
Root directory issues
PraveenKPandu Jan 23, 2022
ca43cc9
Meh
PraveenKPandu Jan 23, 2022
fb4e686
Adding Path lib for finding root path
PraveenKPandu Jan 23, 2022
f7e7e99
Level up.
PraveenKPandu Jan 23, 2022
db184e1
Comments and paths corrections
PraveenKPandu Jan 23, 2022
b5bed4c
Level up for data old file
PraveenKPandu Jan 23, 2022
c3321c2
Output path changed to tmp
PraveenKPandu Jan 23, 2022
3adbfc7
Changing the remote url to origin
PraveenKPandu Jan 23, 2022
f19bf50
Temp removal done ahead of commits
PraveenKPandu Jan 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
GITHUB_TOKEN=''
GITHUB_REPOSITORY='DataKind-BLR/covid19bharat_data'
GITHUB_ACTOR='DataKind-BLR'
GITHUB_NAME='DataKind-BLR'
ORIGIN_BRANCH='origin'
MAIN_BRANCH='main'
GH_PAGES_BRANCH='gh-pages'
DEV_BRANCH='dev'
TEMP_DIR='tmp'
CODE_DIR='code'
MODE='dev/prod'
48 changes: 0 additions & 48 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
push:
branches:
- main
# repository_dispatch:
# types: [my-event]

jobs:
update-json-data:
Expand Down Expand Up @@ -44,39 +42,6 @@ jobs:
echo "the job completed"
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
SHEET_ID_v1: ${{ secrets.SHEET_ID_v1 }}
SHEET_ID_v2: ${{ secrets.SHEET_ID_v2 }}
SHEET_ID_v3: ${{ secrets.SHEET_ID_v3 }}
SHEET_ID_v4: ${{ secrets.SHEET_ID_v4 }}
SHEET_ID_v5: ${{ secrets.SHEET_ID_v5 }}
SHEET_ID_v6: ${{ secrets.SHEET_ID_v6 }}
SHEET_ID_v7: ${{ secrets.SHEET_ID_v7 }}
SHEET_ID_v8: ${{ secrets.SHEET_ID_v8 }}
SHEET_ID_v9: ${{ secrets.SHEET_ID_v9 }}
SHEET_ID_v10: ${{ secrets.SHEET_ID_v10 }}
SHEET_ID_v11: ${{ secrets.SHEET_ID_v11 }}
SHEET_ID_v12: ${{ secrets.SHEET_ID_v12 }}
SHEET_ID_v13: ${{ secrets.SHEET_ID_v13 }}
SHEET_ID_v14: ${{ secrets.SHEET_ID_v14 }}
SHEET_ID_v15: ${{ secrets.SHEET_ID_v15 }}
SHEET_ID_v16: ${{ secrets.SHEET_ID_v16 }}
SHEET_ID_v17: ${{ secrets.SHEET_ID_v17 }}
SHEET_ID_v18: ${{ secrets.SHEET_ID_v18 }}
SHEET_ID_v19: ${{ secrets.SHEET_ID_v19 }}
SHEET_ID_v20: ${{ secrets.SHEET_ID_v20 }}
SHEET_ID_v21: ${{ secrets.SHEET_ID_v21 }}
SHEET_ID_v22: ${{ secrets.SHEET_ID_v22 }}
SHEET_ID_v23: ${{ secrets.SHEET_ID_v23 }}
SHEET_ID_v24: ${{ secrets.SHEET_ID_v24 }}
SHEET_ID_v25: ${{ secrets.SHEET_ID_v25 }}
SHEET_ID_v26: ${{ secrets.SHEET_ID_v26 }}
SHEET_ID_v27: ${{ secrets.SHEET_ID_v27 }}
SHEET_ID_v28: ${{ secrets.SHEET_ID_v28 }}
SHEET_ID_v29: ${{ secrets.SHEET_ID_v29 }}
SHEET_ID_v30: ${{ secrets.SHEET_ID_v30 }}
SHEET_ID_v31: ${{ secrets.SHEET_ID_v31 }}
SHEET_ID_v32: ${{ secrets.SHEET_ID_v32 }}
SHEET_ID_v33: ${{ secrets.SHEET_ID_v33 }}
RESOURCES_SHEET_ID: ${{ secrets.RESOURCES_SHEET_ID }}
SHEET_LOCALE: ${{ secrets.SHEET_LOCALE }}
STUCK_BOT: ${{ secrets.STUCK_BOT }}
Expand All @@ -89,16 +54,3 @@ jobs:
status: ${{job.status}}
STUCK_BOT: ${{ secrets.STUCK_BOT }}
GITHUB_TOKEN: ${{ secrets.github_token }}
# - name: Repository Dispatch
# if: always() # ${{ !cancelled() }}
# uses: actions/github-script@v2
# with:
# github-token: ${{secrets.JUN_TOKEN2}}
# script: |
# const fs = require('fs');
# await github.repos.createDispatchEvent({
# owner: context.repo.owner,
# repo: context.repo.repo,
# event_type: "my-event",
# client_payload: { greeting: "I'm Mr Meeseek. Loot at me!" }
# });
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ bin-release/

# Other files and folders
.settings/
code/

# Executables
*.swf
Expand Down Expand Up @@ -40,3 +41,6 @@ tmp/

# Debug script
fetch.sh
.DS_Store

.env
3 changes: 3 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Head over to [covid19bharat_scrapers](https://github.com/DataKind-BLR/covid19bharat_scrapers) repository to understand how the data is being entered into the google sheets

<img width="1378" alt="covid19bharat_data" src="https://user-images.githubusercontent.com/7732220/148912662-13ec5921-681b-40de-876b-078538475246.png">
2 changes: 1 addition & 1 deletion CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
api.covid19india.org
data.covid19bharat.org
117 changes: 58 additions & 59 deletions README.md

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions log4bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/usr/bin/env bash
#--------------------------------------------------------------------------------------------------
# log4bash - Makes logging in Bash scripting suck less
# Copyright (c) Fred Palmer
# Licensed under the MIT license
# http://github.com/fredpalmer/log4bash
#--------------------------------------------------------------------------------------------------
set -e # Fail on first error

# Useful global variables that users may wish to reference
SCRIPT_ARGS="$@"
SCRIPT_NAME="$0"
SCRIPT_NAME="${SCRIPT_NAME#\./}"
SCRIPT_NAME="${SCRIPT_NAME##/*/}"
SCRIPT_BASE_DIR="$(cd "$( dirname "$0")" && pwd )"

# This should probably be the right way - didn't have time to experiment though
# declare -r INTERACTIVE_MODE="$([ tty --silent ] && echo on || echo off)"
declare -r INTERACTIVE_MODE=$([ "$(uname)" == "Darwin" ] && echo "on" || echo "off")

#--------------------------------------------------------------------------------------------------
# Begin Help Section

HELP_TEXT=""

# This function is called in the event of an error.
# Scripts which source this script may override by defining their own "usage" function
usage() {
echo -e "${HELP_TEXT}";
exit 1;
}

# End Help Section
#--------------------------------------------------------------------------------------------------

#--------------------------------------------------------------------------------------------------
# Begin Logging Section
if [[ "${INTERACTIVE_MODE}" == "off" ]]
then
# Then we don't care about log colors
declare -r LOG_DEFAULT_COLOR=""
declare -r LOG_ERROR_COLOR=""
declare -r LOG_INFO_COLOR=""
declare -r LOG_SUCCESS_COLOR=""
declare -r LOG_WARN_COLOR=""
declare -r LOG_DEBUG_COLOR=""
else
declare -r LOG_DEFAULT_COLOR="\033[0m"
declare -r LOG_ERROR_COLOR="\033[1;31m"
declare -r LOG_INFO_COLOR="\033[1m"
declare -r LOG_SUCCESS_COLOR="\033[1;32m"
declare -r LOG_WARN_COLOR="\033[1;33m"
declare -r LOG_DEBUG_COLOR="\033[1;34m"
fi

# This function scrubs the output of any control characters used in colorized output
# It's designed to be piped through with text that needs scrubbing. The scrubbed
# text will come out the other side!
prepare_log_for_nonterminal() {
# Essentially this strips all the control characters for log colors
sed "s/[[:cntrl:]]\[[0-9;]*m//g"
}

log() {
local log_text="$1"
local log_level="$2"
local log_color="$3"

# Default level to "info"
[[ -z ${log_level} ]] && log_level="INFO";
[[ -z ${log_color} ]] && log_color="${LOG_INFO_COLOR}";

echo -e "${log_color}[$(date +"%Y-%m-%d %H:%M:%S %Z")] [${log_level}] ${log_text} ${LOG_DEFAULT_COLOR}";
return 0;
}

log_info() { log "$@"; }

log_speak() {
if type -P say >/dev/null
then
local easier_to_say="$1";
case "${easier_to_say}" in
studionowdev*)
easier_to_say="studio now dev ${easier_to_say#studionowdev}";
;;
studionow*)
easier_to_say="studio now ${easier_to_say#studionow}";
;;
esac
say "${easier_to_say}";
fi
return 0;
}

log_success() { log "$1" "SUCCESS" "${LOG_SUCCESS_COLOR}"; }
log_error() { log "$1" "ERROR" "${LOG_ERROR_COLOR}"; log_speak "$1"; }
log_warning() { log "$1" "WARNING" "${LOG_WARN_COLOR}"; }
log_debug() { log "$1" "DEBUG" "${LOG_DEBUG_COLOR}"; }
log_captains() {
if type -P figlet >/dev/null;
then
figlet -f computer -w 120 "$1";
else
log "$1";
fi

log_speak "$1";

return 0;
}

log_campfire() {
# This function performs a campfire notification with the arguments passed to it
if [[ -z ${CAMPFIRE_API_AUTH_TOKEN} || -z ${CAMPFIRE_NOTIFICATION_URL} ]]
then
log_warning "CAMPFIRE_API_AUTH_TOKEN and CAMPFIRE_NOTIFICATION_URL must be set in order log to campfire."
return 1;
fi

local campfire_message="
{
\"message\": {
\"type\":\"TextMessage\",
\"body\":\"$@\"
}
}"

curl \
--write-out "\r\n" \
--user ${CAMPFIRE_API_AUTH_TOKEN}:X \
--header 'Content-Type: application/json' \
--data "${campfire_message}" \
${CAMPFIRE_NOTIFICATION_URL}

return $?;
}

# End Logging Section
#--------------------------------------------------------------------------------------------------

Loading