Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3 from PhysiciansDataCollaborative/dev
Browse files Browse the repository at this point in the history
Added 3rd Next
  • Loading branch information
DerekRoberts committed Aug 19, 2015
2 parents bdc2283 + 5e98ad4 commit c3a495b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 3rdNext_import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# Import 3rd Next
#
#
# Exit on errors or uninitialized variables
set -e -o nounset


# Start in data folder
#
cd /data/3rdNext


# Create a list of text files
#
FILES=$(find . -maxdepth 1 -type f -name "*.txt")


# Import each text file and move it to archived
#
for f in ${FILES}
do
mongoimport --db query_composer_development --collection thirdnexts --type json --file ${f}
done
47 changes: 47 additions & 0 deletions filterProviders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Filters out providers based on id's and the initiative they are in.
*
* @param providerId {string} - the provider identifier to filter against.
* @param initiative {string} - the initiative identifier. One of:
* - "PPh" : polypharmacy
*
* @returns - true if the provider is part of the specified initiative
* false otherwise.
*/
function filterProviders(providerId, initiative){

//check that we have valid inputs
if ( !providerId || !initiative ) {

return false;

}

var inits = {

"PPh" : [
"cpsid", //currently contains some test values.
"PROVIDER1",
"PROVIDER2"
]
};


//check that the initiative is valid.
if ( inits[initiative] === undefined ){

return false;

}

if( inits[initiative].indexOf(providerId) > -1 ){

return true;

}else{

return false;

}

}
7 changes: 7 additions & 0 deletions mongodb_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ set -e -o nounset
sleep 5


# Create thirdnexts collection
#
mongo query_composer_development --eval 'db.createCollection("thirdnexts")'


# Set db keys to prevent duplicates
#
mongo query_composer_development --eval \
'printjson( db.users.ensureIndex({ username : 1 }, { unique : true }))'
mongo query_composer_development --eval \
'printjson( db.endpoints.ensureIndex({ base_url : 1 }, { unique : true }))'
mongo query_composer_development --eval \
'printjson( db.thirdnexts.ensureIndex({ clinic: 1, date:1 }, { unique: true }))'


# Import admin and user accounts
Expand Down
43 changes: 43 additions & 0 deletions provider_add.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
#
# Halt on errors or uninitialized variables
#
set -e -o nounset


# Expected input
#
# $0 this script
# $1 Doctor (clinician) ID


# Check parameters
#
if([ $# -lt 1 ]||[ $# -gt 1 ])
then
echo
echo "Unexpected number of parameters."
echo
echo "Usage: providers_add.sh [doctorID]"
echo
exit
fi


# Set variables from parameters
#
DOCTOR=${1}


# Get script directory and target file
#
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TARGET=${DIR}/providers.txt


# Add provider
#
if(! grep --quiet ${DOCTOR} ${TARGET} )
then
echo ${DOCTOR} | sudo tee -a ${TARGET}
fi
4 changes: 4 additions & 0 deletions providers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# List provider IDs here
#
cpsid
91604

0 comments on commit c3a495b

Please sign in to comment.