[ML] Anomaly Detection wizards: adds geo job wizard#147043
[ML] Anomaly Detection wizards: adds geo job wizard#147043alvarezmelissa87 merged 12 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/ml-ui (:ml) |
|
Tagged you, @lcawl, for copy stuff 😄 🙏 |
x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/geo_job_creator.ts
Outdated
Show resolved
Hide resolved
…reator/geo_job_creator.ts Co-authored-by: James Gowdy <jgowdy@elastic.co>
| </EuiFlexGroup> | ||
| <EuiFlexGroup gutterSize="xl"> | ||
| <EuiFlexItem> | ||
| <BucketSpan setIsValid={setIsValid} /> |
There was a problem hiding this comment.
Thanks for taking a look, @peteharverson. Looks like we also get this for rare jobs so might be worth looking into getting it working for the newer job wizards or removing that portion from all.
Happy to look at it in a follow up 👍
There was a problem hiding this comment.
Leave this for a follow-up. Could you raise an issue for it please.
x-pack/plugins/ml/public/application/jobs/new_job/pages/job_type/page.tsx
Outdated
Show resolved
Hide resolved
|
Not related to the changes here, but noticed the formatting of the values in the tooltip have Good catch, @peteharverson |
|
This has been updated and is ready for another look when you get a chance. 🙏 cc @peteharverson, @jgowdyelastic |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
szabosteve
left a comment
There was a problem hiding this comment.
One suggestion, otherwise UI text LGTM.
| description={ | ||
| <FormattedMessage | ||
| id="xpack.ml.newJob.wizard.pickFieldsStep.geoField.description" | ||
| defaultMessage="Select a geo field. The lat_long function detects anomalies in the geographic location of the input data." |
There was a problem hiding this comment.
| defaultMessage="Select a geo field. The lat_long function detects anomalies in the geographic location of the input data." | |
| defaultMessage="Select a geo field to detect anomalies in the geographic location of the input data." |
| this._geoAgg = geo; | ||
| } | ||
|
|
||
| public set geoField(field: Field | null) { |
There was a problem hiding this comment.
looks like this setter isn't needed
| return dtr; | ||
| } | ||
|
|
||
| public removeDetector(index: number) { |
There was a problem hiding this comment.
this function isn't needed
| return this._splitField; | ||
| } | ||
|
|
||
| public addDetector(agg: Aggregation, field: Field) { |
There was a problem hiding this comment.
looks like this function isn't needed.
| return; | ||
| } | ||
| const agg = this._geoAgg!; | ||
| if (this._detectors.length === 0) { |
There was a problem hiding this comment.
I think we can remove addDetector and simplify this logic to:
this.removeAllDetectors();
const dtr = this._createDetector(agg, field);
this._addDetector(dtr, agg, field);| const eq = (newArgs: any[], lastArgs: any[]) => isEqual(newArgs, lastArgs); | ||
|
|
||
| export class MapLoader extends ChartLoader { | ||
| private _indexPatternId: string | undefined; |
There was a problem hiding this comment.
I think we should changes the base class to store the whole "indexPattern" naming it the _dataView and remove the _indexPatternTitle and _indexPatternId member variables.
| } | ||
| setIsValid(valid); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [jobCreatorUpdated, jobCreator.geoField]); |
There was a problem hiding this comment.
if we're watching jobCreatorUpdated we shouldn't need to also watch jobCreator.geoField.
I know this seems counter intuitive, as really we should be watching all dependencies, but these wizards are designed around jobCreatorUpdated being the single notification that changes have happened.
So for consistency with the other components, I think we should only watch jobCreatorUpdated here.
There was a problem hiding this comment.
👌 Thanks for the context - updated in 9be34fe
| @@ -0,0 +1,40 @@ | |||
| /* | |||
There was a problem hiding this comment.
For consistency with other components, I think description.tsx, geo_field_select.tsx and geo_field.tsx should be moved out one level into a folder called geo_field.
So it is the same as population_field, rare_field, split_field etc
peteharverson
left a comment
There was a problem hiding this comment.
Tested latest changes and LGTM
|
Apologies - this has been updated with latest recommendations and is ready for a final look 🙏 cc @jgowdyelastic, @peteharverson |
|
Just a drive-by comment: Per https://www.elastic.co/guide/en/machine-learning/current/ml-geo-functions.html, " |
| description={ | ||
| <FormattedMessage | ||
| id="xpack.ml.newJob.wizard.pickFieldsStep.geoField.description" | ||
| defaultMessage="Select a geo field to detect anomalies in the geographic location of the input data." |
There was a problem hiding this comment.
defaultMessage="Select a geo field to detect anomalies in the geographic location of the input data."
Per https://www.elastic.co/guide/en/machine-learning/current/ml-geo-functions.html, "The field_name that you supply must be a single string that contains two comma-separated numbers of the form latitude,longitude, a geo_point field, a geo_shape field that contains point values, or a geo_centroid aggregation. The latitude and longitude must be in the range -180 to 180 and represent a point on the surface of the Earth." I presume this wizard filters the possible field values to only those that meet these requirements. If not, however, it might be helpful to include this type of information in a tip (in case a user thinks they have geo data and it isn't showing up because it doesn't meet these requirements).
There was a problem hiding this comment.
The wizard does only show supported fields already - and also the wizard option only shows up if there are fields that are supported by this type of job so the user wouldn't be running into any situations in which there would be no fields in the dropdown.
🤔 We could still add a tooltip with info about the fields just for information sake, though I don't think it's necessary for this PR. Happy to add in follow up
That's a good point, @lcawl 🤔 I think that's a good idea and would be good to add for the other specific wizards as well (if it's not in there already). Sounds like one for a follow up. |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled in files
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |



Summary
Adds geo job wizard for lat_long jobs.
Checklist
Delete any items that are not applicable to this PR.