Sunday, March 15, 2015

Medicines under evaluation

While browsing through the internet I ran into the medicines under evaluation page of the European Medicines Agency. There was a .pdf for each month and I thought it would be interesting to look if I could analyze those data. Each .pdf contains various sections of medicine, I have been focusing on the 'Non-orphan medicinal products'. The information given is the international non-proprietary name, the area. In addition, an entry in bold is new. The .pdf I looked it contained not too long a list, with about 40 or 50 entries and a few entries in bold. Hence I had the feeling that about a years worth data would see many medicines entering and leaving the list. I decided to take data starting January 2014, hence have 14 months of data.

Importing data

Reading from .pdf is difficult, this proved no exception. Rather than typing all data I pulled tabula 'Tabula is a tool for liberating data tables locked inside PDF files' from the internet. I marked all tables and converted them to spreadsheets. Unfortunately tabula did not understand that two text lines within a cell of the .pdf means it is one string. Quite some post processing was done to rectify this. Still, it is probably more easy than typing all data. Finally, I ended up with 14 .csv files. These could be imported into R. As can be seen, some post processing was needed, there was some inconsistency in spacing usage. The empty lines are a remainder of my merging texts into cells. I thought it more convenient to strip these in R than in each spreadsheet. The superscript 1 refers to a footnote which is indicated in some .pdf which got transformed into its own cell. Again, I decided to do that part in R. Not seen is some caps usage, this was resolved by editing the spreadsheets.
library(dplyr)
library(survival)
csvs <- dir(pattern='.csv')

step1 <- lapply(csvs,function(csv) {
          print(csv)
          r1 <- readLines(csv) 
          r1 <- r1[r1!=',']  # empty lines
          r1<-  r1[r1!=',1'] # lines with superscript 1
          r1 %<>% read.csv(text=., skip=1,col.names=c('Name','Area'),header=FALSE) %>%
              mutate(.,
                  Name=gsub("([[:space:]]+$)|(^[[:space:]]+)", "", Name),
                  Name=gsub(' +',' ',Name),
                  Name=gsub("/",' / ',Name),
                  Name=gsub("-",' - ',Name),
                  Name=gsub(' +',' ',Name),
                  Area=gsub(' *- *','-',Area),
                  Area=gsub(' +',' ',Area),
                  Area=gsub("([[:space:]]+$)|(^[[:space:]]+)", "", Area),
                  csvs=csv)
        }) %>%
    do.call(rbind,.) 
Since this now contains name of mother file rather than actual month, this is added.
csvsdf <- data.frame(csvs=csvs) %>%
    mutate(.,months =factor(tolower(substr(csvs,1,3)),
            levels=c('jan','feb','mrt','apr','may','jun',
                     'jul','aug','sep','oct','nov','dec')),
        year=as.numeric(substr(csvs,5,8)),
        monthno=12*year+c(1:12)[months],
        monthno=monthno-min(monthno)+1) %>%
    arrange(.,monthno)
step2 <- merge(step1,csvsdf) %>%
    mutate(.,Name=factor(Name),
        Area=factor(Area)) %>%
    arrange(.,Area,Name,monthno)

Areas of medicine

There are 99 medicines, distributed over 34 areas. The most frequent areas are:
xtabs(~ Name + Area,step2) %>%
    as.data.frame(.) %>%
    filter(.,Freq!=0) %>%
    xtabs(~ Area,.) %>%
    as.data.frame(.) %>%
    arrange(.,-Freq) %>%
    filter(.,Freq>4)
                                       Area Freq
1                  Antineoplastic medicines   11
2               Antivirals for systemic use   11
3                Medicines used in diabetes    7
4 Medicines for obstructive airway diseases    6
5                          Antihemorrhagics    5
6                  Antithrombotic medicines    5
7               Other therapeutic medicines    5

Duration

