Closed Wambere closed 4 months ago
Ok then I think we'd want to return this, not print it, we can also log itOn Feb 22, 2024, at 07:41, Peter Muriuki @.***> wrote: @peterMuriuki commented on this pull request.
In importer/main.py:
@@ -945,6 +948,9 @@ def main( else: logging.error("Empty csv file!")
yeah the use-case only needs the final output, I expect the final output to be a "a summary of the log" so the log is not needed.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
Added a logging filter, so now to get just response:
$ python3 main.py --csv_file csv/locations/locations_full.csv --resource_type locations --only_response true
{ "final-response": {
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>HAPI-0550: HAPI-0550: HAPI-0989: Trying to update Location/6c821162-0436-5830-9b4e-ea49027e0a7d/_history/1 but this is not the current version</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [ {
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-0550: HAPI-0550: HAPI-0989: Trying to update Location/6c821162-0436-5830-9b4e-ea49027e0a7d/_history/1 but this is not the current version"
} ]
}}
And to get all the logs:
$ python3 main.py --csv_file csv/locations/locations_full.csv --resource_type locations --log_level info
INFO:root:Start time: 13:55:39
INFO:root:Starting csv import...
INFO:root:Reading csv file
INFO:root:Returning records from csv file
INFO:root:Processing locations
INFO:root:Building request payload
INFO:root:Posting request-----------------
INFO:root:Request type: GET
INFO:root:Url: https://fhir.labs.smartregister.org/fhir/Location/ba787982-b973-4bd5-854e-eacbe161e297
INFO:root:[200]: SUCCESS!
INFO:root:Posting request-----------------
INFO:root:Request type: GET
INFO:root:Url: https://fhir.labs.smartregister.org/fhir/Location/0a04f1c2-de2a-4869-bab2-763d017e5316
INFO:root:[200]: SUCCESS!
INFO:root:Posting request-----------------
INFO:root:Request type: POST
INFO:root:Url: https://fhir.labs.smartregister.org/fhir
INFO:root:Processing complete!
INFO:root:{ "final-response": {
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>HAPI-0550: HAPI-0550: HAPI-0989: Trying to update Location/6c821162-0436-5830-9b4e-ea49027e0a7d/_history/1 but this is not the current version</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [ {
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-0550: HAPI-0550: HAPI-0989: Trying to update Location/6c821162-0436-5830-9b4e-ea49027e0a7d/_history/1 but this is not the current version"
} ]
}}
INFO:root:End time: 13:55:44
INFO:root:Total time: 4.120441 seconds
@pld are there any other changes you would like added to this?
IMPORTANT: Where possible all PRs must be linked to a Github issue
Fixes #143
Engineer Checklist
./gradlew spotlessApply
to check my code follows the project's style guide