Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Geomap Case Insensitive #1392

Merged
merged 3 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
example, having selected node with Table output and adding a new node with
expression `at "x" == "y"` the selected node was applied to the right side of
`==`: `at "x" == operator1."y"` instead of `operator1.at "x" == "y"`.
- [Geo Map visualization recognizes columns regardless of their name letter
case][1392]. This allows visualizing tables with columns like `LONGITUDE` or
`Longitude`, where previously only `longitude` was recognized.

#### EnsoGL (rendering engine)

Expand All @@ -94,6 +97,7 @@ you can find their release notes
[1348]: https://github.com/enso-org/ide/pull/1348
[1353]: https://github.com/enso-org/ide/pull/1353
[1385]: https://github.com/enso-org/ide/pull/1385
[1392]: https://github.com/enso-org/ide/pull/1392

<br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ class GeoMapVisualization extends Visualization {
this.setPreprocessorCode(`
df -> case df of
Table.Table _ ->
columns = df.select ['label', 'latitude', 'longitude'] . columns
serialized = columns.map (c -> ['df_' + c.name, c.to_vector])
Json.from_pairs serialized . to_text
names = ['label', 'latitude', 'longitude']
look_for name =
is_matching column = column.name.equals_ignore_case name
["df_" + name, df.columns.find is_matching . to_vector]
valid_column pair = pair.at 1 . is_error . not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work with empty dataframe? If so, I don't see any warnings, but also I was not digging deeply in it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wdanilo
It will return an empty JSON which is the behavior that was present so-far.
Not sure if this should be considered working but even if not — it should be a separate issue.

pairs = names.map look_for . filter valid_column
Json.from_pairs pairs . to_text
_ -> df . to_json . to_text
`)
}
Expand Down