xuang7 commented on code in PR #3744:
URL: https://github.com/apache/texera/pull/3744#discussion_r2361324297


##########
core/workflow-operator/src/main/scala/edu/uci/ics/amber/operator/visualization/choroplethMap/ChoroplethMapOpDesc.scala:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.uci.ics.amber.operator.visualization.choroplethMap
+
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle
+import edu.uci.ics.amber.core.tuple.{AttributeType, Schema}
+import edu.uci.ics.amber.operator.PythonOperatorDescriptor
+import edu.uci.ics.amber.core.workflow.OutputPort.OutputMode
+import edu.uci.ics.amber.core.workflow.{InputPort, OutputPort, PortIdentity}
+import edu.uci.ics.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
+import edu.uci.ics.amber.operator.metadata.annotations.AutofillAttributeName
+
+class ChoroplethMapOpDesc extends PythonOperatorDescriptor {
+
+  @JsonProperty(value = "locations", required = true)
+  @JsonSchemaTitle("Locations Column")
+  @JsonPropertyDescription("what column is used to describe the locations")
+  @AutofillAttributeName
+  var locations: String = ""
+
+  @JsonProperty(value = "color", required = true)
+  @JsonSchemaTitle("Color Column")
+  @JsonPropertyDescription(
+    "what column is used to determine intensity of color of the state/country"
+  )
+  @AutofillAttributeName
+  var color: String = ""
+
+  override def getOutputSchemas(
+      inputSchemas: Map[PortIdentity, Schema]
+  ): Map[PortIdentity, Schema] = {
+    val outputSchema = Schema()
+      .add("html-content", AttributeType.STRING)
+    Map(operatorInfo.outputPorts.head.id -> outputSchema)
+    Map(operatorInfo.outputPorts.head.id -> outputSchema)
+  }
+
+  override def operatorInfo: OperatorInfo =
+    OperatorInfo(
+      "Choropleth Map",
+      "a Choropleth Map; higher color intensity indicates a higher statistic 
for that region",
+      OperatorGroupConstants.VISUALIZATION_ADVANCED_GROUP,
+      inputPorts = List(InputPort()),
+      outputPorts = List(OutputPort(mode = OutputMode.SINGLE_SNAPSHOT))
+    )
+
+  def manipulateTable(): String = {
+    assert(locations.nonEmpty)
+    assert(color.nonEmpty)
+    s"""
+       |        table.dropna(subset=['$locations', '$color'], inplace = True)
+       |""".stripMargin
+  }
+
+  def createPlotlyFigure(): String = {
+    assert(locations.nonEmpty && color.nonEmpty)
+    s"""
+       |        fig = px.choropleth(table, locations="country", color="2007", 
color_continuous_scale=px.colors.sequential.Plasma)

Review Comment:
   createPlotlyFigure() hard-codes country/2007 instead of using the configured 
$locations and $color.



##########
core/workflow-operator/src/main/scala/edu/uci/ics/amber/operator/visualization/choroplethMap/ChoroplethMapOpDesc.scala:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.uci.ics.amber.operator.visualization.choroplethMap
+
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle
+import edu.uci.ics.amber.core.tuple.{AttributeType, Schema}
+import edu.uci.ics.amber.operator.PythonOperatorDescriptor
+import edu.uci.ics.amber.core.workflow.OutputPort.OutputMode
+import edu.uci.ics.amber.core.workflow.{InputPort, OutputPort, PortIdentity}
+import edu.uci.ics.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
+import edu.uci.ics.amber.operator.metadata.annotations.AutofillAttributeName
+
+class ChoroplethMapOpDesc extends PythonOperatorDescriptor {
+
+  @JsonProperty(value = "locations", required = true)
+  @JsonSchemaTitle("Locations Column")
+  @JsonPropertyDescription("what column is used to describe the locations")

Review Comment:
   The first word should be capitalized here.



##########
core/workflow-operator/src/main/scala/edu/uci/ics/amber/operator/visualization/choroplethMap/ChoroplethMapOpDesc.scala:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.uci.ics.amber.operator.visualization.choroplethMap
+
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle
+import edu.uci.ics.amber.core.tuple.{AttributeType, Schema}
+import edu.uci.ics.amber.operator.PythonOperatorDescriptor
+import edu.uci.ics.amber.core.workflow.OutputPort.OutputMode
+import edu.uci.ics.amber.core.workflow.{InputPort, OutputPort, PortIdentity}
+import edu.uci.ics.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
+import edu.uci.ics.amber.operator.metadata.annotations.AutofillAttributeName
+
+class ChoroplethMapOpDesc extends PythonOperatorDescriptor {
+
+  @JsonProperty(value = "locations", required = true)
+  @JsonSchemaTitle("Locations Column")
+  @JsonPropertyDescription("what column is used to describe the locations")
+  @AutofillAttributeName
+  var locations: String = ""
+
+  @JsonProperty(value = "color", required = true)
+  @JsonSchemaTitle("Color Column")
+  @JsonPropertyDescription(
+    "what column is used to determine intensity of color of the state/country"

Review Comment:
   same.



##########
core/workflow-operator/src/main/scala/edu/uci/ics/amber/operator/visualization/choroplethMap/ChoroplethMapOpDesc.scala:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.uci.ics.amber.operator.visualization.choroplethMap
+
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle
+import edu.uci.ics.amber.core.tuple.{AttributeType, Schema}
+import edu.uci.ics.amber.operator.PythonOperatorDescriptor
+import edu.uci.ics.amber.core.workflow.OutputPort.OutputMode
+import edu.uci.ics.amber.core.workflow.{InputPort, OutputPort, PortIdentity}
+import edu.uci.ics.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
+import edu.uci.ics.amber.operator.metadata.annotations.AutofillAttributeName
+
+class ChoroplethMapOpDesc extends PythonOperatorDescriptor {
+
+  @JsonProperty(value = "locations", required = true)
+  @JsonSchemaTitle("Locations Column")
+  @JsonPropertyDescription("what column is used to describe the locations")
+  @AutofillAttributeName
+  var locations: String = ""
+
+  @JsonProperty(value = "color", required = true)
+  @JsonSchemaTitle("Color Column")
+  @JsonPropertyDescription(
+    "what column is used to determine intensity of color of the state/country"
+  )
+  @AutofillAttributeName
+  var color: String = ""
+
+  override def getOutputSchemas(
+      inputSchemas: Map[PortIdentity, Schema]
+  ): Map[PortIdentity, Schema] = {
+    val outputSchema = Schema()
+      .add("html-content", AttributeType.STRING)
+    Map(operatorInfo.outputPorts.head.id -> outputSchema)
+    Map(operatorInfo.outputPorts.head.id -> outputSchema)

Review Comment:
   Looks like this line is duplicated.



##########
core/workflow-operator/src/main/scala/edu/uci/ics/amber/operator/visualization/choroplethMap/ChoroplethMapOpDesc.scala:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.uci.ics.amber.operator.visualization.choroplethMap
+
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle
+import edu.uci.ics.amber.core.tuple.{AttributeType, Schema}
+import edu.uci.ics.amber.operator.PythonOperatorDescriptor
+import edu.uci.ics.amber.core.workflow.OutputPort.OutputMode
+import edu.uci.ics.amber.core.workflow.{InputPort, OutputPort, PortIdentity}
+import edu.uci.ics.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
+import edu.uci.ics.amber.operator.metadata.annotations.AutofillAttributeName
+
+class ChoroplethMapOpDesc extends PythonOperatorDescriptor {
+
+  @JsonProperty(value = "locations", required = true)
+  @JsonSchemaTitle("Locations Column")
+  @JsonPropertyDescription("what column is used to describe the locations")
+  @AutofillAttributeName
+  var locations: String = ""
+
+  @JsonProperty(value = "color", required = true)
+  @JsonSchemaTitle("Color Column")
+  @JsonPropertyDescription(
+    "what column is used to determine intensity of color of the state/country"
+  )
+  @AutofillAttributeName
+  var color: String = ""
+
+  override def getOutputSchemas(
+      inputSchemas: Map[PortIdentity, Schema]
+  ): Map[PortIdentity, Schema] = {
+    val outputSchema = Schema()
+      .add("html-content", AttributeType.STRING)
+    Map(operatorInfo.outputPorts.head.id -> outputSchema)
+    Map(operatorInfo.outputPorts.head.id -> outputSchema)
+  }
+
+  override def operatorInfo: OperatorInfo =
+    OperatorInfo(
+      "Choropleth Map",
+      "a Choropleth Map; higher color intensity indicates a higher statistic 
for that region",

Review Comment:
   Please match the description style used by the other operators.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to