This repository was archived by the owner on Nov 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +126
-0
lines changed
Expand file tree Collapse file tree 5 files changed +126
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Import 3rd Next
4+ #
5+ #
6+ # Exit on errors or uninitialized variables
7+ set -e -o nounset
8+
9+
10+ # Start in data folder
11+ #
12+ cd /data/3rdNext
13+
14+
15+ # Create a list of text files
16+ #
17+ FILES=$( find . -maxdepth 1 -type f -name " *.txt" )
18+
19+
20+ # Import each text file and move it to archived
21+ #
22+ for f in ${FILES}
23+ do
24+ mongoimport --db query_composer_development --collection thirdnexts --type json --file ${f}
25+ done
Original file line number Diff line number Diff line change 1+ /*
2+ * Filters out providers based on id's and the initiative they are in.
3+ *
4+ * @param providerId {string} - the provider identifier to filter against.
5+ * @param initiative {string} - the initiative identifier. One of:
6+ * - "PPh" : polypharmacy
7+ *
8+ * @returns - true if the provider is part of the specified initiative
9+ * false otherwise.
10+ */
11+ function filterProviders ( providerId , initiative ) {
12+
13+ //check that we have valid inputs
14+ if ( ! providerId || ! initiative ) {
15+
16+ return false ;
17+
18+ }
19+
20+ var inits = {
21+
22+ "PPh" : [
23+ "cpsid" , //currently contains some test values.
24+ "PROVIDER1" ,
25+ "PROVIDER2"
26+ ]
27+ } ;
28+
29+
30+ //check that the initiative is valid.
31+ if ( inits [ initiative ] === undefined ) {
32+
33+ return false ;
34+
35+ }
36+
37+ if ( inits [ initiative ] . indexOf ( providerId ) > - 1 ) {
38+
39+ return true ;
40+
41+ } else {
42+
43+ return false ;
44+
45+ }
46+
47+ }
Original file line number Diff line number Diff line change @@ -13,12 +13,19 @@ set -e -o nounset
1313sleep 5
1414
1515
16+ # Create thirdnexts collection
17+ #
18+ mongo query_composer_development --eval ' db.createCollection("thirdnexts")'
19+
20+
1621# Set db keys to prevent duplicates
1722#
1823mongo query_composer_development --eval \
1924 ' printjson( db.users.ensureIndex({ username : 1 }, { unique : true }))'
2025mongo query_composer_development --eval \
2126 ' printjson( db.endpoints.ensureIndex({ base_url : 1 }, { unique : true }))'
27+ mongo query_composer_development --eval \
28+ ' printjson( db.thirdnexts.ensureIndex({ clinic: 1, date:1 }, { unique: true }))'
2229
2330
2431# Import admin and user accounts
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Halt on errors or uninitialized variables
4+ #
5+ set -e -o nounset
6+
7+
8+ # Expected input
9+ #
10+ # $0 this script
11+ # $1 Doctor (clinician) ID
12+
13+
14+ # Check parameters
15+ #
16+ if([ $# -lt 1 ]|| [ $# -gt 1 ])
17+ then
18+ echo
19+ echo " Unexpected number of parameters."
20+ echo
21+ echo " Usage: providers_add.sh [doctorID]"
22+ echo
23+ exit
24+ fi
25+
26+
27+ # Set variables from parameters
28+ #
29+ DOCTOR=${1}
30+
31+
32+ # Get script directory and target file
33+ #
34+ DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd )
35+ TARGET=${DIR} /providers.txt
36+
37+
38+ # Add provider
39+ #
40+ if(! grep --quiet ${DOCTOR} ${TARGET} )
41+ then
42+ echo ${DOCTOR} | sudo tee -a ${TARGET}
43+ fi
Original file line number Diff line number Diff line change 1+ # List provider IDs here
2+ #
3+ cpsid
4+ 91604
You can’t perform that action at this time.
0 commit comments