The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

find two consecutive dates

AbbasZavar22AbbasZavar22 Member Posts: 6 Learner I
edited May 2022 in Help
Hi there,
I have a data set of patients with their lab test results (+ the date of test).
Each patient may have several lab tests. I want to find the latest date of lab test (abnormal one) and the exact previous one (based on the date) for each patient.
Any recommendation on how I can get the latest date and the previous one (two consecutive dates)



Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data Scientist
    Hi,
    I would group into collection by patient id use loop collection, sort by time and use Filter Example Range to take the last 2.

    BR,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi!

    This will work as long as the last lab test is the last entry by customer. If not, you could use Aggregate to get the date of the latest positive lab test, self-join with this entry, and use Generate Attributes (e. g. the date_diff() function) to determine if the entries are later. These can be filtered out with Filter Examples. 

    Regards,
    Balázs 
  • AbbasZavar22AbbasZavar22 Member Posts: 6 Learner I
    mschmitz  

    Could you please provide me with more explanation, step by step with the name of the operators? 
    Thanks a lot in advance 
Sign In or Register to comment.