-
Notifications
You must be signed in to change notification settings - Fork 45
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
Import patients zip file API via POST- /admin/patients is not working #180
Comments
Hi Shardul,
Please check out this documentation - https://github.com/OSEHRA/popHealth/wiki/Getting-Started-with-popHealth-API
Make sure the enable_csrf_for_apis: false in the popHealth.yml file.
Peter
From: shardulbanker <[email protected]>
Sent: Wednesday, September 25, 2019 9:10 AM
To: OSEHRA/popHealth <[email protected]>
Cc: Subscribed <[email protected]>
Subject: [OSEHRA/popHealth] Import patients zip file API via POST- /admin/patients is not working (#180)
Hi,
I am testing POST- /admin/patients API using postman. I am passing below parameters as form data. If
1. file - patient's zip file containing CDA XML file
2. practice_id - Provider's ID
3. practice_name - Provider Name
It is throwing below error.
Started POST "/api/admin/patients/" for 10.10.0.80 at 2019-09-25 08:57:28 -0400
Processing by Api::Admin::PatientsController#create as /
Can't verify CSRF token authenticity
Completed 500 Internal Server Error in 453ms
NoMethodError (undefined method read' for nil:NilClass): app/controllers/api/admin/patients_controller.rb:47:in block in create'
app/controllers/api/admin/patients_controller.rb:47:in open' app/controllers/api/admin/patients_controller.rb:47:in create'
However, when I try same zip file from popHealth UI it is working as expected and imported the patient. It increments the patients count and verify the same in MongoDB database in 'records' collection also.
Please look into it and suggest way forward as API is not working.
Thanks and regards,
Shardul
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#180> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AAMCG3JKV4W2P7MV6R4F6ZDQLNPLJANCNFSM4I2MTBCA> .
|
Thanks for the update. This already know and went through that guide also earlier. This error is just for logging purpose, it doesn't cause an issue. Actual issue is about below error...
Do we have any fix available for this issue? Can you please help me currently with any work around so that I can continue with importing patient via API? I am currently stuck and not able to import patient from our EHR application. Thanks and regards, |
Hi Shardul,
Just checking – you are using version 6, correct?
Thanks.
Peter
From: shardulbanker <[email protected]>
Sent: Wednesday, September 25, 2019 10:44 AM
To: OSEHRA/popHealth <[email protected]>
Cc: peter li <[email protected]>; Comment <[email protected]>
Subject: Re: [OSEHRA/popHealth] Import patients zip file API via POST- /admin/patients is not working (#180)
Hi Shardul, Please check out this documentation - https://github.com/OSEHRA/popHealth/wiki/Getting-Started-with-popHealth-API Make sure the enable_csrf_for_apis: false in the popHealth.yml file. Peter From: shardulbanker [email protected] <mailto:[email protected]> Sent: Wednesday, September 25, 2019 9:10 AM To: OSEHRA/popHealth [email protected] <mailto:[email protected]> Cc: Subscribed [email protected] <mailto:[email protected]> Subject: [OSEHRA/popHealth] Import patients zip file API via POST- /admin/patients is not working (#180 <#180> ) Hi, I am testing POST- /admin/patients API using postman. I am passing below parameters as form data. If 1. file - patient's zip file containing CDA XML file 2. practice_id - Provider's ID 3. practice_name - Provider Name It is throwing below error. Started POST "/api/admin/patients/" for 10.10.0.80 at 2019-09-25 08:57:28 -0400 Processing by Api::Admin::PatientsController#create as / Can't verify CSRF token authenticity Completed 500 Internal Server Error in 453ms NoMethodError (undefined method read' for nil:NilClass): app/controllers/api/admin/patients_controller.rb:47:in block in create' app/controllers/api/admin/patients_controller.rb:47:in open' app/controllers/api/admin/patients_controller.rb:47:in create' However, when I try same zip file from popHealth UI it is working as expected and imported the patient. It increments the patients count and verify the same in MongoDB database in 'records' collection also. Please look into it and suggest way forward as API is not working. Thanks and regards, Shardul — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#180 <#180> ?email_source=notifications&email_token=AAMCG3L4OKNRYFDYORXUZ5LQLNPLJA5CNFSM4I2MTBCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HNTDGTA> , or mute the thread https://github.com/notifications/unsubscribe-auth/AAMCG3JKV4W2P7MV6R4F6ZDQLNPLJANCNFSM4I2MTBCA .
Thanks for the update. This already know and went through that guide also earlier.
This error is just for logging purpose, it doesn't cause an issue. Actual issue is about below error...
NoMethodError (undefined method read' for nil:NilClass): app/controllers/api/admin/patients_controller.rb:47
This error throws at line no. which is highlighted in bold color in sample code snippet.
…_____
api :POST, "/admin/patients", "Upload a zip file of patients."
param :file, nil, :desc => 'The zip file of patients to upload.', :required => true
param :practice_id, String, :desc => "ID for the patient's Practice", :required => false
param :practice_name, String, :desc => "Name for the patient's Practice", :required => false
def create
log_admin_api_call LogAction::ADD, "Upload patient ZIP file", true
**file = params[:file]**
_____
Do we have any fix available for this issue? Can you please help me currently with any work around so that I can continue with importing patient via API? I am currently stuck and not able to import patient from our EHR application.
Thanks and regards,
Shardul
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#180> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AAMCG3L4ADEHAMSWN4NK5STQLN2KZANCNFSM4I2MTBCA> .
|
@petercyli , I am wondering how we can get uploaded file object correctly and apply file.read operation on it. Please suggest way to proceed further. I am not able to proceed further. Thanks.
|
Can you try the API without the practice id? I just used the practice name. |
Tried as suggested through only practice name and file but same error. No improvement. |
I have little bit modified the code of app/controller/api/admin/patients_controller.rb file and changed line no.8 as per code mentioned in earlier comment and changed to line. Now, it is not giving 500 internal server error. Now it fails later stage import patient job with below error. /home/shardulb/osehra_pophealth/tmp/import/failed# vi patient_upload1569505510299.error There problem is related to that we are not passing file correctly to import job. Can you please help how to pass correct file object to import job? Another thing this error collected from failed directory. But internally it tries to search from /home/shardulb/osehra_pophealth/tmp/import/patient_upload1569505510299. This file found in /home/shardulb/osehra_pophealth/tmp/import/failed. Please help and let me know the correct method of passing file object to import job. Thanks. |
Could you please help? |
So the api method tried to import the zip file, but the popHealth had an error processing the zip file; hence, the error seen in the tmp subdirectory. |
Yes. Same zip file is uploaded via popHealth UI and patient count is also increased. Only the problem with API. Can you please share your code of app/controllers/api/admin/patients_controller.rb file? |
This is code from the latest v6 branch - https://github.com/OSEHRA/popHealth/blob/v6/app/controllers/api/admin/patients_controller.rb |
Checked and verified latest v6 branch code and 6.0.0rc1 version and they are same. Nothing is changed. Even I put your file but same issue. I am wondering how it works in your case. I have question about how to read file body parameter correctly to get zip file so that it copies at location /tmp/import directory for further processing. |
I have resolved all the errors. Now records is not inserted into records collection. |
BTW, popHealth version 6 is not using the records collection. Patient data is stored in the qdm_patients collection. There is no extra configuration to generate more debug logs. We will need to add more debug statements to improve logging. |
Currently when file is selected for processing using ImportArchiveJob it will remove it from tmp/import directory. Is there way I can uncomment the code of file removal so that I get the file at tmp/import directory. I need to check file and verify few things. Could you please help code where it removes file from /tmp/import directory? Thanks. |
Please give me you email and I need to contact for further help. We can setup meeting for further discussion. I will show you all details with all options I have tried still API is not working. I checked using UI and it was successful but API is not working. |
Can you send me the zip file containing the test files? |
@petercyli Can I contribute code in master branch? What are the steps to contribute the code? |
Definitely. You can create a pull request to the v6 branch in the popHealth. I will merge the code after reviewing the change. Thanks. |
Hi,
I am testing POST- /admin/patients API using postman. I am passing below parameters as form data. If
It is throwing below error.
Started POST "/api/admin/patients/" for 10.10.0.80 at 2019-09-25 08:57:28 -0400
Processing by Api::Admin::PatientsController#create as /
Can't verify CSRF token authenticity
Completed 500 Internal Server Error in 453ms
NoMethodError (undefined method
read' for nil:NilClass): app/controllers/api/admin/patients_controller.rb:47:in
block in create'app/controllers/api/admin/patients_controller.rb:47:in
open' app/controllers/api/admin/patients_controller.rb:47:in
create'However, when I try same zip file from popHealth UI it is working as expected and imported the patient. It increments the patients count and verify the same in MongoDB database in 'records' collection also.
Please look into it and suggest way forward as API is not working.
Thanks and regards,
Shardul
The text was updated successfully, but these errors were encountered: