Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216047

Generating a matrix of interactions

$
0
0

OK, this one is a bit tough to explain but I figured I'd give it a shot.

 

What I have is a table of patient codes and medications given like so:

 

PatientID,Medication

52300,CLONAZEPAM

52300,DIVALPROEX

52300,QUETIAPINE

52300,LORAZEPAM

945596,LEVETIRACETAM

945596,MELATONIN

945596,DIPHENHYDRAMINE

317327,CIPROFLOXACIN

317327,CLONAZEPAM

317327,QUETIAPINE

317327,VALPROATE

 

What I want to end up with is a count of each drug interaction for a patient, so I imagine it would look something like this:

 

CLONAZEPAM,CLONAZEPAM,2

CLONAZEPAM,DIVALPROEX,1

CLONAZEPAM,QUETIAPINE,2

CLONAZEPAM,LORAZEPAM,1

CLONAZEPAM,VALPROATE,1

CLONAZEPAM,LEVETIRACETAM,0

...

 

or maybe:

 

Drug,CLONAZEPAM,DIVALPROEX,QUETIAPINE,LORAZEPAM,VALPROATE,LEVETIRACETAM...

CLONAZEPAM,2,1,2,1,1,0...

 

Essentially a big matrix of how many patients are taking which drugs together.

 

Anyone have any bright ideas on how to achieve this? ?

 


Viewing all articles
Browse latest Browse all 216047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>