-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New D3 version #417
New D3 version #417
Conversation
pavgra
commented
Jun 30, 2017
- D3 was updated to Version 4.9.1
- Charts were moved into separate library, making it possible not to duplicate code in Atlas and Achilles
Updated D3 to version 4
Replaced jnj charts with new charting library
js/main.js
Outdated
@@ -103,7 +103,7 @@ requirejs.config({ | |||
"negative-controls": "components/negative-controls", | |||
"d3": "d3.min", | |||
"d3_tip": "d3.tip", | |||
"jnj_chart": "jnj.chart", | |||
"jnj_chart": "https://cdn.rawgit.com/odysseusinc/atlascharts/master/index", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand this: the jnj.chart is being updated in this local repo, but you're pointing the reference to jnj_chart to an external repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the charts functionality is required by both Atlas and Achilles, we moved it out into a separate module and therefore separate repo, and removed a local copy from Atlas'es repo (to make these projects reference the lib, not copy). In current state the library is just copy-pasted, which leads to unsync of code base in the projects using it, makes you to do double work when changes are required and is just a bad programming practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pavgra . The issue here then is where this common codebase lives. It shouldn't be removed from the repository under the OHDSI organization. If we are looking to create a shared repository of common code, you should speak with @pbr6cornell about setting up this shared repository, and then we can work together on moving the code into a form that is better suited to code reuse. But it's not appropriate to have the code moved from the OHDSI governance to some other organization without first asking the code owners first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. The library should be included locally (i.e. not externally) until we can move it to a OHDSI site. Since new functionality should be added to Atlas (Data Sources) not AchillesWeb which is in maintenance and not a focus of new features moving forward this should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisknoll, @t-abdul-basser - agree with all your comments. This module was meant to stay in OHDSI repo. With all good intentions of creating a re-usable module, we should have done a better job in discussing everything in this group first - lesson learned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisknoll, there was no idea to transfer this code outside. It was done in development purposes and as soon as we agree (and if we) on these improvements, we will transfer repo ownership to OHDSI, of course. However, I still defense the point that these changes are bringing valuable improvements into Atlas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These improvements are valuable. Thanks for contributing them to Atlas @pavgra :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@t-abdul-basser, @chrisknoll, so how can we solve the issue with module's repo? Will it be possible for someone, having permissions, to create an appropriate repo in OHDSI space? Then we can put module there and modify this Atlas'es pull-request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, I can create a new repository for the shared library. What would we like to call it?
Definitely NOT jnj-charts. =)
this should do the trick:
https://github.com/OHDSI/Visualizations
…On Jul 2, 2017 2:28 AM, "Pavel Grafkin" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In js/main.js
<#417 (comment)>:
> @@ -103,7 +103,7 @@ requirejs.config({
"negative-controls": "components/negative-controls",
"d3": "d3.min",
"d3_tip": "d3.tip",
- "jnj_chart": "jnj.chart",
+ "jnj_chart": "https://cdn.rawgit.com/odysseusinc/atlascharts/master/index",
@t-abdul-basser <https://github.com/t-abdul-basser>, @chrisknoll
<https://github.com/chrisknoll>, so how can we solve the issue with
module's repo? Will it be possible for someone, having permissions, to
create an appropriate repo in OHDSI space? Then we can put module there and
modify this Atlas'es pull-request
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#417 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAsrGoRFpqgZM_0MPfaGOdkeEPal6XxKks5sJziUgaJpZM4OK8pf>
.
|
@pbr6cornell, I've created pull-request for Visualizations |
Hello, Everyone. Sorry for the late reply, I was out of touch for the past few days on vacation, and wasn't able to reply to this until now. @pbr6cornell : I don't think we need a repo of visualizations, we need a repo to host a shared components that are shared across applications. jnj chart is one of the libraries, but the facet table component we have is also something that is shared between applications (I think we have seen it used in Achilles, atlas, Penelope and now in active surveillance). We could either have 1 repo of shared libraries with a set of different build scripts to create the individual libraries, or we could have 1 repo-per-library where each repo is dedicated to a patricular library (and has the benefit of a dedicated issue tracker for each library). Either way could work, but I don't think a library called 'visualization' to host the charting library is what we need in this case. @pavgra: I appreciate your efforts on updating the jnj charting library to work with a newer D3 version, however there was another change that went unmentioned in your updates that I think I have a concern with: you made the individual plotting functions singleton-oriented instead of the way it was origionally designed 'instance oriented'. Ie:
vs.
I don't want to go into the pluses and minuses here since I didn't think we would take this pull request as it was, but when we figure out the shared-component home, we can open up a thread about the changes there. -Chris |
@chrisknoll, such approach to the charts code organization was applied due to their nature: they do not store or use any instance associated variables, so there is no need in instantiating a class every time you create a chart, charts' methods can be static because it is enough. Why to overcomplicate things until it's required? |
Hi, @pavgra. It was also built in a forward-thinking manner: initially we didn't have a lot of parameters to pass into the charts for rendering, but as time went on, we identified more and more configuration parameters that we'd put into the function signature that made the library more cumbersome to use: axis parameters like ticks, formatting parameters, etc. I never got to updating the library to work more fluently but with constructor functions that return an instance, you can have the api work like this:
It can't operate like this with the change that you made. Additionally, if we wanted to incorporate some kind of shared behavior between subclasses of charts (such as enabling pan-and-zoom functionality at a higher level) we'd be able to do this with implementing a base chart instance and have subclasses (line, boxplot, bar, etc) inherit the behavior. Finally, I think you'd agree that most of the changes made in this PR would have been avoided if you stuck with the initial API design. We have other applications which consume this library (granted a copy of the library was made locally) but if we change the API in this way, then anywhere that wants to leverage the 'shared' codebase will have to go back and find all uses and make the same kind of changes you've made here. With due respect, I don't see that the change to a singleton as such an advantage that it's worth causing such a major change to the API. |
All- |
I've made the post here: |
There are two things I'm reading in this thread. One is a discussion about the design approach of the library and the other is about how to organize a shared component. With regards to the organization of shared components i replied to the forum thread stating my position (one repository per library). I believe the upgrade of the d3 library is a valuable contribution to the charting library. I'm not opposed to the way the library is now structured in this PR and I have already seen it demonstrated in ATLAS as well as in the Arachne platform. I'm not opposed to the ongoing conversation about the preferred design approach, however, I would also like to ensure we're reviewing this PR with respect to functionality in addition to the design approach. |
I agree with @fdefalco that there's 2 concerns in this thread, and these should be addressed separately. For this PR Re: adding d3: the api change to the library is not related to the version of the D3 library used. Changing the API signature of the charting module should not be part of a D3 upgrade. We use this charting API in different applications and if we want to just drop in the shared library, we should not change the API. So, I can approve the D3 changes, but not the API changes. I recommend the changes to the charting API be reverted and the PR updated appropriately. -Chris |
reflected changes in atlas charts
resolved conflicts removed some unsused dependencies
The new library defines a different datastructure than before: it used to take a series of objects with 3 properties:
The new library expects a stucture with 2 fields in it:
This makes code in Atlas fail (specifically: report-manager.js line 2735: mapConceptData() converts the data from the result into the structure the donut requires. However, it appears that you did acoount for this in data-sources.js:
So it appears that the fix here is to add this map() call in the mapConceptData function in report-manager.js. |
I've merged this into a local branch for final inclusion into Atlas |