Closed achyutjoshi closed 5 years ago
Thank you for the bug report. I'll be glad to help; first I need more info.
In your hello-workbench
checkout, what do you get when you type git pull && git diff
?
Ditto in your cjworkbench
checkout.
This is what I get for cjworkbench
index 7b3acad..a1b4dae 100644
--- a/Pipfile
+++ b/Pipfile
@@ -41,6 +41,7 @@ rfc3987 = "*" # for jsonschema 'uri' format
aioamqp = "*"
pyyaml = "*"
boto3 = "*"
+fuzzywuzzy = "*"
[dev-packages]
watchdog = "*"
diff --git a/Pipfile.lock b/Pipfile.lock
index 8d0715e..8fb4b09 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "953cdd73730d77f1898f9b2c89ae3c6f864a76412f2876b366a05d90a5519b97"
+ "sha256": "9c98842b72ad0c3f92fe5fd45580d2009ce1381b52d9ca4c20dd719471c9882f"
},
"pipfile-spec": 6,
"requires": {
@@ -136,18 +136,18 @@
},
"boto3": {
"hashes": [
- "sha256:7ea6c74631da553999594e83fd42ed14d7512f425ae082cbbf180911537d609a",
- "sha256:9f65209b176b4559667a9691f96be6c8bd2dafc30e0c211ce5a7e031bb3b9737"
+ "sha256:0cb3a5d93e631f4b36727a6780a9d4fed586cab46c2a154a0e08b0413ca2a970",
+ "sha256:352a5a8bd26ba771ad86ec23ab632a9402fab2d9609243011253241ae1f5889d"
],
"index": "pypi",
- "version": "==1.9.154"
+ "version": "==1.9.161"
},
"botocore": {
"hashes": [
- "sha256:8b0367dc5af8182fe82b55cf93425f99bff577c473a37468a46bf3717fcbb117",
- "sha256:8bfa2a5f7c6ceae85907cbba2024c8b6caf918b1fc575ee9a18a6a1c22010c7e"
+ "sha256:256c84c5b559a7aa6735bd7cc15c94c6e60a1ed0469b6c55fb5888d6cee48d57",
+ "sha256:424c01d241c40e29bf90cc939450676a30ef1a54ee7a219bb2bc6bb876eba7b0"
This is what I get for hello-workbench
diff --git a/helloworkbench.py b/helloworkbench.py
index 72b71d7..dbdd32d 100644
--- a/helloworkbench.py
+++ b/helloworkbench.py
@@ -1,12 +1,70 @@
-def render(table, params, *, input_columns):
- colname = params['colname']
- factor = params['factor']
+# def render(table, params, *, input_columns):
+# colname = params['type']
+# factor = params['factor']
+#
+# # If no column is selected, do nothing. By convention, Workbench modules
+# # should output their input until enough parameters are supplied.
+# if not colname:
+# return table
+#
+# # Don't worry about table[colname] not existing. Workbench guarantees it
+# # exists.
+#
+# # If the column is not a number, return an error message
+# # see https://github.com/CJWorkbench/cjworkbench/wiki/Column-Types
+# if input_columns[colname].type != 'number':
+# return "Please select a Number column"
+#
+# # Modules may alter their input in place, if desired
+# table[colname] *= factor
+# return table
+
+from fuzzywuzzy import fuzz
+from fuzzywuzzy import process
+
+def load_usafips(data_path):
+ return(parse_file(data_path, True)
+
+def fuzzymatch(row,minscore):
+ answer = process.extract(str(row).lower(),choices,limit = 1)
+ print(answer)
+ choice,score = answer[0]
+ return choice if score > minscore else None
+
+
+def render(table, params):
+ state_column = params['state']
... and what does your module spec file (.json
or .yaml
) include?
I have not made major modifications yet. I was just playing around with some minor modifications -
id_name: helloworkbench
name: Achyut
category: Analyze
description: Multiply a column by a constant.
help_url: modules/analyze/hello-workbench
parameters:
- id_name: colname
type: column
name: asasd to multiply
- id_name: factor
name: Multiply by
type: float
default: 2.0
- id_name: factor
name: Multiply by
type: float
default: 2.0
A-ha. Well, there you have it: two factor
parameters. It is an error for two parameters to have the same id_name
; you'll need to rename one.
Would be great if someone could help