tests/testthat/test-extractInformation.R

test_that("Test XML scheme", {
  expect_match(epx.extract(epx.example("SomeFakeData.epx"))$infoEpiData[[1]][1],
               "http://www.epidata.dk/XML/2.1 http://www.epidata.dk/XML/2.1/epx.xsd")
})


# Test Extraction on a simple data set
test_that("Extraction-SomeFakeData",{
  expect_equal(xml2::xml_text(epx.extract(epx.example("SomeFakeData.epx"))$epx),
               "Anhand dieses Beispielprojektes erkläre ich das Arbeiten mit EpiDataHamburgBeispielprojektEine PersonJohann Popp2019/05/21 20.20.552019/05/21 20.20.551no datafemalemaleotherno datakeine AngabeDataset 1IndexDateAge (years)GenderHeight (cm)Weight (kg)NotesEpiData Example Data SetID=1;date=03/11/2023;age=65;gender=2;height=189;weight=78;notes=\"No notes\"ID=2;date=10/11/2023;age=-1;gender=-1;height=160;weight=52ID=3;date=30/10/2023;age=18;gender=1;height=-1;weight=60ID=4;age=39;gender=2;height=170;weight=81;notes=\"This is fake data\"")
})

test_that("Extraction-Clinical_Example",{
  expect_equal(xml2::xml_text(epx.extract(epx.example("Clinical_Example.epx"))$epx),
               "This sample file illustrates how you can build a relational database with a number of dataforms in the project. Relational EpiData Project2014/05/14 14.17.102014/05/14 14.35.581Basic demographic DataDisease Entity descriptionVisit at ClinicUnknown Currently no salaried workPart timeFull timeUnknownInfectious OriginInjuryCancerAppendicitisNot settled yetNoYesUndecidedMissingOdense, DenmarkCopenhagen, DenmarkLa Paz, BoliviaNew Delhi, IndiaRoma, ItalyOttawa, CanadaOther - specifiedPlanned visitAcute - unplannedNo problemsSome problemsSevere problemsStart Entry HerePatient IDSocial Security Number1: Enter basic data\n2: Enter desease\n3: Add/Edit Visit at clinicChoose Dataformtime (new record)time (first save)time (update)today (new record)today (first save)today (update)Relational data - start file_______________________________________________________________________________________PatientID=123;PNumber=\"4551240\";Dataform=2;S4=22.58.30;S5=22.58.30;S6=22.58.30;S1=21/06/2019;S2=21/06/2019;S3=21/06/2019PatientID=55;PNumber=\"092834\";Dataform=3;S4=23.05.22;S5=23.05.22;S6=23.05.22;S1=21/06/2019;S2=21/06/2019;S3=21/06/2019Person and Basic DataPatient IDNameDate of BirthNumber of ChildrenCurrent Worktime (new record)time (first save)time (update)today (new record)today (first save)today (update)Demographic and Person based information_______________________________________________________________________________________PatientID=123;S2=\"Johann Popp\";S3=20/07/1967;S4=1;S5=2;S11=22.59.26;S10=22.59.26;S9=22.59.26;S1=21/06/2019;S7=21/06/2019;S6=21/06/2019PatientID=55;S2=\"Hans hansen\";S3=03/04/1980;S4=0;S5=2;S11=23.05.35;S10=23.05.35;S9=23.05.35;S1=21/06/2019;S7=21/06/2019;S6=21/06/2019Type of DiseasePatient IDType of DiseaseSurgery planned ?Date of SurgeryRehabilitationLength Rehabilitation (Weeks)time (new record)time (first save)time (update)today (new record)today (first save)today (update)Describe Your Disease entities here_______________________________________________________________________________________PatientID=123;S2=2;S9=1;S10=03/08/2019;S11=2;S12=99;S8=23.00.32;S5=23.00.32;S6=23.00.32;S1=21/06/2019;S4=21/06/2019;S3=21/06/2019PatientID=55;S2=3;S9=1;S10=01/07/2019;S11=1;S12=3;S8=23.06.08;S5=23.06.08;S6=23.06.08;S1=21/06/2019;S4=21/06/2019;S3=21/06/2019Visit at ClinicPatient IDDate of visitPlace of Clinical Examinationother Planned visit ?EQ5d-MobilityEQ5d-Self CareEQ5d-Usual ActivitiesEQ5d-Pain/DiscomfortEQ5d-Anxiety/depression0: No\n1: Yestime (new record)time (first save)time (update)today (new record)today (first save)today (update)Information about clinical visitsHealth Related Quality of Life (EuroQol.org ) Notice !! Value labels are simplified herehttp://www.euroqol.orgEnter laboratory results?_______________________________________________________________________________________PatientID=123;S2=22/06/2019;S3=3;S5=1;eq1=1;S7=1;S8=1;S9=1;S10=2;V17=1;V11=23.01.37;V12=23.01.37;S6=23.01.37;S1=21/06/2019;V15=21/06/2019;V16=21/06/2019PatientID=55;S2=22/06/2019;S3=1;S5=1;eq1=2;S7=3;S8=2;S9=1;S10=1;V17=1;V11=23.07.50;V12=23.07.50;S6=23.07.50;S1=21/06/2019;V15=21/06/2019;V16=21/06/2019Lab ResultsPatient IDDate of visitSequence No:HgbLeucocytepHtime (new record)time (first save)time (update)today (new record)today (first save)today (update)Laboratory result_______________________________________________________________________________________PatientID=123;S2=22/06/2019;V3=321;V11=15;V5=4,7;V6=7,1;V7=23.02.28;V12=23.02.28;S6=23.02.28;S1=21/06/2019;V15=21/06/2019;V16=21/06/2019PatientID=55;S2=22/06/2019;V3=9;V11=10;V5=3,3;V6=6,8;V7=23.08.31;V12=23.08.31;S6=23.08.31;S1=21/06/2019;V15=21/06/2019;V16=21/06/2019PatientID=55;S2=22/06/2019;V3=98;V11=8,9;V5=4,5;V6=7,2;V7=23.09.01;V12=23.09.01;S6=23.09.01;S1=21/06/2019;V15=21/06/2019;V16=21/06/2019Dataset 6Patient ID")
})
JohannPopp/epidatR documentation built on Jan. 29, 2024, 1:23 a.m.