mdsol / rwslib

Provide a (programmer) friendly client library to Rave Web Services (RWS).
MIT License
31 stars 13 forks source link

Authentication failed #112

Closed vagarwal77 closed 3 years ago

vagarwal77 commented 3 years ago

I am trying to create RWS connection to Rave https://xxx-innovate.imedidata.com/apps/EDC and getting below error with all the combinations.

rws_connection = RWSConnection('https://xxx-innovate.imedidata.com', 'xxxx', 'yyyy')

rws_connection = RWSConnection('https://xxx-innovate.imedidata.com/apps/edc/api/v2', 'xxxx', 'yyyy')

rws_connection = RWSConnection('https://xxx-innovate.imedidata.com/apps/edc', 'xxxx', 'yyyy')

raise RWSException("IIS Error", r.text)

I can login to web instance successfully with the same credential. Please suggest how to create connection as i had tried all options documented at https://rwslib.readthedocs.io/en/latest/getting_started.html?highlight=RWSException#error-handling

iansparks commented 3 years ago

@vagarwal77 that looks like you are trying to connect with iMedidata Credentials. RWS works only with Rave Classic credentials.

If you go to the web instance and you see a page like this to log in then you are using iMedidata credentials. RWS does not work with these credentials

image

If you go to the web instance and you see a page like this and can log in then you are using CLASSIC credentials. These are the ones you want and the only ones that work with RWS:

image

vagarwal77 commented 3 years ago

Thanks @iansparks . I have only iMedidata credentials. I am still not clear on differences between iMedidata and Medidata Rave. Is there a way to access iMedidata also over API endpoints?

iansparks commented 3 years ago

There are some iMedidata APIs but these only relate to data held in iMedidata (users, sites, studies etc) not clinical data.

The iMedidata APIs are all accessed via MAuth which is based on a token, not on a username/password. If you want to do anything with RWS and Rave clinical data then you need a Rave classic account. You can also use RWS with MAuth credentials but these must still be related to a Rave classic user in the Rave system so there is no getting away from needing a Rave Classic account, sorry.

vagarwal77 commented 3 years ago

Thanks for all the help @iansparks I have made all the progress and can get and post except one below issue -

I am trying to post clinical Data with rws_connection.send_request(PostDataRequest(data)) but getting below error... rwslib.rwsobjects.RWSException: Unit Dictionary does not exist

Not sure whether i am missing any thing in the xml. Below XML has been replaced with dummy values

image

<ODM FileType="Transactional" FileOID="232323-682e-421b-bbd6-4a41e223df27" CreationDateTime="2021-04-08T16:20:13.453-00:00" ODMVersion="1.3" xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.cdisc.org/ns/odm/v1.3">

</ODM>
iansparks commented 3 years ago

I think one of your fields (height?, weight?) has a Unit Dictionary attached to it. So when you provide a value like "144.0" is that inches? feet? cm? miles? au?

You need a MeasurementUnitRef for it inside your ItemData:

                   <ItemData ItemOID="VSORRES.HEIGHT" Value="144.0">
                        <MeasurementUnitRef MeasurementUnitOID="UNIT_DICTIONARY_NAME.CODED_VALUE"/>  <!--e.g.  HEIGHT.CM -->
                   </ItemData>

Can't be 100% sure that is the problem, but that is my guess.

vagarwal77 commented 3 years ago

Thanks @iansparks for help.. Thanks a lot for extending all the help. Now, we are able to make the connection over RWS and pull the CRFs.

With lab forms, we are getting a strange behavior with GET -

Issue with GET- Missing M_LBORRES_HGB_BLOOD value We are able to get the questionnaire back successfully but not its clinical data. For example, in “Local Lab Results – Hematology” form, we are getting “M_LBSTAT_HGB_BLOOD” field back in the filled CRF but not the entered “Hemoglobin (HGB), Blood” value as fieldOID – “M_LBORRES_HGB_BLOOD”. We are expecting LB_GEN_U01_G02_V01.M_LBORRES_HGB_BLOOD to be returned with value "14". iMetadata filled form are showing the correct data in UI.

rws_connection.send_request(StudyDatasetRequest(project_name=final, environment_name='DEV', formoid='LB_GEN_U01_G02_V01'))

image

iansparks commented 3 years ago

Hi @vagarwal77 I suspect the problem is that the data you want is in the LAB dataset. This comment thread might help you explore this:

https://github.com/mdsol/rwslib/issues/110

My point is you want to get the V_MYSTUDYNAME_Lab view I think. I don't think you can get that with a StudyDatasetRequest but if you make a request to:

GET https://{host}/RaveWebServices/datasets/V_MYSTUDYNAME_Lab.csv

You can probably get it in CSV format.

iansparks commented 3 years ago

@vagarwal77 is this still open or can we close this issue?

glow-mdsol commented 3 years ago

Closing, it's been a while