-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endpoint for counting objects in a gromet FN #557
Comments
@Free-Quarks - I'm working on creating an endpoint for this. Below is an example output I'm generating. Do you think these fields are adequate, or are there any additional fields you would want to add? {'b': 7, 'bf': 9, 'opi': 1, 'opo': 3, 'pil': 0, 'pol': 0, 'wlopi': 0, 'wll': 0, 'wlf': 0, 'wlc': 0, 'wlopo': 0, 'pof': 7, 'pif': 3, 'wfopi': 1, 'wfl': 0, 'wff': 2, 'wfc': 0, 'wfopo': 3, 'pic': 0, 'poc': 0, 'wcopi': 0, 'wcl': 0, 'wcf': 0, 'wcc': 0, 'wcopo': 0} |
Those look great! The only other possible field that came to mind, which is minor and not super necessary, would be if we could also have a field for an aggregate count of all the wires (just adding all the wiring fields together), since they aren't distinguished in the memgraph. |
Update 10/10/2023This is essentially complete, I just need to finish writing the unit test for the endpoint. |
Update 10/13/2023To be resolved by #574 |
## Adding gromet-object-count endpoint Adds an additional endpoint `gromet-object-count` to code2fn REST API. The endpoint accepts a Gromet dictionary (the response type from fn-given-filepaths and fn-given-filepaths-zip) and returns a dictionary with the counts of each Gromet object. It also contain aggregate values for the number of boxes, ports, and wires. ### Example Call ``` Python system = { "files": ["example1.py", "dir/example2.py"], "blobs": [ "greet = lambda: print('howdy!')\ngreet()", "#Variable declaration\nx=2\n#Function definition\ndef foo(x):\n '''Increment the input variable'''\n return x+1", # Content of dir/example2.py ], } response = client.post("/code2fn/fn-given-filepaths", json=system) gromet_collection = response.json() response = client.post("/code2fn/gromet-object-count", json=gromet_collection) ``` ### Example Output ``` Python {'boxes': 14, 'ports': 6 , 'wires': 14 'b': 7, 'bf': 9, 'opi': 1, 'opo': 3, 'pil': 0, 'pol': 0, 'wlopi': 0, 'wll': 0, 'wlf': 0, 'wlc': 0, 'wlopo': 0, 'pof': 7, 'pif': 3, 'wfopi': 1, 'wfl': 0, 'wff': 2, 'wfc': 0, 'wfopo': 3, 'pic': 0, 'poc': 0, 'wcopi': 0, 'wcl': 0, 'wcf': 0, 'wcc': 0, 'wcopo': 0} ``` ### Additional changes Adds a test_gromet_object_count function for CI unit testing Resolves #557
## Adding gromet-object-count endpoint Adds an additional endpoint `gromet-object-count` to code2fn REST API. The endpoint accepts a Gromet dictionary (the response type from fn-given-filepaths and fn-given-filepaths-zip) and returns a dictionary with the counts of each Gromet object. It also contain aggregate values for the number of boxes, ports, and wires. ### Example Call ``` Python system = { "files": ["example1.py", "dir/example2.py"], "blobs": [ "greet = lambda: print('howdy!')\ngreet()", "#Variable declaration\nx=2\n#Function definition\ndef foo(x):\n '''Increment the input variable'''\n return x+1", # Content of dir/example2.py ], } response = client.post("/code2fn/fn-given-filepaths", json=system) gromet_collection = response.json() response = client.post("/code2fn/gromet-object-count", json=gromet_collection) ``` ### Example Output ``` Python {'boxes': 14, 'ports': 6 , 'wires': 14 'b': 7, 'bf': 9, 'opi': 1, 'opo': 3, 'pil': 0, 'pol': 0, 'wlopi': 0, 'wll': 0, 'wlf': 0, 'wlc': 0, 'wlopo': 0, 'pof': 7, 'pif': 3, 'wfopi': 1, 'wfl': 0, 'wff': 2, 'wfc': 0, 'wfopo': 3, 'pic': 0, 'poc': 0, 'wcopi': 0, 'wcl': 0, 'wcf': 0, 'wcc': 0, 'wcopo': 0} ``` ### Additional changes Adds a test_gromet_object_count function for CI unit testing Resolves #557 386494b
Add some endpoints to count objects in a gromet FN to allow for easier testing and development of tests for the code2amr pipeline.
The text was updated successfully, but these errors were encountered: