You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description="Socrata dataset based on search keywords",
704
+
)
705
+
classSocrataSearchNode:
706
+
"""Retrive the open data category via Socrata API.
707
+
708
+
The Socrata Open Data API (SODA) is a powerful tool designed for programmatically accessing a vast array of open data resources from various organizations around the world, including governments, non-profits,and NGOs..
709
+
This node uses the [SODA Consumer API](https://dev.socrata.com/consumers/getting-started.html) to get the dataset list.
710
+
"""
711
+
712
+
queryitem=knext.StringParameter(
713
+
label="Input searching item",
714
+
description="""Enter search keywords or dataset names to find relevant datasets in the Socrata database.
715
+
This search is not case-sensitive and can include multiple words separated by spaces. """,
# Attempt to convert the column to a KNIME-compatible data type
768
+
knime_table=knext.Table.from_pandas(df[[col]])
769
+
exceptExceptionase:
770
+
# If an exception is raised, add the column to the list of columns to drop
771
+
drop_columns.append(col)
772
+
773
+
# Drop the columns that cannot be saved in KNIME
774
+
df.drop(columns=drop_columns, inplace=True)
775
+
df.replace("?", pd.NA, inplace=True)
776
+
df.replace("", pd.NA, inplace=True)
777
+
df.dropna(axis=1, how="all", inplace=True)
778
+
df=df.reset_index(drop=True)
779
+
returnknext.Table.from_pandas(df)
780
+
781
+
782
+
############################################
783
+
# Socrata Data Query
784
+
############################################
785
+
@knext.node(
786
+
name="Socrata Data Query",
787
+
node_type=knext.NodeType.SOURCE,
788
+
icon_path=__NODE_ICON_PATH+"Socrata Data Query.png",
789
+
category=__category,
790
+
after="",
791
+
)
792
+
@knext.output_table(
793
+
name="Socrata dataset",
794
+
description="Socrata dataset based on search keywords",
795
+
)
796
+
classSocrataDataNode:
797
+
"""Retrive the open data category via Socrata API.
798
+
799
+
The Socrata Open Data API (SODA) is a powerful tool designed for programmatically accessing a vast array of open data resources from various organizations around the world, including governments, non-profits,and NGOs..
800
+
This node uses the [SODA Consumer API](https://dev.socrata.com/consumers/getting-started.html) to get the dataset from a dataset list generated by Socrata Search Node.
801
+
802
+
For instance, this dataset [Incidence Rate Of Breast Cancer](https://opendata.utah.gov/Health/Incidence-Rate-Of-Breast-Cancer-Per-100-000-All-St/q22t-rbk9) has a resource_id of "q22t-rbk9" and a metadata domain of "opendata.utah.gov".
803
+
They can be found in the link under API,"https://opendata.utah.gov/resource/q22t-rbk9.json". Both the two items will be used for data retriving.
804
+
"""
805
+
806
+
metadata_domain=knext.StringParameter(
807
+
label="Metadata domain",
808
+
description="""The value in the column metadata.domain of a table generated by a Socrata Search node. """,
809
+
default_value="",
810
+
)
811
+
812
+
resource_id=knext.StringParameter(
813
+
label="Resource ID",
814
+
description="""The value in the column resource.id of a table generated by a Socrata Search node. """,
0 commit comments