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

Error while creating or verify the ABHA Card.. #441

Open
1 task done
mr-yogesh opened this issue May 8, 2024 · 12 comments
Open
1 task done

Error while creating or verify the ABHA Card.. #441

mr-yogesh opened this issue May 8, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@mr-yogesh
Copy link

Information about bug

Hello,

I am encountering a error, while I trying to verify or creating a "ABHA Card" in the "Patient" doctype.
Here I attached a screenshots, I am encountering the error..

This is the screenshots for "Verfify ABHA Card":
image

It's a screenshots for creating a new "ABHA Card": And this error occurs, while I click the "Generate ABHA" button..
image

What can I do and when will this issue solved?

Module

Regional / Other Integrations

Version

ERPNext: v15.22.2 (version-15)

Frappe Framework: v15.25.0 (version-15)

Frappe Health: v15.0.0 (version-15)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

In my web console, I seen this error msg,

unhide_field cannot find field abha_number
unhide_field cannot find field abha_address


Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1761, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/client.py", line 129, in get_value
    value = get_list(
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/client.py", line 66, in get_list
    validate_args(args)
  File "apps/frappe/frappe/desk/reportview.py", line 95, in validate_args
    validate_filters(data, data.filters)
  File "apps/frappe/frappe/desk/reportview.py", line 160, in validate_filters
    raise_invalid_field(fieldname)
  File "apps/frappe/frappe/desk/reportview.py", line 182, in raise_invalid_field
    frappe.throw(_("Field not permitted in query") + f": {fieldname}", frappe.DataError)
  File "apps/frappe/frappe/__init__.py", line 645, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 610, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 561, in _raise_exception
    raise exc
frappe.exceptions.DataError: Field not permitted in query: abha_number

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mr-yogesh mr-yogesh added the bug Something isn't working label May 8, 2024
@mr-yogesh
Copy link
Author

@akashkrishna619 Is there is any update related with this?

@akurungadam
Copy link
Collaborator

@Sajinsr please take a look?

@Sajinsr
Copy link
Collaborator

Sajinsr commented May 13, 2024

@mr-yogesh Can you please check the field "abha_number" exist in patient doctype? it is added when the time of setting up healthcare for region India. If it is not there you can add a custom field with field-type: data

@mr-yogesh
Copy link
Author

@Sajinsr Thanks for you guidance, Now, I added a custom field named "abha_number" with a type "data" after this, I try to verify the abdm, I will get this below error on my console. But, the below 3 arguments are working in my server.. Can help me with this.

image

Server Error
Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1718, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
TypeError: abdm_request() missing 3 required positional arguments: 'payload', 'url_key', and 'req_type'

@mr-yogesh
Copy link
Author

@akurungadam @Sajinsr Please help me with this asap, Now I am working on this..

@akurungadam
Copy link
Collaborator

@Sajinsr, please take a look. thanks!

@mr-yogesh
Copy link
Author

@Sajinsr I tried in my Local Virtual Machine server, I able to create a ABHA Card, but after that, when I try to verify the abha again, it will shows the below error..

### App Versions

{
"erpnext": "15.22.2",
"frappe": "15.25.0",
"healthcare": "15.0.0"
}

### Route

Form/Patient/HLC-PAT-2024-00002

### Traceback

Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 110, in application
response = frappe.api.handle(request)
File "apps/frappe/frappe/api/init.py", line 49, in handle
data = endpoint(**arguments)
File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 49, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/init.py", line 1761, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
File "apps/frappe/frappe/init.py", line 921, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File "apps/frappe/frappe/desk/notifications.py", line 289, in get_open_count
external_links_data_for_d = get_external_links(d, name, links)
File "apps/frappe/frappe/desk/notifications.py", line 338, in get_external_links
frappe.get_all(
File "apps/frappe/frappe/init.py", line 2050, in get_all
return get_list(doctype, *args, **kwargs)
File "apps/frappe/frappe/init.py", line 2025, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
File "apps/frappe/frappe/model/db_query.py", line 191, in execute
result = self.build_and_run()
File "apps/frappe/frappe/model/db_query.py", line 232, in build_and_run
return frappe.db.sql(
File "apps/frappe/frappe/database/database.py", line 234, in sql
self._cursor.execute(query, values)
File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 153, in execute
result = self._query(query)
File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 822, in _read_query_result
result.read()
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1200, in read
first_packet = self.connection._read_packet()
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet
packet.raise_for_error()
File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'tabSales Invoice.patient' in 'where clause'")

### Request Data

{
"type": "GET",
"args": {
"doctype": "Patient",
"name": "HLC-PAT-2024-00002",
"items": "["Patient Encounter","Lab Test","Patient Assessment","Therapy Session","Therapy Plan","Inpatient Record","Inpatient Medication Order","Sales Invoice","Payment Entry"]"
},
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.desk.notifications.get_open_count",
"request_id": null
}

### Response Data

{
"exception": "pymysql.err.OperationalError: (1054, "Unknown column 'tabSales Invoice.patient' in 'where clause'")",
"exc_type": "OperationalError"
}

@Sajinsr
Copy link
Collaborator

Sajinsr commented May 15, 2024

@mr-yogesh Let me try to replicate this and fix it asap

@Sajinsr
Copy link
Collaborator

Sajinsr commented May 16, 2024

@mr-yogesh Seems like you missed some custom fields, we couldn't replicate this issue, Can you check and below steps?

  • ABDM related custom fields are only generated when the time of healthcare setup and if the company having country India
  • Possibily you have been setup healthcare with different country and added Indian company after the setup, so the fields will not generate then
  • You may need to add the custom fields manually for missing fields

@mr-yogesh
Copy link
Author

@Sajinsr Here I attached a screenshot of ABHA Request Screen - When I try to Verify the ABHA in Patient doctype.

Verify ABHA Error Screenshot

@sooriyaoli
Copy link

Issue resolved ! Hack is that for verification we need to use the @sbx suffix instead of abdm since the url is sandbox.

@mr-yogesh
Copy link
Author

@Sajinsr When I try to Verify my ABHA in Patient screen on my local server, I am getting the below error msg. How can I solve this?

### App Versions

{
"erpnext": "15.24.0",
"exotel_integration": "0.0.1",
"frappe": "15.27.0",
"healthcare": "16.0.0-dev",
"hrms": "16.0.0-dev",
"waba_integration": "0.0.1"
}

### Route

Form/Patient/UHID-2024-00001

### Traceback

Traceback (most recent call last):
File "env/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 110, in application
response = frappe.api.handle(request)
File "apps/frappe/frappe/api/init.py", line 49, in handle
data = endpoint(**arguments)
File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 49, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/init.py", line 1768, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
File "apps/healthcare/healthcare/regional/india/abdm/utils.py", line 218, in get_health_data
abha_url = get_abha_card(response["token"])
File "apps/healthcare/healthcare/regional/india/abdm/utils.py", line 260, in get_abha_card
response = abdm_request("", "get_card", "Health ID", header, "")
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
File "apps/healthcare/healthcare/regional/india/abdm/utils.py", line 139, in abdm_request
req.response = json.dumps(response.json(), indent=4)
File "env/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

### Request Data

{
"type": "POST",
"args": {
"otp": "835947",
"txnId": "2bab486b-d372-4561-8f64-8d8232e72f35",
"auth_method": "AADHAAR_OTP"
},
"freeze": true,
"freeze_message": "

Verifying OTP...
\n\t\t\t\t\tPlease note, this may take a while",
"headers": {},
"error_handlers": {},
"url": "/api/method/healthcare.regional.india.abdm.utils.get_health_data",
"request_id": null
}

### Response Data

{
"exception": "requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)",
"exc_type": "JSONDecodeError",
"_exc_source": "healthcare (app)",
"_server_messages": "["{\"message\": \"Attached To Name must be a string or an integer\", \"title\": \"Message\", \"indicator\": \"red\", \"raise_exception\": 1, \"__frappe_exc_id\": \"36ed303cb1cf0c161ae635e3d8e50d31b6dd19d3903a03282c318de1\"}"]"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants