Closed tomschenkjr closed 6 years ago
@tomschenkjr I think you missed the quotes that @AOCjcarr was talking about?
When I run the Curl command directly I get (for example) {"items":[{"result":"{\"risk_score_notes\": \"1. Please follow protocol for lead safety.\", \"errors\": [], \"network_id\": \"Alliance Health\", \"timestamp\": \"2018-05-10 14:47:56\", \"clinic_id\": \"EF\", \"patient_id\": \"6425\", \"risk_score\": \"0.190358333333\", \"version\": \"1.0.0-rc.3\", \"location_id\": \"examp_loc\"}"}]}
I think the problem is the quotes that start after "result" in between the colon and the curly brace
{"items":[{"result":"{\"risk_score...
^
and ends at the second to last curly brace:
": \"examp_loc\"}"}]}
^
It seems to start early in our process. The result string is stored as a JSON string in the tbl_lead_out (sorry for the jargon everyone), and the quotes and internally escaped quotes are necessary to pass the string between python and the database. (I think this issue is strongly related to #44)
The problem is that we need to put the result into a table of separate fields, not as a single precomposed JSON string.
So if you have the table, the JSON is returned properly. Within Sun's code, the statement is more like "select * where id=
Here is an example of a good result with dummy data:
And here is the underlying table:
This is actually a pretty big change (although maybe not very complicated), which will help with logging and other down the road steps.
@tomschenkjr what do you think about implementing this? Maybe we can talk offline later?
Great news, Sun seems to have a working solution in dev, which we can probably get into production tomorrow.
The return for the new version looks like this:
{"risk_score_notes": "1. Please follow protocol for lead safety.", "errors": [], "network_id": "Alliance Health", "timestamp": "2018-05-21 21:16:39", "clinic_id": "EF", "patient_id": "6425", "risk_score": "0.190358333333", "version": "1.0.0-rc.3", "location_id": "examp_loc"}
So, the JSON is no longer enclosed in "items" and "result". Looking at the documentation, I think this is actually what we specified in the first place. @AOCjcarr do you think this will work for you or are you expecting the top level wrapper fields? (not sure what to call them)
Note, this new version will be release candidate 4 (v1.0.0-rc.4)
Jeremy has replied to say that the issue is resolved through the changes Sun made.
@AOCjcarr mentioned he is seeing the following:
] }