phenopolis / phenopolis_genomics_browser

Python API and React frontend for the Phenopolis Genomics Browser
https://dev-live.phenopolis.org
MIT License
31 stars 2 forks source link

Create patient: sex unknown issue #327

Closed alanwilter closed 3 years ago

alanwilter commented 3 years ago

Frontend should send 'U' instead of 'unknown'.

YuanTian1991 commented 3 years ago

Hi:

I have changed the front to return "U" when sex was chosen as "Unknown". See below screenshot. However, I noticed if it send "U", the updating is not successful. I guess you will change the backend to make it work right?

Screenshot 2021-04-18 at 16 37 15

I will merge now.

YuanTian1991 commented 3 years ago

Also, do you need "U" sending for Consanguinity?

alanwilter commented 3 years ago

No.

    "individual_consanguinity_check" CHECK (consanguinity = ANY (ARRAY['yes'::text, 'no'::text, 'unknown'::text]))
    "individual_sex_check" CHECK (sex = ANY (ARRAY['M'::text, 'F'::text, 'N'::text, 'U'::text]))
alanwilter commented 3 years ago

It's not working in dev-live neither in my branch tests.

alanwilter commented 3 years ago

@YuanTian1991 I found that in frontend/src/components/CreatePatient/InformationForm.js, line 227: Replace:

                    <Grid item xs={3}>
                      <FormControlLabel
                        value="unknown"
                        control={<Radio color="primary" />}
                        label="Unknown"
                        labelPlacement="Unknown"
                      />
                    </Grid>

for

                    </Grid>
                    <Grid item xs={3}>
                      <FormControlLabel
                        value="U" // <--- change here
                        control={<Radio color="primary" />}
                        label="Unknown"
                        labelPlacement="Unknown"
                      />
                    </Grid>

solves the issue in http://localhost:8888/create_patient (The create patient page), but I didn't commit any change.

However I couldn't solve the issue in the "Edit Patient Page", e.g., http://localhost:8888/editpatient/PH00008256#info. If change sex for a patient to Unknown, it triggers the error. I tried several things in frontend/src/components/Individual/EditPerson.js (which I'm not even sure if this file is used) and couldn't find out why the frontend still sends unknown instead of U to the backend.

I also tried with frontend/src/components/EditPatient/InformationUpdate.js and frontend/src/components/UpdatePatient/InformationUpdate.js

BTW, why these two almost identical files? I'm quite sure we are not using one of them (I'd bet on the former, in UpdatePatient folder). It would be good to the frontend code from redundant/unused files.

At the end I got quite confused with JS, I could even use debug in VScode and Firefox, but I couldn't fix your code.

Screenshot 2021-05-13 at 15 25 35

So you need to be sure that create and change/updating patient is fully working.

alanwilter commented 3 years ago

Hold on, I found something weird on the back end, def create_individual(): and def update_patient_data(phenopolis_id): are not using the same definition for sex unknown. Let me check this first.