Skip to content
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

Change output to json #140

Closed
Wambere opened this issue Feb 19, 2024 · 4 comments
Closed

Change output to json #140

Wambere opened this issue Feb 19, 2024 · 4 comments
Labels

Comments

@Wambere
Copy link
Contributor

Wambere commented Feb 19, 2024

Pass a flag to allow output to be in json format to allow easy consumption from the web

Example of current output

$ python3 main.py --csv_file csv/locations/locations_full.csv --resource_type locations --log_level info
INFO:root:Start time: 15:17:45
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:End time: 15:17:49
INFO:root:Total time: 4.256438 seconds
@Wambere
Copy link
Contributor Author

Wambere commented Feb 19, 2024

@peterMuriuki are you able to provide an example of what the output above should look like?

@peterMuriuki
Copy link
Contributor

yeah, will check and revert back.

@peterMuriuki
Copy link
Contributor

My initial thoughts are

type Step = "ExtractTransform" | "Load"
type Status = "success" | "failure";

interface SuccessResponse {
  status: "success";
  step: Step;
  processed: Number;
  received: Number;
}

interface FailureResponse {
  status: "failure";
  step: Step;
  // https://www.hl7.org/fhir/R4/operationoutcome.html
  outcomes: OperationOutcome[]
}

We can jointly refine this, or completely change it.

@peterMuriuki peterMuriuki mentioned this issue Feb 22, 2024
2 tasks
@Wambere
Copy link
Contributor Author

Wambere commented Jun 6, 2024

Closing this for now since we have the Print Final Response feature in place
Once we have new specifications of what this output needs to look like we can create a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants