yalla-coop / curenetics

A platform enabling medical professionals to more quickly find relevant clinical trials for their patients
2 stars 0 forks source link

Research querying Jaime's API and put forward recommendations on how to carry out the required filtering #44

Open susanX opened 4 years ago

susanX commented 4 years ago

Research how Jamie's app was queried in the last Curenetics project. Link to last Curenetics project code https://github.com/fac-15/Curenetics/blob/master/src/Components/Results/Results.js [line 16 fetch request] getTrials = () => { const { postCode, age, gender } = this.props.userInfo; const baseUrl = "https://curenetics-api.herokuapp.com/data/trials/uk/"; const distance = "100"; fetch(${baseUrl}${postCode || "B152TH"}/${distance}/${gender || "m"}/${age || "70"}/.json) .then(res => res.json()) .then(result => { this.setState({ results: result.results, isLoading: false, });

martinbagshaw commented 4 years ago

Results.js

thejoefriel commented 4 years ago

Hi @mr-bagglesworth - in this issue you can see how we're expecting the data from the medical record to look: https://github.com/yalla-coop/curenetics/issues/4 which can inform on what we're then looking to query on Jamie's API.

As you've mentioned before currently in Jamie's API we would be looking for the following criteria to carry out filtering :

To confirm, we won't filter out based on location, except to rule out non-UK trials

In addition, Jamie is modifying the API so we should also have:

We need more clarification though as to how this would look (i.e. will it be a key value pair of Disease within prostate: ineligible ) . We are waiting for @sesola to confirm this with Jamie.

thejoefriel commented 4 years ago

@mr-bagglesworth as discussed please use this issue to:

martinbagshaw commented 4 years ago

This PR will be the source of all query functions. It contains plenty of my musings and notes on the query functions and what we may want to filter out and search by. It filters the JSON copied over from the previous API, and savedhere(on Susan's Github).

Up until this morning (29 / 9 / 2019) I have filtered the top level properties of the above object, which contains info such as gender, age, and conditions using reduce, which for those who haven't used this array method much before, can be treated as a filter within a map - a more efficient way of running .filter then .map, which will loop over the data twice before returning a result.

So far, I have filtered out results with invalid values by writing a validation object that gets referenced from the filter function. The type of search conducted - e.g. 'Conditions' sometimes has the value undefined, which will break the filter function. This validation filters out such results.

Moving forward

Useful:

Screenshot 2019-09-29 at 11 42 33

Not Useful:

Screenshot 2019-09-29 at 11 42 25
thejoefriel commented 4 years ago

This is great work @mr-bagglesworth - thanks for laying it out.

The Trial result has a property OverallStatus, which says whether the trial is recruiting, not recruiting, finished, etc. Each location also has a property, Status which provides us with the same info. This information is not always consistent with the overall trial status. Do we want to filter trial status on a per-location basis, or a per-trial basis?

What you recommend is the simplest? Perhaps we just take the overall status as that's the data that is most consistently in there?

thejoefriel commented 4 years ago

By the way @mr-bagglesworth - going forward it's important this week that the rest of the team can start working on this. I think @MohammedYehia will be working on it as he's looking at the clinical trials rendering at the moment.

Has the latest work been pushed up (as of 1st Oct) ?

What is the best way for this to proceed @MohammedYehia @mr-bagglesworth ?

martinbagshaw commented 4 years ago

@joe I pushed up my latest commit last night. Regarding recruiting status, I think we need to search by locations within each trial - as you can see from the example above an invalid overall status may contain locations that are recruiting, which we shouldn't miss.

My next steps will be:

The whole data processing cycle may look like: 1 - filter out non uk results 2 - filter out non recruiting locations 3 - run user defined filter functions

martinbagshaw commented 4 years ago

A further thought:

@thejoefriel @MohammedYehia @susanX @wright1 @othman-shamla Please discuss

MohammedYehia commented 4 years ago

I agree with @mr-bagglesworth we should display it on the UI so we are filtering for location recruiting status within the UK first and then displaying both the location status and the overall status

MohammedYehia commented 4 years ago

@thejoefriel after reviewing the result array I found that maybe this process will work for us

  1. Filter the API result by OverallStatus by these conditions [recruiting, unknow status]
  2. Save the object as a reference for the rest of the filtering
  3. filter for [age, gender, phase, conditions(cancer type), ECOG..]
  4. include [only UK and Location status as recruiting]
  5. exclude data that doesn't contain the name AND the contact detail

the problem now with the Nearly Eligible Trials how to decide this? for example, age is older by 1 and Gleason bigger by 1 or what are the criteria for this thing?

thejoefriel commented 4 years ago

Hi @MohammedYehia - we need @sesola to get back to us on thresholds for nearly eligible trials. For now let's go with the following:

Also to confirm for ECOG score I believe the patient is eligible as long as their score is less than the maximum number found

That is all we will do now for nearly matches until @sesola provides us further guidance. @sesola if you could get back to us on this today/tomorrow that would be hugely appreciated.

thejoefriel commented 4 years ago

Please also refer to https://github.com/yalla-coop/curenetics/issues/81 which shows what the additional criteria will look like in the clinical trials JSON data sets

MohammedYehia commented 4 years ago

Is there going to be any filtering on the backend API? or is he just returning the whole JSON and all the filter is going to be on the frontend side this way all that the find clinical trials button doing is sending a request to get the whole data from Jamie's API then we are doing the filter is this right?