The intention was to run a Cox proportional hazards model. Hence I added an extra row for each medicine where I know both the beginning and the end month off.
terminated <- group_by(step2,Name,Area) %>%
    summarise(.,
        time=n()+1,
        event=!(min(monthno)==1 | max(monthno)==14) ) %>%
    filter(.,event) %>%
    select(.,Name,Area,time,event)
living <- mutate(step2,
        event=FALSE,
        time=monthno-ave(monthno,Name,FUN=min)+1) %>%
    select(.,Name,Area,time,event)
both <- rbind(terminated,living) %>%
    as.data.frame(.) %>%
    arrange(.,Area,Name,time)
Unfortunately Coxph gave warning messages, I do not trust the results sufficiently.
#coxph(Surv(time=time,event=event) ~ Name ,data=both)
Looking at the data it self, it seems I have only very sparse data which are not censored:
step2 %>%
    group_by(.,Name,Area) %>%
    summarise(.,
        time=n(),
        event=!(min(monthno)==1 | max(monthno)==14) ) %>%
    mutate(.,time=time+as.numeric(event) ) %>%
    select(.,Name,Area,time,event) %>%
    xtabs(~ time + event,.)
time FALSE TRUE
  1      8    0
  2     14    1
  3      8    3
  4      2    0
  5      9    1
  6      5    2
  7      7    4
  8      1    1
  9      7    0
  10     2    0
  11     9    1
  12     5    2
  13     3    1
  14     3    0

