Initial scorecard params object #892
Replies: 11 comments 1 reply
-
This is an excellent plan and write-up. One comment, it probably does not matter but I am not sure you need a validated method to access the temporary mongo collection. We could subscribe to the collection in the client and read the data from mini-mongo on the client side. However, I am also not sure that that would make the whole plan work any better at all because this data is not dynamic i.e. reactive at all. Totally static data. Your idea of the validated method might therefore be best because you have a working example and the data is not reactive. I suppose if there are a lot of scorecards being viewed it might also make sense to not have DDP handling the whole collection at once. So don't change the plan unless something doesn't work. I just wanted to bring up the point. I am surprised and pleased at how concise this seems to be. I'm trying to think about how this helps batch processing. I suppose we can make the plot and then ether present the graph using this technique or do the equivalent of clicking 'preview' and 'save' to save a graph for future reference. In that case the mongo collection would need to not be temporary, I suppose. We may also want some way to capture the id of the plot params document. I suppose we can do what I am doing with the scorecard and migrate a document representing plot params to and from Couchbase. That might also make sense. |
Beta Was this translation helpful? Give feedback.
-
Instead of: We could make it more generic, so that it is extensible in future: The JSON for now could be as simple as { "startup": "LoadSettings", "Settings": {settings JSON or db Key to JSON Object} } Apps on load will check if the URL param JSON is present, and will act on it. |
Beta Was this translation helpful? Give feedback.
-
Not sure if mongo document IDs are persistent across app instances, probably not, in that case, to have longer lived URLs that can be book marked or shared, we probably can put the whole settings JSON in the URL encoded string, or throw it in Couchbase and use CB doc id. 4:50 |
Beta Was this translation helpful? Give feedback.
-
After meeting, we've agreed to do an initial prototype with settings stored in mongo, and then switch the functionality to store the settings in couchbase. This will allow different users to share plots with one another, but will require additional engineering. |
Beta Was this translation helpful? Give feedback.
-
At the risk of going into the weeds. For the initial data structure you proposed, I think it'd make our lives easier to keep one piece of data per field. E.g. - E.g. const settings = {
"appName": "Surface",
"dateRange": {
"start": "01/14/2023 19:00",
"stop": "02/13/2023 19:00"
},
"curve0DataSource": "RAP_OPS",
"curve1DataSource": "HRRR_OPS",
"commonCurveParams": {
"region": "All HRRR Domain",
"statistic": "RMSE",
"variable": "2m temperature",
"threshold": "undefined",
"scale": "undefined",
"truth": "METAR",
"forecast-length": "6",
"forecast-type": "undefined",
"valid-time": "undefined",
"level": "undefined"
}
}
const startDate = settings.dateRange.start
const stopDate = settings.dateRange.stop |
Beta Was this translation helpful? Give feedback.
-
Thanks, Ian! The reason I did not do that is because when you are adding
curves into the session, it actually wants *one* date string in the format
given here, so doing it this way will require the least amount of
manipulation. Is that okay?
…On Fri, Feb 17, 2023 at 8:46 AM Ian McGinnis ***@***.***> wrote:
At the risk of going into the weeds. For the initial data structure you
proposed, I think it'd make our lives easier to keep one piece of data per
field. E.g. - dateRange should be another JSON object with some sort of
start and stop fields that way we can just access each component and
don't have to do further string processing in the application.
E.g.
const settings = {
"appName": "Surface",
"dateRange": {
"start": "01/14/2023 19:00",
"stop": "02/13/2023 19:00"
},
"curve0DataSource": "RAP_OPS",
"curve1DataSource": "HRRR_OPS",
"commonCurveParams": {
"region": "All HRRR Domain",
"statistic": "RMSE",
"variable": "2m temperature",
"threshold": "undefined",
"scale": "undefined",
"truth": "METAR",
"forecast-length": "6",
"forecast-type": "undefined",
"valid-time": "undefined",
"level": "undefined"
}}
const startDate = settings.dateRange.startconst stopDate = settings.dateRange.stop
—
Reply to this email directly, view it on GitHub
<#892 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHBWGZODQ4T4A7MZ6SG7VMDWX6MOTANCNFSM6AAAAAAU4HILUM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It’s split up in the metadata because daterangepicker requires the start
and end dates to be set separately, but we’re kind of bypassing that step
here. I’ll keep an eye out for other situations where we might not need the
dates to be split, though!
…On Fri, Feb 17, 2023 at 10:34 AM Ian McGinnis ***@***.***> wrote:
Ah, interesting. That actually makes me wonder if we're doing some
unnecessary string manipulation for the dates in some other part of MATS
then. If it's already handled elsewhere in the code then it'd make sense to
provide it the data as the session is expecting in your original proposal.
However, it could be a good opportunity for refactoring if there's a way to
simplify/remove code elsewhere in MATS.
—
Reply to this email directly, view it on GitHub
<#892 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHBWGZMQXUMH6QJ53SDHQKDWX6ZBJANCNFSM6AAAAAAU4HILUM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
If people are interested, the JSON object will now populate with all available fields:
|
Beta Was this translation helpful? Give feedback.
-
Parameters are stored and passed to new window:
|
Beta Was this translation helpful? Give feedback.
-
As it happens I think we do need to use couchbase for the scorecards, because each app technically has its own "server" and thus its own mongo collections. I'll use dummy data to finish the plotting routines, but this won't truly work until we use couchbase. |
Beta Was this translation helpful? Give feedback.
-
Ah! yes, didn't think about that, scorecard app stores the JSON, another app needs to pull it, and they are on different servers with different Mongo instances. Yes, dummy code will just be fine, or you can throw it to a file in the score card app, and read from it from the plotting app, in case you want to test it. |
Beta Was this translation helpful? Give feedback.
-
When a single cell on a scorecard is clicked, the scorecard app will create a JSON object of the parameters that went into that cell, store that JSON object in a mongo collection, and open a new browser window to plot a two-curve timeseries with the stored parameters.
Currently, the most efficient way to store the parameters of a single cell seems to be this:
These are all the fields that will be needed, regardless of app chosen. Fields that are not relevant to a particular app will be given a value of "undefined". For example, the surface app doesn't have a threshold selector, so "threshold" is undefined here.
A temporary mongo collection will be created in matsMethods. js like so:
const ScorecardParamsCollection = new Mongo.Collection("ScorecardParamsCollection");
(There are already three collections created this way:
metaDataTableUpdates
,LayoutStoreCollection
,DownSampleResults
.)The JSON object will be stored in the temporary mongo collection, and its ID will be passed to a new app window to be parsed by FlowRouter.
FlowRouter will pass the ID to a validated method to retrieve the JSON object. Two examples of this functionality can be seen in graphStandAlone.js:
matsMethods.getGraphDataByKey.call({resultKey: key,}, function (error, ret) {...}
on line 52 andmatsMethods.getLayout.call({resultKey: key,}, function (error, ret) {...}
on line 81.Once the parameters are retrieved, these steps should be all that is needed to produce a graph:
curve0dataSource
and thecommonCurveParams
. Anything not in thecommonCurveParams
should be set to its default (e.g. Average set to "None").curve1dataSource
and thecommonCurveParams
. Anything not in thecommonCurveParams
should be set to its default (e.g. Average set to "None").dateRange
.Beta Was this translation helpful? Give feedback.
All reactions