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

Export function is not working Sample Test #7628

Closed
nihal467 opened this issue Apr 16, 2024 · 6 comments · Fixed by ohcnetwork/care#2101
Closed

Export function is not working Sample Test #7628

nihal467 opened this issue Apr 16, 2024 · 6 comments · Fixed by ohcnetwork/care#2101
Assignees
Labels
Backend P1 breaking issue or vital feature

Comments

@nihal467
Copy link
Member

Describe the bug

the export function is not working for the sample test homepage

To Reproduce

  1. Go to /sample
  2. Click on export button
  3. See error

Expected behavior

the export function should be working for the sample test homepage as expected

Screenshots

image

@AshrafMd-1
Copy link
Contributor

AshrafMd-1 commented Apr 16, 2024

@nihal467 The URL seems to be wrong

image image

@Ashesh3
Copy link
Member

Ashesh3 commented Apr 16, 2024

@nihal467 The URL seems to be wrong

image image

api url is correct.

This is the stacktrace of the crash:

FieldError
Unsupported lookup 'age' for BigAutoField or join on the field not permitted, perhaps you meant range or gte?

Cannot resolve keyword 'age' into field. Choices are: abha_number, abha_number_id, action, address, allergies, allow_transfer, assigned_to, assigned_to_id, blood_group, cluster_name, consultations, contact_with_confirmed_carrier, contact_with_suspected_carrier, contacted_patients, contacts, countries_travelled, countries_travelled_old, covin_id, created_by, created_by_id, created_date, date_declared_positive, date_of_birth, date_of_delivery, date_of_receipt_of_information, date_of_result, date_of_return, date_of_test, death_datetime, deleted, designation_of_health_care_worker, disease_status, district, district_id, emergency_phone_number, estimated_contact_date, external_id, facility, facility_id, fit_for_blood_donation, frontline_worker, gender, has_SARI, id, instituion_of_health_care_worker, is_active, is_antenatal, is_declared_positive, is_medical_worker, is_migrant_worker, is_vaccinated, last_consultation, last_consultation_id, last_edited, last_edited_id, last_menstruation_start_date, last_vaccinated_...


Crashed in non-app: django/db/models/sql/query.py in names_to_path

Show 6 more frames

care/facility/api/viewsets/patient_sample.py in list at line 127
In App

            and request.user.user_type < User.TYPE_VALUE_MAP["Doctor"]
        ):
            raise PermissionDenied()
        if settings.CSV_REQUEST_PARAMETER in request.GET:
            queryset = self.filter_queryset(self.get_queryset()).values(
                *PatientSample.CSV_MAPPING.keys()
            )
            return render_to_csv_response(
                queryset,
                field_header_map=PatientSample.CSV_MAPPING,
__class__	
<class 'care.facility.api.viewsets.patient_sample.PatientSampleViewSet'>
args	
[]
kwargs	
{}
request	
<rest_framework.request.Request: GET '/api/v1/test_sample/?csv=1&'>
self	
<care.facility.api.viewsets.patient_sample.PatientSampleViewSet object at 0x7f7fd3d49510>

Show More
Called from: rest_framework/views.py in dispatch

@AshrafMd-1
Copy link
Contributor

@Ashesh3 It seems like a backend issue most probably because there is no age field in the DB
Even in the frontend we calculate age by using data of birth
also adding a backend tag would be better

@nihal467 nihal467 added P1 breaking issue or vital feature Backend labels Apr 18, 2024
Copy link

⚠️ Refrain from assigning this issue to yourself if you have another P1 issue assigned that is not yet closed.

Copy link

sentry-io bot commented Apr 18, 2024

Sentry Issue: CARE-B0N

Copy link

sentry-io bot commented Apr 18, 2024

Sentry Issue: CARE-B8X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend P1 breaking issue or vital feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants