OHDSI Home | Forums | Wiki | Github

Missing sql export from cohort definition

We recently updated webapi and atlas from 2.11.1 to 2.13.0 .
Now we seem to have an intermittent problem in Atlas > Cohort Definitions > pick an existing definition > Export > SQL > MSSQL Server …
Some of us get a definition displayed. Others sometimes get nothing (but do see errors in developer tools)

:8443/atlas/js/config-gis.js:1 Failed to load resource: the server responded with a status of 404 ()
less.js:866 Less has finished and no sheets were loaded.
:8443/WebAPI/user/me:1 Failed to load resource: the server responded with a status of 401 ()
AuthAPI.js:89 User is not authed
Execution.js:68 There isn’t permission to get execution engine status
checkExecutionEngineStatus @ Execution.js:68
Application.js:169 Initializing service information
main.js:54 Loaded external plugins
Application.js:187 Re-initialized service information
2knockout-latest.js:16 Uncaught TypeError: Cannot read properties of null (reading ‘length’)
at update (datatableBinding.js:301:13)
at a.$.l (knockout-latest.js:79:379)
at Function.yd (knockout-latest.js:55:359)
at Function.zd (knockout-latest.js:55:45)
at Function.ha (knockout-latest.js:54:384)
at Function.nc (knockout-latest.js:56:86)
at knockout-latest.js:39:210
at b (knockout-latest.js:34:98)
at MutationObserver.c (knockout-latest.js:34:136)

I think I ran into the same issue on my own env, but I then remembered you need to install NPM packages with each release in case there is a dependency change.

To to a command prompt in your atlas folder, and execute:

npm install

This should install necessary js libs from NPM,. Please do a hard-refresh after you update the folder with the updated dependencies.

-Chris

I went to Git\OHDSI\atlas; ran npm install; then npm install -g npm@9.8.1 to update from 8.19.2 to 9.8.1. Followed up with npm run build and copied atlas folder to tomcat\apache-tomcat-8.5.88\webapps.
Replaced webapps\atlas\js\config-local.js with the previous one.
Restarted tomcat.
Logged in to atlas … > cohort definitions > chose existing cohort > export > sql > mssql, and don’t get output.

Developer tools shows:
Less has finished and no sheets were loaded.
:8443/WebAPI/user/me:1 Failed to load resource: the server responded with a status of 401 ()
AuthAPI.js:89 User is not authed
Execution.js:68 There isn’t permission to get execution engine status
checkExecutionEngineStatus @ Execution.js:68
Application.js:169 Initializing service information
main.js:54 Loaded external plugins
Router.js:82 Permission error
(anonymous) @ Router.js:82
Application.js:187 Re-initialized service information
prism-sql.js:1 Uncaught ReferenceError: Prism is not defined
at prism-sql.js:1:1
knockout-latest.js:16 Uncaught Error: The language “sql” has no grammar.
at Object.highlight (prism.js:668:11)
at highlightJS (HighLightUtils.js:8:17)
at new SqlExportPanel (sqlExportPanel.js:37:33)
at Object.createViewModel (CommonUtils.js:24:17)
at d (knockout-latest.js:85:495)
at a.zc.jb (knockout-latest.js:86:460)
at a.K.notifySubscribers (knockout-latest.js:37:203)
at knockout-latest.js:77:417
at b (knockout-latest.js:33:140)
at MutationObserver.c (knockout-latest.js:33:178)
prism.js:668 Uncaught (in promise) Error: The language “sql” has no grammar.
at Object.highlight (prism.js:668:11)
at highlightJS (HighLightUtils.js:10:16)
at SqlExportPanel.translateSql (sqlExportPanel.js:75:34)

Should I not have updated npm to 9.8.1 -OR- done another npm run build ?

Hi @lyndon ,

You did everything correct: the npm install will bring down the necessary libs. The npm build will actually bundle the javascript into a single bundle which you can configure your Atlas HTML to use it (it is not used by default) if you want to get the improved speed, at the cost of harder debugging…but the ‘bundled mode’ is a side-topic so I don’t want to get too deep there.

