@sassoftware/viya-serverjs 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +6 -0
- package/.dockerignore +2 -0
- package/.env +29 -0
- package/.env.proxy +31 -0
- package/.env.server +29 -0
- package/.eslintignore +4 -0
- package/.eslintrc.json +42 -0
- package/Dockerfile +44 -0
- package/README.md +6 -4
- package/cli.js +9 -0
- package/images/viya-apiserverjs.png +0 -0
- package/lib/{core/config.js → config.js} +5 -24
- package/lib/handlers/appCallback.js +62 -0
- package/lib/handlers/codeAuth.js +61 -0
- package/lib/{core/handlers → handlers}/decodeJwt.js +2 -2
- package/lib/handlers/favicon.js +45 -0
- package/lib/handlers/getApp.js +77 -0
- package/lib/handlers/getApp2.js +48 -0
- package/lib/handlers/getUser.js +49 -0
- package/lib/{core/handlers → handlers}/index.js +2 -2
- package/lib/handlers/keepAlive.js +99 -0
- package/lib/handlers/keepAlive2.js +33 -0
- package/lib/handlers/logon.js +44 -0
- package/lib/handlers/logout.js +88 -0
- package/lib/handlers/proxyMapUri.js +78 -0
- package/lib/handlers/proxyOnResponse.js +26 -0
- package/lib/handlers/reactDev.js +52 -0
- package/lib/handlers/setCookies.js +110 -0
- package/lib/{core/iService.js → iService.js} +45 -30
- package/lib/index.js +177 -10
- package/lib/{core/parseDocker.js → parseDocker.js} +1 -1
- package/lib/plugins/SASauth.js +101 -0
- package/lib/plugins/appCookie.js +99 -0
- package/lib/plugins/setContext.js +56 -0
- package/lib/{core/plugins → plugins}/setDefaultRoutes.js +67 -58
- package/lib/plugins/setupAuth.js +87 -0
- package/lib/{core/plugins → plugins}/setupUserRoutes.js +21 -12
- package/lib/plugins/token.js +31 -0
- package/lib/schemes/SASTokenScheme.js +71 -0
- package/package.json +54 -10
- package/packages/core/config.js +86 -0
- package/packages/core/handlers/appCallback.js +40 -0
- package/packages/core/handlers/codeAuth.js +31 -0
- package/packages/core/handlers/decodeJwt.js +11 -0
- package/packages/core/handlers/favicon.js +24 -0
- package/packages/core/handlers/getApp.js +41 -0
- package/packages/core/handlers/getApp2.js +26 -0
- package/packages/core/handlers/getUser.js +20 -0
- package/packages/core/handlers/index.js +36 -0
- package/packages/core/handlers/keepAlive.js +54 -0
- package/packages/core/handlers/keepAlive2.js +13 -0
- package/packages/core/handlers/logon.js +24 -0
- package/packages/core/handlers/logout.js +43 -0
- package/{lib → packages}/core/handlers/proxyMapUri.js +25 -36
- package/packages/core/handlers/proxyOnResponse.js +12 -0
- package/packages/core/handlers/reactDev.js +30 -0
- package/packages/core/handlers/setCookies.js +78 -0
- package/packages/core/iService.js +369 -0
- package/packages/core/index.js +249 -0
- package/packages/core/parseDocker.js +33 -0
- package/packages/core/plugins/SASauth.js +79 -0
- package/packages/core/plugins/appCookie.js +49 -0
- package/packages/core/plugins/setContext.js +34 -0
- package/packages/core/plugins/setDefaultRoutes.js +262 -0
- package/packages/core/plugins/setupAuth.js +48 -0
- package/packages/core/plugins/setupUserRoutes.js +48 -0
- package/packages/core/plugins/token.js +10 -0
- package/packages/core/schemes/SASTokenScheme.js +43 -0
- package/packages/core/visionIndex.html +24 -0
- package/packages/examples/apitest/.env +11 -0
- package/packages/examples/apitest/.eslintrc.json +42 -0
- package/packages/examples/apitest/Dockerfile +41 -0
- package/packages/examples/apitest/api.js +88 -0
- package/packages/examples/apitest/appenv.js +6 -0
- package/packages/examples/apitest/docker-compose.yml +10 -0
- package/packages/examples/apitest/package.json +19 -0
- package/packages/examples/apitest/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/apitest/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/apitest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apitest/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/apitest/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/apitest/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/apitest/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/apitest/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/apitest/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/apitest/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/apitest/public/data/cars.csv +429 -0
- package/packages/examples/apitest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apitest/public/data/cmdList.txt +15 -0
- package/packages/examples/apitest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apitest/public/data/iris.csv +151 -0
- package/packages/examples/apitest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apitest/public/favicon.ico +0 -0
- package/packages/examples/apitest/public/index.html +316 -0
- package/packages/examples/apitest/public/index2.html +102 -0
- package/packages/examples/apitest/public/logon.html +42 -0
- package/packages/examples/apitest/public/myapp/secondary.html +1 -0
- package/packages/examples/apitest/public/myapp/test.js +2 -0
- package/packages/examples/apitest/public/onlogoff.html +53 -0
- package/packages/examples/apitest/start.sh +15 -0
- package/packages/examples/app/.env +32 -0
- package/packages/examples/app/.envProxy +19 -0
- package/packages/examples/app/.envimpl +12 -0
- package/packages/examples/app/.eslintrc.json +42 -0
- package/packages/examples/app/Dockerfile +42 -0
- package/packages/examples/app/appenv.js +6 -0
- package/packages/examples/app/certs/ca.crt +19 -0
- package/packages/examples/app/certs/tls.crt +25 -0
- package/packages/examples/app/certs/tls.key +28 -0
- package/packages/examples/app/certs/tls.sh +5 -0
- package/packages/examples/app/docker-compose.yml +12 -0
- package/packages/examples/app/index.js +15 -0
- package/packages/examples/app/package.json +20 -0
- package/packages/examples/app/public/casread.html +324 -0
- package/packages/examples/app/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/app/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/app/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/app/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/app/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/app/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/app/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/app/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/app/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/app/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/app/public/data/cars.csv +429 -0
- package/packages/examples/app/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/app/public/data/cmdList.txt +15 -0
- package/packages/examples/app/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/app/public/data/iris.csv +151 -0
- package/packages/examples/app/public/data/model1.sas7bdat +0 -0
- package/packages/examples/app/public/favicon.ico +0 -0
- package/packages/examples/app/public/index.html +332 -0
- package/packages/examples/app/public/indexProxy.html +346 -0
- package/packages/examples/app/public/indextest.html +316 -0
- package/packages/examples/app/public/logon.html +44 -0
- package/packages/examples/app/public/micburger.html +345 -0
- package/packages/examples/app/public/micburger.txt.html +311 -0
- package/packages/examples/app/public/myapp/secondary.html +1 -0
- package/packages/examples/app/public/myapp/test.js +2 -0
- package/packages/examples/app/public/sara.txt +345 -0
- package/packages/examples/app/public/testva2.html +311 -0
- package/packages/examples/app/startup.sh +15 -0
- package/packages/examples/appdocker/.env +21 -0
- package/packages/examples/appdocker/.envProxy +22 -0
- package/packages/examples/appdocker/.envimpl +12 -0
- package/packages/examples/appdocker/.eslintrc.json +42 -0
- package/packages/examples/appdocker/Dockerfile +43 -0
- package/packages/examples/appdocker/appenv.js +6 -0
- package/packages/examples/appdocker/certs/ca.crt +19 -0
- package/packages/examples/appdocker/certs/tls.crt +25 -0
- package/packages/examples/appdocker/certs/tls.key +28 -0
- package/packages/examples/appdocker/certs/tls.sh +5 -0
- package/packages/examples/appdocker/docker-compose.yml +12 -0
- package/packages/examples/appdocker/index.js +15 -0
- package/packages/examples/appdocker/package.json +20 -0
- package/packages/examples/appdocker/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/appdocker/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/appdocker/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/appdocker/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/appdocker/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/appdocker/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/appdocker/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/appdocker/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/appdocker/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/appdocker/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/appdocker/public/data/cars.csv +429 -0
- package/packages/examples/appdocker/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/appdocker/public/data/cmdList.txt +15 -0
- package/packages/examples/appdocker/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/appdocker/public/data/iris.csv +151 -0
- package/packages/examples/appdocker/public/data/model1.sas7bdat +0 -0
- package/packages/examples/appdocker/public/favicon.ico +0 -0
- package/packages/examples/appdocker/public/index.html +346 -0
- package/packages/examples/appdocker/public/indexProxy.html +346 -0
- package/packages/examples/appdocker/public/indextest.html +316 -0
- package/packages/examples/appdocker/public/logon.html +44 -0
- package/packages/examples/appdocker/public/myapp/secondary.html +1 -0
- package/packages/examples/appdocker/public/myapp/test.js +2 -0
- package/packages/examples/appdocker/startup.sh +15 -0
- package/packages/examples/apptest/.env +28 -0
- package/packages/examples/apptest/.envProxy +22 -0
- package/packages/examples/apptest/.envimpl +12 -0
- package/packages/examples/apptest/.eslintrc.json +42 -0
- package/packages/examples/apptest/Dockerfile +44 -0
- package/packages/examples/apptest/appDir/app1/design.html +350 -0
- package/packages/examples/apptest/appDir/app1/index.html +353 -0
- package/packages/examples/apptest/appDir/index.html +350 -0
- package/packages/examples/apptest/appenv.js +6 -0
- package/packages/examples/apptest/docker-compose.yml +12 -0
- package/packages/examples/apptest/index.js +444 -0
- package/packages/examples/apptest/package.json +24 -0
- package/packages/examples/apptest/public/casread2.html +321 -0
- package/packages/examples/apptest/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/apptest/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/apptest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptest/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/apptest/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/apptest/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/apptest/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptest/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/apptest/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/apptest/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/apptest/public/data/cars.csv +429 -0
- package/packages/examples/apptest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apptest/public/data/cmdList.txt +15 -0
- package/packages/examples/apptest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apptest/public/data/iris.csv +151 -0
- package/packages/examples/apptest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apptest/public/design.html +349 -0
- package/packages/examples/apptest/public/favicon.ico +0 -0
- package/packages/examples/apptest/public/help.html +1 -0
- package/packages/examples/apptest/public/index.html +353 -0
- package/packages/examples/apptest/public/index2.html +353 -0
- package/packages/examples/apptest/public/indexProxy.html +346 -0
- package/packages/examples/apptest/public/indextest.html +316 -0
- package/packages/examples/apptest/public/logon.html +44 -0
- package/packages/examples/apptest/public/myapp/q.html +349 -0
- package/packages/examples/apptest/public/myapp/secondary.html +1 -0
- package/packages/examples/apptest/public/myapp/test.js +2 -0
- package/packages/examples/apptest/public/push1.html +187 -0
- package/packages/examples/apptest/startup.sh +15 -0
- package/packages/examples/apptesti/.env +13 -0
- package/packages/examples/apptesti/.eslintrc.json +42 -0
- package/packages/examples/apptesti/Dockerfile +42 -0
- package/packages/examples/apptesti/appenv.js +6 -0
- package/packages/examples/apptesti/certs/ca.crt +19 -0
- package/packages/examples/apptesti/certs/tls.crt +25 -0
- package/packages/examples/apptesti/certs/tls.key +28 -0
- package/packages/examples/apptesti/certs/tls.sh +5 -0
- package/packages/examples/apptesti/docker-compose.yml +12 -0
- package/{lib/cli.js → packages/examples/apptesti/index.js} +4 -5
- package/packages/examples/apptesti/package.json +20 -0
- package/packages/examples/apptesti/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/apptesti/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/apptesti/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptesti/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/apptesti/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/apptesti/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/apptesti/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptesti/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/apptesti/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/apptesti/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/apptesti/public/data/cars.csv +429 -0
- package/packages/examples/apptesti/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apptesti/public/data/cmdList.txt +15 -0
- package/packages/examples/apptesti/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apptesti/public/data/iris.csv +151 -0
- package/packages/examples/apptesti/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apptesti/public/favicon.ico +0 -0
- package/packages/examples/apptesti/public/index.html +346 -0
- package/packages/examples/apptesti/public/indexProxy.html +346 -0
- package/packages/examples/apptesti/public/indextest.html +316 -0
- package/packages/examples/apptesti/public/logon.html +44 -0
- package/packages/examples/apptesti/public/main.html +346 -0
- package/packages/examples/apptesti/public/myapp/secondary.html +1 -0
- package/packages/examples/apptesti/public/myapp/test.js +2 -0
- package/packages/examples/apptesti/startup.sh +15 -0
- package/packages/examples/basic/.env +10 -0
- package/packages/examples/basic/.eslintrc.json +42 -0
- package/packages/examples/basic/Dockerfile +41 -0
- package/packages/examples/basic/api.js +88 -0
- package/packages/examples/basic/appenv.js +6 -0
- package/packages/examples/basic/docker-compose.yml +10 -0
- package/packages/examples/basic/package.json +19 -0
- package/packages/examples/basic/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/basic/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/basic/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/basic/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/basic/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/basic/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/basic/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/basic/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/basic/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/basic/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/basic/public/data/cars.csv +429 -0
- package/packages/examples/basic/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/basic/public/data/cmdList.txt +15 -0
- package/packages/examples/basic/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/basic/public/data/iris.csv +151 -0
- package/packages/examples/basic/public/data/model1.sas7bdat +0 -0
- package/packages/examples/basic/public/favicon.ico +0 -0
- package/packages/examples/basic/public/index.html +29 -0
- package/packages/examples/basic/public/index2.html +102 -0
- package/packages/examples/basic/public/logon.html +42 -0
- package/packages/examples/basic/public/myapp/secondary.html +1 -0
- package/packages/examples/basic/public/myapp/test.js +2 -0
- package/packages/examples/basic/public/onlogoff.html +53 -0
- package/packages/examples/basic/start.sh +15 -0
- package/packages/examples/proxytest/.env +23 -0
- package/packages/examples/proxytest/.envimpl +11 -0
- package/packages/examples/proxytest/.eslintrc.json +42 -0
- package/packages/examples/proxytest/Dockerfile +42 -0
- package/packages/examples/proxytest/appenv.js +6 -0
- package/packages/examples/proxytest/docker-compose.yml +12 -0
- package/packages/examples/proxytest/index.js +57 -0
- package/packages/examples/proxytest/package.json +18 -0
- package/packages/examples/proxytest/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/proxytest/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/proxytest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/proxytest/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/proxytest/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/packages/examples/proxytest/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/proxytest/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/proxytest/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/proxytest/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/proxytest/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/proxytest/public/data/cars.csv +429 -0
- package/packages/examples/proxytest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/proxytest/public/data/cmdList.txt +15 -0
- package/packages/examples/proxytest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/proxytest/public/data/iris.csv +151 -0
- package/packages/examples/proxytest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/proxytest/public/favicon.ico +0 -0
- package/packages/examples/proxytest/public/index.html +357 -0
- package/packages/examples/proxytest/public/index.js +57 -0
- package/packages/examples/proxytest/public/indextest.html +316 -0
- package/packages/examples/proxytest/public/logon.html +44 -0
- package/packages/examples/proxytest/public/main.html +357 -0
- package/packages/examples/proxytest/public/myapp/secondary.html +1 -0
- package/packages/examples/proxytest/public/myapp/test.js +2 -0
- package/packages/examples/proxytest/public/restaf.js +2461 -0
- package/packages/examples/proxytest/public/restaf.min.js +11 -0
- package/packages/examples/proxytest/public/sas/iris.txt +10 -0
- package/packages/examples/proxytest/startup.sh +15 -0
- package/public/casread2.html +321 -0
- package/public/data/Cluster_SDOH1.sas +182 -0
- package/public/data/Cluster_SDOH6.sas +180 -0
- package/public/data/LeNet_snzrle.astore +0 -0
- package/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/public/data/ast/GBlocalcopy.sasast +0 -0
- package/public/data/ast/LeNet_snzrle.astore +0 -0
- package/public/data/ast/gb_IrisGB.sasast +0 -0
- package/public/data/ast/paysimsvdd.sasast +0 -0
- package/public/data/ast/svmlocalcopy.sasast +0 -0
- package/public/data/cars.csv +429 -0
- package/public/data/cluster_test2.sas7bdat +0 -0
- package/public/data/cmdList.txt +15 -0
- package/public/data/gradBoost.sashdat +0 -0
- package/public/data/iris.csv +151 -0
- package/public/data/model1.sas7bdat +0 -0
- package/public/design.html +350 -0
- package/public/display.html +354 -0
- package/public/favicon.ico +0 -0
- package/public/help.html +1 -0
- package/public/index.html +354 -0
- package/public/index2.html +353 -0
- package/public/indexProxy.html +350 -0
- package/public/indextest.html +316 -0
- package/public/logon.html +44 -0
- package/public/myapp/q.html +349 -0
- package/public/myapp/secondary.html +1 -0
- package/public/myapp/test.js +2 -0
- package/public/push1.html +187 -0
- package/server.js +444 -0
- package/src/config.js +90 -0
- package/src/handlers/appCallback.js +40 -0
- package/src/handlers/codeAuth.js +31 -0
- package/src/handlers/decodeJwt.js +11 -0
- package/src/handlers/favicon.js +24 -0
- package/src/handlers/getApp.js +52 -0
- package/src/handlers/getApp2.js +26 -0
- package/src/handlers/getUser.js +20 -0
- package/src/handlers/index.js +36 -0
- package/src/handlers/keepAlive.js +54 -0
- package/src/handlers/keepAlive2.js +13 -0
- package/src/handlers/logon.js +24 -0
- package/src/handlers/logout.js +43 -0
- package/src/handlers/proxyMapUri.js +56 -0
- package/src/handlers/proxyOnResponse.js +12 -0
- package/src/handlers/reactDev.js +30 -0
- package/src/handlers/setCookies.js +76 -0
- package/src/iService.js +369 -0
- package/src/index.js +243 -0
- package/src/parseDocker.js +32 -0
- package/src/plugins/SASauth.js +79 -0
- package/src/plugins/appCookie.js +49 -0
- package/src/plugins/setContext.js +34 -0
- package/src/plugins/setDefaultRoutes.js +262 -0
- package/src/plugins/setupAuth.js +48 -0
- package/src/plugins/setupUserRoutes.js +48 -0
- package/src/plugins/token.js +10 -0
- package/src/schemes/SASTokenScheme.js +43 -0
- package/src/visionIndex.html +24 -0
- package/start.sh +15 -0
- package/lib/core/handlers/appCallback.js +0 -51
- package/lib/core/handlers/codeAuth.js +0 -61
- package/lib/core/handlers/favicon.js +0 -45
- package/lib/core/handlers/getApp.js +0 -67
- package/lib/core/handlers/getApp2.js +0 -48
- package/lib/core/handlers/getUser.js +0 -49
- package/lib/core/handlers/keepAlive.js +0 -96
- package/lib/core/handlers/keepAlive2.js +0 -33
- package/lib/core/handlers/logon.js +0 -44
- package/lib/core/handlers/logout.js +0 -88
- package/lib/core/handlers/proxyOnResponse.js +0 -26
- package/lib/core/handlers/reactDev.js +0 -52
- package/lib/core/handlers/setCookies.js +0 -116
- package/lib/core/index.js +0 -195
- package/lib/core/plugins/SASauth.js +0 -100
- package/lib/core/plugins/appCookie.js +0 -98
- package/lib/core/plugins/setContext.js +0 -55
- package/lib/core/plugins/setupAuth.js +0 -86
- package/lib/core/plugins/token.js +0 -31
- package/lib/core/schemes/SASTokenScheme.js +0 -71
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Azure wants to prefix the app env
|
|
3
|
+
# Use this to set the env that this server expects
|
|
4
|
+
|
|
5
|
+
# https://docs.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet
|
|
6
|
+
env | grep APPSETTING_
|
|
7
|
+
|
|
8
|
+
if [[ ! -z "$APPSETTING_VIYA_SERVER" ]];
|
|
9
|
+
then
|
|
10
|
+
export VIYA_SERVER=$APPSETTING_VIYA_SERVER
|
|
11
|
+
echo VIYA SERVER= $VIYA_SERVER
|
|
12
|
+
else
|
|
13
|
+
echo "No custom application overrides"
|
|
14
|
+
fi
|
|
15
|
+
node index.js
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"browser": true,
|
|
5
|
+
"node": true,
|
|
6
|
+
"es6": true
|
|
7
|
+
},
|
|
8
|
+
"parser": "@babel/eslint-parser",
|
|
9
|
+
"extends": ["eslint:recommended", "prettier"],
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"requireConfigFile": false,
|
|
12
|
+
"babelOptions": {"configFile": "./.babelrc"},
|
|
13
|
+
"ecmaVersion": 6,
|
|
14
|
+
"sourceType": "module",
|
|
15
|
+
"ecmaFeatures": {
|
|
16
|
+
"jsx": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"rules": {
|
|
20
|
+
"key-spacing": [
|
|
21
|
+
2,
|
|
22
|
+
{
|
|
23
|
+
"align": "colon"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"jsx-quotes": [2, "prefer-double"],
|
|
27
|
+
"no-console": 0,
|
|
28
|
+
"no-unused-vars": [
|
|
29
|
+
1,
|
|
30
|
+
{
|
|
31
|
+
"args": "none"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"no-debugger": 0,
|
|
35
|
+
"react/prop-types": 0,
|
|
36
|
+
"array-bracket-spacing": [2, "never"],
|
|
37
|
+
"space-in-parens": [2, "never"],
|
|
38
|
+
"space-before-function-paren": [2, "always"],
|
|
39
|
+
"semi": [2, "always"],
|
|
40
|
+
"no-prototype-builtins": 0
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
FROM node:12.16.1-alpine
|
|
2
|
+
LABEL maintainer="deva.kumar@sas.com"
|
|
3
|
+
RUN apk add --no-cache --upgrade bash
|
|
4
|
+
RUN apk add --no-cache --upgrade curl
|
|
5
|
+
WORKDIR /usr/src/app
|
|
6
|
+
COPY . .
|
|
7
|
+
# COPY package*.json ./
|
|
8
|
+
RUN npm install
|
|
9
|
+
# RUN npm run build
|
|
10
|
+
EXPOSE 8080
|
|
11
|
+
# will auto change to localhost in non-docker environments
|
|
12
|
+
ENV APPHOST=0.0.0.0
|
|
13
|
+
ENV PORT=8080
|
|
14
|
+
|
|
15
|
+
#######################################################################
|
|
16
|
+
# You can override these(but in container leave APPHOST as shown below)
|
|
17
|
+
########################################################################
|
|
18
|
+
|
|
19
|
+
# set this the same as EXPOSE here and override in env or as -p option in dockerrun
|
|
20
|
+
# ENV APPPORT=8080
|
|
21
|
+
ENV APPNAME=viyaapi
|
|
22
|
+
ENV AUTHFLOW=
|
|
23
|
+
ENV CLIENTID=viyaapi
|
|
24
|
+
ENV CLIENTSECRET=secret
|
|
25
|
+
|
|
26
|
+
# ENV HAPIDEBUG=YES
|
|
27
|
+
# ENV LOGLEVEL=info
|
|
28
|
+
# ENV PLUGIN=hapi-swagger
|
|
29
|
+
# The following are defaults
|
|
30
|
+
ENV APPLOC=./public
|
|
31
|
+
ENV APPENTRY=index.html
|
|
32
|
+
# ENV APPENV=appenv.js
|
|
33
|
+
|
|
34
|
+
# ENV TLS_KEY=./secrets/tls.key
|
|
35
|
+
# ENV TLS_CERT=./secrets/tls.crt
|
|
36
|
+
ENV TLS_CREATE="C:US,ST:NC,L:Cary,O:SAS Institute,OU:STO,CN:localhost"
|
|
37
|
+
ENV SAMESITE=None,secure
|
|
38
|
+
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
39
|
+
|
|
40
|
+
#####################################################################
|
|
41
|
+
CMD ["./start.sh"]
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* ------------------------------------------------------------------------------------
|
|
4
|
+
* * Copyright (c) SAS Institute Inc.
|
|
5
|
+
* * Licensed under the Apache License, Version 2.0 (the 'License');
|
|
6
|
+
* * you may not use this file except in compliance with the License.
|
|
7
|
+
* * You may obtain a copy of the License at
|
|
8
|
+
* *
|
|
9
|
+
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
* *
|
|
11
|
+
* * Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* * distributed under the License is distributed on an 'AS IS' BASIS,
|
|
13
|
+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* * See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
* ----------------------------------------------------------------------------------------
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
let rafserver = require('@sassoftware/viya-apiserverjs');
|
|
21
|
+
rafserver.icli (getCustomHandler, null, customize);
|
|
22
|
+
|
|
23
|
+
function getCustomHandler () {
|
|
24
|
+
let appName = `/${process.env.APPNAME}`; /* does not have to be this - your choice */
|
|
25
|
+
let routes = [
|
|
26
|
+
{
|
|
27
|
+
method : ['GET'],
|
|
28
|
+
path : `${appName}/testget`,
|
|
29
|
+
options: {
|
|
30
|
+
handler: async (req,h) => {
|
|
31
|
+
debugger;
|
|
32
|
+
console.log('++++++++++++++++++++++ in testroute');
|
|
33
|
+
let context = req.pre.context;
|
|
34
|
+
return context;
|
|
35
|
+
},
|
|
36
|
+
description: 'Test get Route',
|
|
37
|
+
notes : 'Echo context',
|
|
38
|
+
tags : ['api']
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
method : ['POST'],
|
|
43
|
+
path : `${appName}/testpost`,
|
|
44
|
+
options: {
|
|
45
|
+
handler: async (req,h) => {
|
|
46
|
+
debugger;
|
|
47
|
+
console.log('++++++++++++++++++++++ in post');
|
|
48
|
+
let context = req.pre.context;
|
|
49
|
+
return context;
|
|
50
|
+
},
|
|
51
|
+
description: 'Create a dataset with specified nummber of columns and rows',
|
|
52
|
+
notes : 'Uses restaf',
|
|
53
|
+
tags : ['api'],
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
return routes;
|
|
58
|
+
}
|
|
59
|
+
function customize (key, options){
|
|
60
|
+
let info = {
|
|
61
|
+
swaggerOptions: {
|
|
62
|
+
'info': {
|
|
63
|
+
'title' : 'Test API',
|
|
64
|
+
'version' : '0.0.1',
|
|
65
|
+
'description': 'This document was auto-generated at run time'
|
|
66
|
+
},
|
|
67
|
+
'documentationPage': true,
|
|
68
|
+
'documentationPath': `/${process.env.APPNAME}/documentation`,
|
|
69
|
+
'swaggerUI' : true,
|
|
70
|
+
'swaggerUIPath' : `/${process.env.APPNAME}/swaggerui`,
|
|
71
|
+
'schemes' : ['https', 'http'],
|
|
72
|
+
'cors' : true,
|
|
73
|
+
auth : options.authDefault
|
|
74
|
+
},
|
|
75
|
+
APPENV: {
|
|
76
|
+
x: 1,
|
|
77
|
+
y: 2
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
let r = info[key];
|
|
81
|
+
return (r == null) ? {} : r;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "apitest",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "node api.js --env=./.env --docker=./Dockerfile",
|
|
8
|
+
"indocker": "node api.js",
|
|
9
|
+
"debug": "node --inspect-brk api.js --env=./.env --docker=./Dockerfile",
|
|
10
|
+
"format": "prettier-eslint --eslint-config-path ./.eslintrc.json --write '**/*.js'",
|
|
11
|
+
"lint": "eslint . --ext .js --fix"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"joi": "17.6.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*--------------------------------------------------
|
|
2
|
+
The options statement below should be placed
|
|
3
|
+
before the data step when submitting this code.
|
|
4
|
+
--------------------------------------------------*/
|
|
5
|
+
/*options VALIDMEMNAME=EXTEND VALIDVARNAME=ANY;*/
|
|
6
|
+
/*------------------------------------------
|
|
7
|
+
Generated SAS Scoring Code
|
|
8
|
+
Date : 02Jul2019:21:19:56
|
|
9
|
+
Locale : en_US
|
|
10
|
+
Model Type : Cluster
|
|
11
|
+
Interval variable: SDOH_PMU(SDOH1 Physically Mentally Unhealthy)
|
|
12
|
+
Interval variable: SDOH_Per_Adults_Bachelors(SDOH2 Education)
|
|
13
|
+
Interval variable: SDOH_Unemployment_Rate(SDOH4 Unemployment Rate)
|
|
14
|
+
Interval variable: SDOH_Median_Household_Income(SDOH3 Median Household Income)
|
|
15
|
+
------------------------------------------*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
length _WARN_ $4;
|
|
19
|
+
label _WARN_ = 'Warnings';
|
|
20
|
+
label _CLUSTER_ID_ = 'Cluster ID';
|
|
21
|
+
label _DISTANCE_ = 'Distance to Centroid';
|
|
22
|
+
|
|
23
|
+
_i_ = 0;
|
|
24
|
+
_j_ = 0;
|
|
25
|
+
_k_ = 0;
|
|
26
|
+
_l_ = 0;
|
|
27
|
+
_dist_ = 0;
|
|
28
|
+
_minDist_ = 0;
|
|
29
|
+
_found_ = 0;
|
|
30
|
+
_unknown_ = 0;
|
|
31
|
+
_unknownflag_ = 0;
|
|
32
|
+
_intMindist2cntr_ = 0;
|
|
33
|
+
_missingflag4Int_ = 0;
|
|
34
|
+
_numberOfIntVars_ = 4;
|
|
35
|
+
_minDistInt_ = 0;
|
|
36
|
+
label _STANDARDIZED_DISTANCE_ = 'Standardized Distance to Centroid';
|
|
37
|
+
|
|
38
|
+
drop _i_;
|
|
39
|
+
drop _j_;
|
|
40
|
+
drop _k_;
|
|
41
|
+
drop _l_;
|
|
42
|
+
drop _dist_;
|
|
43
|
+
drop _minDist_;
|
|
44
|
+
drop _minDistInt_;
|
|
45
|
+
drop _unknown_;
|
|
46
|
+
drop _unknownflag_;
|
|
47
|
+
drop _found_;
|
|
48
|
+
drop _intMindist2cntr_;
|
|
49
|
+
drop _missingflag4Int_;
|
|
50
|
+
drop _numberOfIntVars_;
|
|
51
|
+
drop _minDistInt_;
|
|
52
|
+
|
|
53
|
+
array _intVals_67{4} _temporary_;
|
|
54
|
+
array _intStdVals_67{4} _temporary_;
|
|
55
|
+
array _intVars_67[4] _temporary_;
|
|
56
|
+
_intVars_67[1] =
|
|
57
|
+
SDOH_PMU;
|
|
58
|
+
_intVars_67[2] =
|
|
59
|
+
SDOH_Per_Adults_Bachelors;
|
|
60
|
+
_intVars_67[3] =
|
|
61
|
+
SDOH_Unemployment_Rate;
|
|
62
|
+
_intVars_67[4] =
|
|
63
|
+
SDOH_Median_Household_Income;
|
|
64
|
+
array _cntrcoordsInt_67{4,4} _temporary_ (
|
|
65
|
+
5.6752109618776
|
|
66
|
+
34.574068577069
|
|
67
|
+
5.5249572649573
|
|
68
|
+
65162.262238794
|
|
69
|
+
6.1728412355737
|
|
70
|
+
28.076500921419
|
|
71
|
+
8.4815044247788
|
|
72
|
+
50250.811599193
|
|
73
|
+
5.5563377592335
|
|
74
|
+
27.69585347275
|
|
75
|
+
3.586724137931
|
|
76
|
+
55456.199169472
|
|
77
|
+
7.1425816544567
|
|
78
|
+
23.193113163492
|
|
79
|
+
5.9483653846154
|
|
80
|
+
45013.481439879
|
|
81
|
+
);
|
|
82
|
+
array _stdcntrcoordsInt_67 {4,4} _temporary_ (
|
|
83
|
+
-0.545947986801
|
|
84
|
+
1.2465170251288
|
|
85
|
+
-0.140043320021
|
|
86
|
+
1.2424484776721
|
|
87
|
+
0.080847377302
|
|
88
|
+
-0.09555849286
|
|
89
|
+
1.0754374093924
|
|
90
|
+
-0.456774851619
|
|
91
|
+
-0.695675960102
|
|
92
|
+
-0.17418139437
|
|
93
|
+
-0.936879929639
|
|
94
|
+
0.1364012391051
|
|
95
|
+
1.3022939633885
|
|
96
|
+
-1.104224427884
|
|
97
|
+
0.0340260867236
|
|
98
|
+
-1.053590936451
|
|
99
|
+
);
|
|
100
|
+
array _stdscaleInt_67 {4} _temporary_ (
|
|
101
|
+
0.7939278147152
|
|
102
|
+
4.8414322208822
|
|
103
|
+
2.4324097357342
|
|
104
|
+
8775.4507500947
|
|
105
|
+
);
|
|
106
|
+
array _stdcenterInt_67 {4} _temporary_ (
|
|
107
|
+
6.1086542539869
|
|
108
|
+
28.539140887732
|
|
109
|
+
5.8656
|
|
110
|
+
54259.216813453
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
*************** check missing interval value ******************;
|
|
114
|
+
_missingflag4Int_ = 0;
|
|
115
|
+
do _i_ = 1 to _numberOfIntVars_ until(_missingflag4Int_);
|
|
116
|
+
if missing( _intVars_67[_i_] ) then
|
|
117
|
+
_missingflag4Int_ = 1;
|
|
118
|
+
end;
|
|
119
|
+
|
|
120
|
+
if (_missingflag4Int_ = 1) then
|
|
121
|
+
substr(_WARN_, 1, 1) = 'M';
|
|
122
|
+
********** prepare interval variable values *********;
|
|
123
|
+
do _i_ = 1 to _numberOfIntVars_;
|
|
124
|
+
if missing (_intVars_67[_i_] ) then do;
|
|
125
|
+
_intVals_67[_i_] = .;
|
|
126
|
+
_intStdVals_67[_i_] = .;
|
|
127
|
+
end; else do;
|
|
128
|
+
if missing (_stdscaleInt_67[_i_] ) then do;
|
|
129
|
+
_intStdVals_67[_i_] = ( _intVars_67[_i_] - _stdcenterInt_67[_i_]);
|
|
130
|
+
end; else do;
|
|
131
|
+
_intStdVals_67[_i_] = ( _intVars_67[_i_] - _stdcenterInt_67[_i_])
|
|
132
|
+
/ _stdscaleInt_67[_i_];
|
|
133
|
+
end;
|
|
134
|
+
_intVals_67[_i_] = _intVars_67[_i_];
|
|
135
|
+
end;
|
|
136
|
+
end;
|
|
137
|
+
****************** find the closest cluster ******************;
|
|
138
|
+
if _missingflag4Int_ > 0 then
|
|
139
|
+
do;
|
|
140
|
+
_CLUSTER_ID_ = .;
|
|
141
|
+
_DISTANCE_ = .;
|
|
142
|
+
_minDistInt_ = .;
|
|
143
|
+
_STANDARDIZED_DISTANCE_ = .;
|
|
144
|
+
end;
|
|
145
|
+
else
|
|
146
|
+
do;
|
|
147
|
+
_CLUSTER_ID_ = .;
|
|
148
|
+
_minDist_ = 8.988465674E307;
|
|
149
|
+
do _i_=1 to 4;
|
|
150
|
+
_intMindist2cntr_ = 0;
|
|
151
|
+
do _j_=1 to 4;
|
|
152
|
+
_dist_ = _intStdVals_67{_j_} - _stdcntrcoordsInt_67{_i_,_j_};
|
|
153
|
+
_dist_ = _dist_ ** 2;
|
|
154
|
+
_intMindist2cntr_ = _intMindist2cntr_ + _dist_;
|
|
155
|
+
end;
|
|
156
|
+
_intMindist2cntr_ = _intMindist2cntr_ ** 0.5;
|
|
157
|
+
if( _minDist_ > _intMindist2cntr_) then do;
|
|
158
|
+
_CLUSTER_ID_ = _i_;
|
|
159
|
+
_minDist_ = _intMindist2cntr_;
|
|
160
|
+
end;
|
|
161
|
+
_STANDARDIZED_DISTANCE_ = _minDist_;
|
|
162
|
+
end;
|
|
163
|
+
_DISTANCE_ = 8.988465674E307;
|
|
164
|
+
_i_ = _CLUSTER_ID_;
|
|
165
|
+
_intMindist2cntr_ = 0;
|
|
166
|
+
do _j_=1 to 4;
|
|
167
|
+
_dist_ = _intVals_67{_j_} - _cntrcoordsInt_67{_i_,_j_};
|
|
168
|
+
_dist_ = _dist_ ** 2;
|
|
169
|
+
_intMindist2cntr_ = _intMindist2cntr_ + _dist_;
|
|
170
|
+
end;
|
|
171
|
+
_intMindist2cntr_ = _intMindist2cntr_ ** 0.5;
|
|
172
|
+
_DISTANCE_ = _intMindist2cntr_;
|
|
173
|
+
end;
|
|
174
|
+
|
|
175
|
+
if (MISSING('_CLUSTER_ID_'n))then _CLUSTER_ID_ = -1; /*------------------------------------------*/
|
|
176
|
+
drop '_CLUSTER_ID_'n '_DISTANCE_'n '_WARN_'n '_STANDARDIZED_DISTANCE_'n;
|
|
177
|
+
'_CLUSTER_ID__67'n='_CLUSTER_ID_'n;
|
|
178
|
+
'_DISTANCE__67'n='_DISTANCE_'n;
|
|
179
|
+
'_WARN__67'n='_WARN_'n;
|
|
180
|
+
'_STANDARDIZED_DISTANCE__67'n='_STANDARDIZED_DISTANCE_'n;
|
|
181
|
+
/*------------------------------------------*/
|
|
182
|
+
run;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*--------------------------------------------------
|
|
2
|
+
The options statement below should be placed
|
|
3
|
+
before the data step when submitting this code.
|
|
4
|
+
--------------------------------------------------*/
|
|
5
|
+
/*options VALIDMEMNAME=EXTEND VALIDVARNAME=ANY;*/
|
|
6
|
+
/*------------------------------------------
|
|
7
|
+
Generated SAS Scoring Code
|
|
8
|
+
Date : 30Jul2019:20:16:16
|
|
9
|
+
Locale : en_US
|
|
10
|
+
Model Type : Cluster
|
|
11
|
+
Interval variable: SDOH_Physically_Unhealthy_Days_(SDOH6 Physically Unhealthy Days)
|
|
12
|
+
Interval variable: SDOH_Per_Adults_Bachelors(SDOH2 Education1)
|
|
13
|
+
Interval variable: SDOH_Unemployment_Rate(SDOH3 Unemployment Rate)
|
|
14
|
+
Interval variable: SDOH_Median_Household_Income(SDOH4 Median Household Income)
|
|
15
|
+
------------------------------------------*/
|
|
16
|
+
|
|
17
|
+
length _WARN_ $4;
|
|
18
|
+
label _WARN_ = 'Warnings';
|
|
19
|
+
label _CLUSTER_ID_ = 'Cluster ID';
|
|
20
|
+
label _DISTANCE_ = 'Distance to Centroid';
|
|
21
|
+
|
|
22
|
+
_i_ = 0;
|
|
23
|
+
_j_ = 0;
|
|
24
|
+
_k_ = 0;
|
|
25
|
+
_l_ = 0;
|
|
26
|
+
_dist_ = 0;
|
|
27
|
+
_minDist_ = 0;
|
|
28
|
+
_found_ = 0;
|
|
29
|
+
_unknown_ = 0;
|
|
30
|
+
_unknownflag_ = 0;
|
|
31
|
+
_intMindist2cntr_ = 0;
|
|
32
|
+
_missingflag4Int_ = 0;
|
|
33
|
+
_numberOfIntVars_ = 4;
|
|
34
|
+
_minDistInt_ = 0;
|
|
35
|
+
label _STANDARDIZED_DISTANCE_ = 'Standardized Distance to Centroid';
|
|
36
|
+
|
|
37
|
+
drop _i_;
|
|
38
|
+
drop _j_;
|
|
39
|
+
drop _k_;
|
|
40
|
+
drop _l_;
|
|
41
|
+
drop _dist_;
|
|
42
|
+
drop _minDist_;
|
|
43
|
+
drop _minDistInt_;
|
|
44
|
+
drop _unknown_;
|
|
45
|
+
drop _unknownflag_;
|
|
46
|
+
drop _found_;
|
|
47
|
+
drop _intMindist2cntr_;
|
|
48
|
+
drop _missingflag4Int_;
|
|
49
|
+
drop _numberOfIntVars_;
|
|
50
|
+
drop _minDistInt_;
|
|
51
|
+
|
|
52
|
+
array _intVals_439{4} _temporary_;
|
|
53
|
+
array _intStdVals_439{4} _temporary_;
|
|
54
|
+
array _intVars_439[4] _temporary_;
|
|
55
|
+
_intVars_439[1] =
|
|
56
|
+
SDOH_Physically_Unhealthy_Days_;
|
|
57
|
+
_intVars_439[2] =
|
|
58
|
+
SDOH_Per_Adults_Bachelors;
|
|
59
|
+
_intVars_439[3] =
|
|
60
|
+
SDOH_Unemployment_Rate;
|
|
61
|
+
_intVars_439[4] =
|
|
62
|
+
SDOH_Median_Household_Income;
|
|
63
|
+
array _cntrcoordsInt_439{4,4} _temporary_ (
|
|
64
|
+
3.0267344264664
|
|
65
|
+
40.73654855643
|
|
66
|
+
4.5016404199475
|
|
67
|
+
73253.345144357
|
|
68
|
+
3.1748155867421
|
|
69
|
+
23.482869339272
|
|
70
|
+
4.4175018559762
|
|
71
|
+
52859.890126206
|
|
72
|
+
5.0717963953358
|
|
73
|
+
13.894727354664
|
|
74
|
+
9.3289319513294
|
|
75
|
+
35934.982875169
|
|
76
|
+
4.17723170653
|
|
77
|
+
17.079836808704
|
|
78
|
+
6.0463463281958
|
|
79
|
+
42933.089573889
|
|
80
|
+
);
|
|
81
|
+
array _stdcntrcoordsInt_439 {4,4} _temporary_ (
|
|
82
|
+
-0.819627593948
|
|
83
|
+
2.1063188660484
|
|
84
|
+
-0.557938370531
|
|
85
|
+
1.9606280602175
|
|
86
|
+
-0.667309695546
|
|
87
|
+
0.2473923533712
|
|
88
|
+
-0.59384668401
|
|
89
|
+
0.3473109632455
|
|
90
|
+
1.2839454778829
|
|
91
|
+
-0.785642463039
|
|
92
|
+
1.5022334387125
|
|
93
|
+
-0.991610872631
|
|
94
|
+
0.363786470954
|
|
95
|
+
-0.442475980379
|
|
96
|
+
0.1013049225367
|
|
97
|
+
-0.437993784529
|
|
98
|
+
);
|
|
99
|
+
array _stdscaleInt_439 {4} _temporary_ (
|
|
100
|
+
0.9721848963817
|
|
101
|
+
9.2815283979727
|
|
102
|
+
2.3431499789112
|
|
103
|
+
12640.698506466
|
|
104
|
+
);
|
|
105
|
+
array _stdcenterInt_439 {4} _temporary_ (
|
|
106
|
+
3.8235639939605
|
|
107
|
+
21.186690186017
|
|
108
|
+
5.8089737010904
|
|
109
|
+
48469.63695183
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
*************** check missing interval value ******************;
|
|
113
|
+
_missingflag4Int_ = 0;
|
|
114
|
+
do _i_ = 1 to _numberOfIntVars_ until(_missingflag4Int_);
|
|
115
|
+
if missing( _intVars_439[_i_] ) then
|
|
116
|
+
_missingflag4Int_ = 1;
|
|
117
|
+
end;
|
|
118
|
+
|
|
119
|
+
if (_missingflag4Int_ = 1) then
|
|
120
|
+
substr(_WARN_, 1, 1) = 'M';
|
|
121
|
+
********** prepare interval variable values *********;
|
|
122
|
+
do _i_ = 1 to _numberOfIntVars_;
|
|
123
|
+
if missing (_intVars_439[_i_] ) then do;
|
|
124
|
+
_intVals_439[_i_] = .;
|
|
125
|
+
_intStdVals_439[_i_] = .;
|
|
126
|
+
end; else do;
|
|
127
|
+
if missing (_stdscaleInt_439[_i_] ) then do;
|
|
128
|
+
_intStdVals_439[_i_] = ( _intVars_439[_i_] - _stdcenterInt_439[_i_]);
|
|
129
|
+
end; else do;
|
|
130
|
+
_intStdVals_439[_i_] = ( _intVars_439[_i_] - _stdcenterInt_439[_i_])
|
|
131
|
+
/ _stdscaleInt_439[_i_];
|
|
132
|
+
end;
|
|
133
|
+
_intVals_439[_i_] = _intVars_439[_i_];
|
|
134
|
+
end;
|
|
135
|
+
end;
|
|
136
|
+
****************** find the closest cluster ******************;
|
|
137
|
+
if _missingflag4Int_ > 0 then
|
|
138
|
+
do;
|
|
139
|
+
_CLUSTER_ID_ = .;
|
|
140
|
+
_DISTANCE_ = .;
|
|
141
|
+
_minDistInt_ = .;
|
|
142
|
+
_STANDARDIZED_DISTANCE_ = .;
|
|
143
|
+
end;
|
|
144
|
+
else
|
|
145
|
+
do;
|
|
146
|
+
_CLUSTER_ID_ = .;
|
|
147
|
+
_minDist_ = 8.988465674E307;
|
|
148
|
+
do _i_=1 to 4;
|
|
149
|
+
_intMindist2cntr_ = 0;
|
|
150
|
+
do _j_=1 to 4;
|
|
151
|
+
_dist_ = _intStdVals_439{_j_} - _stdcntrcoordsInt_439{_i_,_j_};
|
|
152
|
+
_dist_ = _dist_ ** 2;
|
|
153
|
+
_intMindist2cntr_ = _intMindist2cntr_ + _dist_;
|
|
154
|
+
end;
|
|
155
|
+
_intMindist2cntr_ = _intMindist2cntr_ ** 0.5;
|
|
156
|
+
if( _minDist_ > _intMindist2cntr_) then do;
|
|
157
|
+
_CLUSTER_ID_ = _i_;
|
|
158
|
+
_minDist_ = _intMindist2cntr_;
|
|
159
|
+
end;
|
|
160
|
+
_STANDARDIZED_DISTANCE_ = _minDist_;
|
|
161
|
+
end;
|
|
162
|
+
_DISTANCE_ = 8.988465674E307;
|
|
163
|
+
_i_ = _CLUSTER_ID_;
|
|
164
|
+
_intMindist2cntr_ = 0;
|
|
165
|
+
do _j_=1 to 4;
|
|
166
|
+
_dist_ = _intVals_439{_j_} - _cntrcoordsInt_439{_i_,_j_};
|
|
167
|
+
_dist_ = _dist_ ** 2;
|
|
168
|
+
_intMindist2cntr_ = _intMindist2cntr_ + _dist_;
|
|
169
|
+
end;
|
|
170
|
+
_intMindist2cntr_ = _intMindist2cntr_ ** 0.5;
|
|
171
|
+
_DISTANCE_ = _intMindist2cntr_;
|
|
172
|
+
end;
|
|
173
|
+
|
|
174
|
+
if (MISSING('_CLUSTER_ID_'n))then _CLUSTER_ID_ = -1; /*------------------------------------------*/
|
|
175
|
+
drop '_CLUSTER_ID_'n '_DISTANCE_'n '_WARN_'n '_STANDARDIZED_DISTANCE_'n;
|
|
176
|
+
'_CLUSTER_ID__439'n='_CLUSTER_ID_'n;
|
|
177
|
+
'_DISTANCE__439'n='_DISTANCE_'n;
|
|
178
|
+
'_WARN__439'n='_WARN_'n;
|
|
179
|
+
'_STANDARDIZED_DISTANCE__439'n='_STANDARDIZED_DISTANCE_'n;
|
|
180
|
+
/*------------------------------------------*/
|
|
Binary file
|