12 comments:

  1. But Dr. Itua, Traditional Herbal Practitioner in Africa, Have cured for HIV which is extracted from some rare herbals. It is highly potential to cure AIDS 100% without any residue. Dr Itua herbal medicine has already passed various blogs on how he use his powerful herbals to heal all kind of diseases such as. Herpes, HIV,,Cushing’s disease,Heart failure,Multiple Sclerosis,Hypertension,Colo_Rectal Cancer, Diabetes, Hepatitis,Hpv,Weak ErectionLyme Disease,Blood Cancer,Alzheimer’s disease,Bechet’s disease,Crohn’s disease,Parkinson's disease,Schizophrenia,Lung Cancer,Breast Cancer,Colo-Rectal Cancer,Blood Cancer,Prostate Cancer,siva.Fatal Familial Insomnia Factor V Leiden Mutation ,Epilepsy Dupuytren's disease,Desmoplastic small-round-cell tumor Diabetes ,Coeliac disease,Creutzfeldt–Jakob disease,Cerebral Amyloid Angiopathy, Ataxia,Arthritis,Amyotrophic Lateral Scoliosis,Fibromyalgia,Fluoroquinolone Toxicity,Brain Cancer,Breast Cancer,Lung Cancer,Kidney Cancer,Syndrome Fibrodysplasia Ossificans ProgresSclerosis,Seizures,Alzheimer's disease,Adrenocortical carcinoma.Asthma,Allergic diseases.Hiv_ Aids,Herpe ,Copd,Glaucoma., Cataracts,Macular degeneration,Cardiovascular disease,Lung disease.Enlarged prostate,Osteoporosis.Alzheimer's disease,Dementia.,Wart Remover,Cold Sore, Epilepsy, also his herbal boost immune system as well. I'm telling this because he uses his herbal medicine to cure me from hepatitis B and HIV, which i have being living for 9 months now with no side effect. The Herbal Medicine is just as good when drinking it although i have to use rest room after drinking it which I do not really care about because i just want to get the virus out of my body, I will recommend Dr Itua to anyone sick out here to contact Dr Itua with this following information.Email...drituaherbalcenter@gmail.com /
    Whatsapp Or Call...+2348149277967.
    He might be late to respond back.

    ReplyDelete
  2. Today there are more than 100 medical conditions that can be helped with holistic hamdard medicine list with details in urdu, including migraines, chronic fatigue syndrome, and even cancer. Making a career in this field definitely seem to be very promising as the demand of holistic medicine doctors are even expected to grow more in the next few years.

    ReplyDelete
  3. March Health Awareness Campaigns National Colorectal Cancer Awareness Month Brain Injury Awareness Month National Kidney Cancer Awareness Month Multiple Sclerosis Awareness Month National Myeloma Awareness Month National Nutrition Month National Endometriosis Month Workplace Eye Wellness Month National Save Your Vision Month Hemophilia Month National Chronic Fatigue Syndrome Awareness Month American Red Cross Month Learning Disabilities Awareness Month... Health Medical Hypnosis

    ReplyDelete
  4. Today there are more than 100 medical conditions that can be helped with holistic viagra tablet , including migraines, chronic fatigue syndrome, and even cancer. Making a career in this field definitely seem to be very promising as the demand of holistic medicine doctors are even expected to grow more in the next few years.

    ReplyDelete
  5. Generally when we fall down with a disease we head our way to a doctor and he at most times recommend a qarshi medicine which normally makes us feel better. But there are at times situations when the conventional medicines do not work for us or simply they are unable to heal the problem. At these circumstances many of us decide to go with alternative medicine.

    ReplyDelete
  6. Occupational health Advisor's (OHA) can contribute by helping managers to manage sickness absence more effectively. The OHA may be involved in helping to train line managers and supervisors in how to best use the occupational health service, in how to refer staff, what type of information will be required and what to expect. Janitorial Services Phoenix AZ

    ReplyDelete
  7. Traditional Chinese Medicine (also called TCM) is the term given to a wide variety of treatments from various locations across Asia.viagra side effects While considered an alternative therapy in Western countries, it's a long-standing and widely accepted medical practice in many Asian countries. But what exactly is TCM?

    ReplyDelete
  8. Medicine management looks at and sets out standards regarding the way that medicines are prescribed, stored, transported and used in an attempt to protect both the largo cream results professionals administering drugs and the patients who receive them. The MHRA in 2004 stated that Medicine Management was - The clinical, cost effective and safe use of medicines to ensure that patients get the maximum benefit from the medicines they need, while minimising potential harm.

    ReplyDelete
  9. While Chinese largocream.com.pk/product/largo-cream-price-in-pakistan may be considered "alternative" medicine in the West, it is an accepted form of conventional medicine in Eastern cultures - Chinese medicine colleges are trying to change this Western mode of thinking by researching, teaching and administering comprehensive training in this unique healing art.

    ReplyDelete
  10. The traditional medicines are playing an important role in human society from the past centuries. Traditional medical practice illustrates the medical knowledge practices, which improved more than centuries ago within a variety of societies before the era of modern Allopathic or Homeopathic medication begins. Ayurvedic medicine, traditional Chinese medicine, Unani, herbal, African Yoruba Ifa, Muti as well as many other ancient medical practices from all over the world are included in Traditional medicines. https://medicalstoreonline.pk/product/vigrx-plus-price-in-pakistan/

    ReplyDelete
  11. For eons now, mankind has searched for ways to heal the many ailments that continue to plague millions of people in all parts of the world. The advances in both conventional and original forms of medicine, although contradictory for the most part, have unintentionally brought us to the birthing of an entirely new system of medicine. The emerging New Medicine system will eradicate disease, frailty and aging as we know it. Find out how. https://www.medicalstoreonline.pk/product/cialis-20mg-price-in-pakistan/

    ReplyDelete
  12. Greetings to the general public, i want to inform the public how i was cured of HERPES Simplex Virus by a Doctor called Dr. Omola i visited different hospital but they gave me list of drugs like Famvir, Zovirax, and Valtrex whicmptoms and never cured me. I was browsing through the Internet searching for remedy on HERPES and i saw comment of people talking about how Dr. Omola cured them. when i contacted him he gave me hope and send a Herbal medicine to me that i took and it seriously worked for me, i am a free person now without problem, my HERPES result came out negative. I pray for you Dr. Omola God will give you everlasting life, you shall not die before your time for being a sincere and great man. Am so happy, you can also contact him if you have any problem, Email Address dr.omolaherbalhome@gmail.com thank me later.

    ReplyDelete