So, I did see this briefly on my own local environment until I did a npm install, which is what I thought fixed the issue…but if you did all that and you still see this, then I’m not sure…only that maybe it’s a browser cache issue and you should open up your dev console in chrome and do a hard reload to download everything.

The core of the error you are getting is from a library called 'HighlightJS which uses another library called ‘prism’ which contains the syntax highlighting logic for a wide variety of languages. Sql is included by default, so it’s very strange that it is saying ‘sql has no grammar’…

I’m running right now on 3 different local environments and the syntax highlighting is working correctly. Could you try something on your local browser:

Navigate to Sources-> js/utils/HighLightUtils.js, and you should see sourcecode like this:

If you set a breakpoint on line 10 for the return, that’s what is yielding the error (the call out to Prism.highlight)…you should inspect Prism.languages to see if you get any items in that collection…it should have about 20 by default.

I believe that before running
npm run build
it is important to have the config-local.js file where it should be.

Hope this helps
Jose

@jcabrerazuniga I tried your suggestion, now am getting during npm run build
Error: Error:ENOENT: no such file or directory, open ‘E:/Git/OHDSI/atlas/node_modules/d3/build/d3.js’

The contents of node_modules is managed by npm (ie, contents are installed via npm install). Can you look in your node_modules folder, and see if you have any folders, and if you have the d3 folder?

npm run build must be executed from within the atlas folder.

One more thing… In my installation notes I wrote for myself:

"You should install the latest version of the vue-i18n module :

npm uninstall vue-i18n

then run

npm install --save vue-i18n@next

to avoid the i18n is not a function error"

After this I did: npm run build

So… I believe that you need to do after placing the config-local.js where it should be:

cd E:/Git/OHDSI/atlas
npm run install
npm uninstall vue-i18n
npm install --save vue-i18n@next
npm run build

This is what worked for me…
Hope this helps

Thanks
Jose

I don’t think this is related to this specific issue, and the error related to the i18n is not a function was related to a bootstrapping issue on atlas which was addressed in this PR.

So, I wouldn’t do anything ‘custom’ to the NPM build instructions. Just do the install, run build, and then refresh browser.

I do have Git/OHDSI/atlas/node_modules, and there is a d3 folder under there, which contains dist, node_modules, src, LICENSE, package.json and README.md .

Ok, odd, does it have the files specific to your error:

The build folder does not exist.

Strange, it should have been created with npm install.

On my enviornment, I remvoed the entire d3 folder from node_modules, and than ran npm install again. Can you try that, it should re-download the d3 dependency and you should see the following folders:

image

Another thing I would ask: can you run npm list d3 after your npm install. This is what I get:

image

It shows that there’s 2 dependencies for d3 but the root one should be 4.13.0.

jack5a

So, very strange, the package.json calls for version 4.13.0.

It’s possible you have a package.lock in your directory. Can you delete that, delete the d3 directory from /node_modules and then try npm install again? We are trying to get the correct version of d3 to install (and preferably all the correct versions of the dependencies).


npm1

Better!

Ok, I forget where we were, but are you still having issues? If it’s something with a library not found, you may want to completely remove your node_modules folder and do an NPM install again so that it refreshes the libs.

I don’t know why it gave you 7.8.5 but I’m glad it fetched the correct 4.x version. We’re using the 4.x version of the library, and it would be quite a change to move to 7.x. (That being said, we’d like to keep our libs up to date).

We are still getting a problem that periodically we get nothing showing when doing Cohort Definitions > existing cohort > Export > SQL > MSSQL Server . At that time some of us may or may not get the same result. Others might get SQL output. And it might work for some at 1 point, and not later.

We discovered this after upgrading to WebAPI and Atlas 2.13.0 .

Would you be willing to meet (Zoom, Teams, etc) to go thru our system(s) ? It it is happening in Test/Stage and Production.

t