diff --git a/README.md b/README.md index a96653e..624e4df 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ This script will not overwrite already existing export files. ``` Usage: - python job-cli.py (-prod | -sandbox) --auth [--directory ] [--since ] --fhir (R4 | STU3) + python3 job-cli.py (-prod | -sandbox) --auth [--directory ] [--since ] --fhir (R4 | STU3) [(--only_start|--only_monitor|--only_download)] Help (for an explanation of the arguments): @@ -54,7 +54,7 @@ Arguments: ### Help -Run `python job-cli.py --help` to get a full list of arguments and explanations. +Run `python3 job-cli.py --help` to get a full list of arguments and explanations. ### Since Parameter @@ -90,7 +90,7 @@ If you want to: 1. And save all results for this job to the directory /opt/foo Then run the following command: -`python job-cli.py -prod --auth auth-credentials.base64 --directory /opt/foo` +`python3 job-cli.py -prod --auth auth-credentials.base64 --directory /opt/foo` ## Install or verify python 3, pip, and required pip modules @@ -112,7 +112,11 @@ Then run the following command: ### Install or verify python 3, pip, and required pip modules on Mac -> *** TO DO *** +Python and pip come pre-installed on MacOS. You can verify this with: +```ShellSession +python3 --version +pip3 --version +``` ### Install or verify python 3, pip, and required pip modules on Windows @@ -221,7 +225,7 @@ Then run the following command: 1. Check the python3 version ```ShellSession - python --version + python3 --version ``` 1. Verify that the version of python that you installed is displayed @@ -235,7 +239,7 @@ Then run the following command: 1. Check the python3 version ```ShellSession - pip --version + pip3 --version ``` 1. Verify that the version of python that you installed is displayed @@ -243,7 +247,7 @@ Then run the following command: *Format:* ``` - pip {version} from {installation directory}\pip (python 3.{version} + pip3 {version} from {installation directory}\pip (python 3.{version} ``` #### Install required pip modules on Windows @@ -251,7 +255,7 @@ Then run the following command: 1. Install the "requests" pip module ```ShellSession - pip install requests + pip3 install requests ``` 1. Verify that the requests module installed correctly @@ -259,7 +263,7 @@ Then run the following command: 1. Show the request pip module ```ShellSession - pip show requests + pip3 show requests ``` 1. Verify that a description of the "requests" module is displayed @@ -278,53 +282,38 @@ Then run the following command: [Running All Stages](#running-all-stages) -### Running Stages Individually - -1. Set the AUTH_FILE value +### Authorization Files - *On Mac or Linux:* +This repo contains authorization files for the four sandbox datasets. The file with Z0000 in the name is the smallest dataset and should be used for initial experimentation. If you want to use a different dataset then set AUTH_FILE to the corresponding authorization file. If you want to see how authorization files are created, look at make_creds_files.sh - ```bash - AUTH_FILE= - ``` - - *On Windows from command prompt:* - - ```ShellSession - SET AUTH_FILE= - ``` +### Running Stages Individually -1. Write the credentials to the auth file +1. Set the AUTH_FILE value *On Mac or Linux:* ```bash - echo -n "${OKTA_CLIENT_ID}:${OKTA_CLIENT_PASSWORD}" | base64 > $AUTH_FILE + AUTH_FILE=credentials_Z0000.base64 ``` *On Windows from command prompt:* ```ShellSession - $BASE64_ENCODED_ID_PASSWORD='{Base64-encoded id:password}' - Set-Content -Path $AUTH_FILE $BASE64_ENCODED_ID_PASSWORD + SET AUTH_FILE=credentials_Z0000.base64 ``` - -1. Exit your current terminal and open a new terminal - -1. Repeat setting the AUTH_FILE value 1. Set a variable with today's date *Example on Mac or Linux:* ```bash - TODAYS_DATE=2020-10-30 + TODAYS_DATE=2024-01-31 ``` *Example on Windows from command prompt:* ```ShellSession - SET TODAYS_DATE=2020-10-30 + SET TODAYS_DATE=2024-01-31 ``` 1. Create a directory for downloading export files @@ -348,13 +337,13 @@ Then run the following command: *On Mac or Linux:* ```bash - python job-cli.py -sandbox --auth $AUTH_FILE --directory $TARGET_DIR --only_start --fhir R4 + python3 job-cli.py -sandbox --auth $AUTH_FILE --directory $TARGET_DIR --only_start --fhir R4 ``` *On Windows from command prompt:* ```ShellSession - python job-cli.py -sandbox --auth %AUTH_FILE% --directory %TARGET_DIR% --only_start --fhir R4 + python3 job-cli.py -sandbox --auth %AUTH_FILE% --directory %TARGET_DIR% --only_start --fhir R4 ``` 1. Verify that a job id was created @@ -376,13 +365,13 @@ Then run the following command: *On Mac or Linux:* ```bash - python job-cli.py -sandbox --auth $AUTH --directory $TARGET_DIR --only_monitor + python3 job-cli.py -sandbox --auth $AUTH_FILE --directory $TARGET_DIR --only_monitor --fhir R4 ``` *On Windows from command prompt:* ```ShellSession - python job-cli.py -sandbox --auth %AUTH% --directory %TARGET_DIR% --only_monitor + python job-cli.py -sandbox --auth %AUTH_FILE% --directory %TARGET_DIR% --only_monitor --fhir R4 ``` 1. Verify that a job completed by verifying the list of files in the response @@ -406,13 +395,13 @@ Then run the following command: *On Mac or Linux:* ```bash - python job-cli.py -sandbox --auth $AUTH --directory $TARGET_DIR --only_download + python3 job-cli.py -sandbox --auth $AUTH_FILE --directory $TARGET_DIR --only_download --fhir R4 ``` *On Windows from command prompt:* ```ShellSession - python job-cli.py -sandbox --auth %AUTH% --directory %TARGET_DIR% --only_download + python3 job-cli.py -sandbox --auth %AUTH_FILE% --directory %TARGET_DIR% --only_download ``` 1. List the files that you have downloaded @@ -438,13 +427,13 @@ Then run the following command: *On Mac or Linux:* ```bash - AUTH= + AUTH_FILE=credentials_Z0000.base64 ``` *On Windows from command prompt:* ```ShellSession - SET AUTH= + SET AUTH_FILE=credentials_Z0000.base64 ``` 1. Set a variable with today's date @@ -482,7 +471,7 @@ Then run the following command: *On Mac or Linux:* ```bash - python job-cli.py -sandbox --auth $AUTH_FILE --directory $TARGET_DIR --fhir R4 + python3 job-cli.py -sandbox --auth $AUTH_FILE --directory $TARGET_DIR --fhir R4 ``` *On Windows from command prompt:* @@ -506,44 +495,3 @@ Then run the following command: ``` 1. Stop here, you have completed the file download - -## Bundling Python and Script - -### Build Python in Source - -1. Download the latest version of Python as a tar file -1. Unpack the tar file `tar -xvf python-tar` -1. Change directory to the folder created `cd python-tar` -1. Configure the installer `./configurer --prefix /path/to/ab2d/examples/python/python --with-openssl=$(brew --prefix openssl)` -1. Run `make` -1. Run `make install` -1. Check that the following directories exist in `/path/to/ab2d/examples/python/python`: -`bin, lib, share, include` - -### Setup Virtual Environment - -Before zipping up Python we need to create a virtual environment. This part assumes access to IntelliJ or PyCharm. - -In IntelliJ these are the steps - -1. Go to File -> Project Structure -1. Look for Platform Settings -> SDKs and click on it -1. Add a new Python SDK, set the python interpreter as `ab2d/examples/python/python/bin/python3`, -and set the `venv` home as `examples/python/venv` -1. Open a terminal in IntelliJ and in that terminal change directories to `ab2d/examples/python/` -1. Then install the `requests` library by running `venv/bin/pip3 install requests` - -### Zip - -1. Change directory `cd examples` -1. `zip -r client.zip python` - -### Unzip and Run - -**When developing move `/path/to/ab2d/examples/python/python` and `/path/to/ab2d/examples/python/venv` to different -directories to check that no symbolic links** - -1. Unzip `unzip client.zip` -1. Change directory to the python directory -1. Export the path to the python folder `PYTHONPATH=./python` -1. Run a job by using `/venv/bin/python3 job-cli.py ...` diff --git a/credentials_Z0000.base64 b/credentials_Z0000.base64 new file mode 100644 index 0000000..7ca684f --- /dev/null +++ b/credentials_Z0000.base64 @@ -0,0 +1 @@ +MG9hMnQwbHNyZFp3NXVXUngyOTc6SEhkdVdHNkxvZ0l2RElRdVdncDNabG85T1lNVmFsVHRINU9CY3VIdw== diff --git a/credentials_Z0010.base64 b/credentials_Z0010.base64 new file mode 100644 index 0000000..9aa6058 --- /dev/null +++ b/credentials_Z0010.base64 @@ -0,0 +1 @@ +MG9hMnQwbG05cW9BdEpIcUMyOTc6eWJSNjBKbXRjcFJ0NlNBZUxtdmJxNmwtM1lEUkNaUC1XTjFBdDZ0Xw== diff --git a/credentials_Z1001.base64 b/credentials_Z1001.base64 new file mode 100644 index 0000000..e104056 --- /dev/null +++ b/credentials_Z1001.base64 @@ -0,0 +1 @@ +MG9hOWp5eDJ3OVowQW50TEUyOTc6aHNrYlB1LVlvV2ZHRFkxZ2NRcTM0QmZJRXlNVnVheXU4N3pXRGxpRw== diff --git a/credentials_Z1002.base64 b/credentials_Z1002.base64 new file mode 100644 index 0000000..249ce8d --- /dev/null +++ b/credentials_Z1002.base64 @@ -0,0 +1 @@ +MG9hOWp6MGUxZHlOZlJNbTYyOTc6c2huRzZOR2tIY3UyOXB0RHNLS1JXNnE1dUZKU1NwSXBkbF9LNWZWVw== diff --git a/make_creds_files.sh b/make_creds_files.sh new file mode 100755 index 0000000..45c434b --- /dev/null +++ b/make_creds_files.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +#For Sponsor PDP-100 +CLIENT_CONTRACT1='Z0000' +CLIENT_ID1='0oa2t0lsrdZw5uWRx297' +CLIENT_PASSWORD1='HHduWG6LogIvDIQuWgp3Zlo9OYMValTtH5OBcuHw' +echo -n "${CLIENT_ID1}:${CLIENT_PASSWORD1}" | base64 > "credentials_${CLIENT_CONTRACT1}.base64" + +#For Sponsor PDP-100000 +CLIENT_CONTRACT2='Z0010' +CLIENT_ID2='0oa2t0lm9qoAtJHqC297' +CLIENT_PASSWORD2='ybR60JmtcpRt6SAeLmvbq6l-3YDRCZP-WN1At6t_' +echo -n "${CLIENT_ID2}:${CLIENT_PASSWORD2}" | base64 > "credentials_${CLIENT_CONTRACT2}.base64" + +#For Sponsor PDP-1001 +CLIENT_CONTRACT3='Z1001' +CLIENT_ID3='0oa9jyx2w9Z0AntLE297' +CLIENT_PASSWORD3='hskbPu-YoWfGDY1gcQq34BfIEyMVuayu87zWDliG' +echo -n "${CLIENT_ID3}:${CLIENT_PASSWORD3}" | base64 > "credentials_${CLIENT_CONTRACT3}.base64" + +#For Sponsor PDP-1002 +CLIENT_CONTRACT4='Z1002' +CLIENT_ID4='0oa9jz0e1dyNfRMm6297' +CLIENT_PASSWORD4='shnG6NGkHcu29ptDsKKRW6q5uFJSSpIpdl_K5fVW' +echo -n "${CLIENT_ID4}:${CLIENT_PASSWORD4}" | base64 > "credentials_${CLIENT_CONTRACT4}.base64" + + +