Convert-Pheno

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/omop2bff/in/mimic_specimen/SPECIMEN.csv
t/omop2bff/in/omop_cdm_eunomia.sql
t/omop2bff/in/PERSON.csv
t/omop2bff/in/README.md
t/omop2bff/out/individuals.json
t/omop2bff/out/individuals_csv.json
t/omop2bff/out/individuals_csv.json.gz
t/omop2bff/out/individuals_drug_exposure.json.gz
t/omop2bff/out/ohdsi.json
t/omop2pxf/out/pxf.json
t/openehr2bff/in/compo_corona.json
t/openehr2bff/in/gecco_personendaten.json
t/openehr2bff/in/gecco_personendaten_patient.json
t/openehr2bff/in/ips_canonical.json
t/openehr2bff/in/laboratory_report.json
t/openehr2bff/in/README.md
t/openehr2bff/out/individuals.json
t/openehr2pxf/out/pxf.json
t/pxf2bff/in/pxf.json
t/pxf2bff/in/pxf.yaml
t/pxf2bff/in/pxf_biosamples.json

share/db/concepts_candidates_2_exposure.csv  view on Meta::CPAN

4140933	Seen by occupational health service	Observation	SNOMED	Clinical Finding	S	"305877000"	2002-01-31	2099-12-31	
4136471	Under care of occupational health physician	Observation	SNOMED	Clinical Finding	S	"305523007"	2002-01-31	2099-12-31	
4136492	Under care of community-based occupational therapist	Observation	SNOMED	Clinical Finding	S	"305606006"	2002-01-31	2099-12-31	
4136493	Under care of social services department occupational therapist	Observation	SNOMED	Clinical Finding	S	"305607002"	2002-01-31	2099-12-31	
4138216	Seen by community-based occupational therapist	Observation	SNOMED	Clinical Finding	S	"305774002"	2002-01-31	2099-12-31	
4138217	Seen by social services department occupational therapist	Observation	SNOMED	Clinical Finding	S	"305775001"	2002-01-31	2099-12-31	
4138351	Seen by occupational therapy service	Observation	SNOMED	Clinical Finding	S	"305852001"	2002-01-31	2099-12-31	
46285972	Education on provision of occupational skills training to service user	Observation	SNOMED	Context-dependent	S	"979391000000102"	2015-10-01	2099-12-31	
4263813	Chemotherapy AND/OR radiation therapy prior to lymphadenectomy	Observation	SNOMED	Context-dependent	S	"396780003"	2003-07-31	2099-12-31	
4287023	No chemotherapy AND/OR radiation therapy prior to lymphadenectomy	Observation	SNOMED	Context-dependent	S	"396781004"	2003-07-31	2099-12-31	
756049	History of Suspected exposure (but ruled out after evaluation) to Severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) in the 14 days prior to illness onset	Observation	OMOP Extension	Context-dependent	S	OMOP4873925	2020-03-18	2099-12-...
756063	History of Animal exposure in the 14 days prior to illness onset	Observation	OMOP Extension	Context-dependent	S	OMOP4873939	2020-03-18	2099-12-31	
756040	History of Close exposure to Severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) in the 14 days prior to illness onset	Observation	OMOP Extension	Context-dependent	S	OMOP4873943	2020-03-18	2099-12-31	
756048	History of Suspected exposure to Severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) in the 14 days prior to illness onset	Observation	OMOP Extension	Context-dependent	S	OMOP4873923	2020-03-18	2099-12-31	
762538	Mother receiving radiation therapy	Observation	SNOMED	Context-dependent	S	"428641000124103"	2012-09-01	2099-12-31	
4079773	Patient advised about exposure to the sun	Observation	SNOMED	Context-dependent	S	"183079004"	2002-01-31	2099-12-31	
4327716	Family history of radiation therapy	Observation	SNOMED	Context-dependent	S	"430786004"	2008-07-31	2099-12-31	
35609834	Daily HIV-PrEP (human immunodeficiency virus pre-exposure prophylaxis) commenced	Observation	SNOMED	Context-dependent	S	"1086581000000100"	2017-10-01	2099-12-31	
35609835	Event-based HIV-PrEP (human immunodeficiency virus pre-exposure prophylaxis) commenced	Observation	SNOMED	Context-dependent	S	"1086591000000103"	2017-10-01	2099-12-31	
35609836	HIV-PrEP (human immunodeficiency virus pre-exposure prophylaxis) declined	Observation	SNOMED	Context-dependent	S	"1086601000000109"	2017-10-01	2099-12-31	
35609855	HIV-PrEP (human immunodeficiency virus pre-exposure prophylaxis) discontinued	Observation	SNOMED	Context-dependent	S	"1086781000000107"	2017-10-01	2099-12-31	
36683665	Fetal exposure to methamphetamine	Observation	SNOMED	Context-dependent	S	"781699006"	2019-01-31	2099-12-31	
36714396	Rabies post exposure prophylaxis contraindicated	Observation	SNOMED	Context-dependent	S	"719603008"	2017-01-31	2099-12-31	
37016704	Assessment of environmental risk done	Observation	SNOMED	Context-dependent	S	"712805000"	2016-01-31	2099-12-31	

share/db/concepts_candidates_2_exposure.csv  view on Meta::CPAN

4316861	Accident caused by exposure to noise	Observation	SNOMED	Event	S	"218226008"	2002-01-31	2099-12-31	
4317932	Overexposure to sun rays	Observation	SNOMED	Event	S	"218201004"	2002-01-31	2099-12-31	
4317934	Overexposure to radioactive isotopes	Observation	SNOMED	Event	S	"218209002"	2002-01-31	2099-12-31	
4317935	Overexposure to radiobiologicals	Observation	SNOMED	Event	S	"218210007"	2002-01-31	2099-12-31	
4320000	Overexposure to microwave radiation	Observation	SNOMED	Event	S	"218192005"	2002-01-31	2099-12-31	
4320003	Overexposure to gamma rays	Observation	SNOMED	Event	S	"218204007"	2002-01-31	2099-12-31	
4320004	Overexposure to hard X-rays	Observation	SNOMED	Event	S	"218205008"	2002-01-31	2099-12-31	
4320005	Overexposure to soft X-rays	Observation	SNOMED	Event	S	"218206009"	2002-01-31	2099-12-31	
4320027	Exposure to extreme temperature, non-occupational	Observation	SNOMED	Event	S	"95866005"	2002-01-31	2099-12-31	
35622979	Occupational exposure to extreme temperature	Observation	SNOMED	Event	S	"765226004"	2018-07-31	2099-12-31	
37310260	Close exposure to SARS-CoV-2 (severe acute respiratory syndrome coronavirus 2) infection	Observation	SNOMED	Event	S	"1240441000000108"	2020-02-04	2099-12-31	
42535209	Occupational exposure to radiation	Observation	SNOMED	Event	S	"16090451000119101"	2018-01-31	2099-12-31	
42535211	Occupational exposure to toxic agents	Observation	SNOMED	Event	S	"16090571000119109"	2018-01-31	2099-12-31	
42535212	Occupational exposure to risk factor	Observation	SNOMED	Event	S	"16090731000119102"	2018-01-31	2099-12-31	
42535213	Occupational exposure to environmental tobacco smoke	Observation	SNOMED	Event	S	"16090771000119104"	2018-01-31	2099-12-31	
42536905	Occupational exposure to vibration	Observation	SNOMED	Event	S	"735932007"	2018-01-31	2099-12-31	
42539211	Occupational exposure to dust	Observation	SNOMED	Event	S	"16090691000119109"	2018-01-31	2099-12-31	
42539703	Occupational exposure to ergonomic risk	Observation	SNOMED	Event	S	"737348000"	2018-01-31	2099-12-31	
44790569	Accident due to water exposure	Observation	SNOMED	Event	S	"240911000000102"	2006-10-02	2099-12-31	
4072805	Accidental exposure to bipyridium compound herbicide	Observation	SNOMED	Event	S	"242279004"	2002-01-31	2099-12-31	
434543	Overexposure to visual and ultraviolet light sources	Observation	SNOMED	Event	S	"218196008"	2002-01-31	2099-12-31	

share/db/concepts_candidates_2_exposure.csv  view on Meta::CPAN

438321	Accident due to exposure to weather conditions	Observation	SNOMED	Event	S	"242575009"	2002-01-31	2099-12-31	
438327	Overdose of radiation in therapy	Observation	SNOMED	Event	S	"216958003"	2002-01-31	2099-12-31	
438630	Exposure to radiation	Observation	SNOMED	Event	S	"218190002"	2002-01-31	2099-12-31	
439220	Overexposure to radiofrequency radiation	Observation	SNOMED	Event	S	"218191003"	2002-01-31	2099-12-31	
440608	Overexposure to infrared heater or lamp	Observation	SNOMED	Event	S	"218195007"	2002-01-31	2099-12-31	
442042	Exposure to radiation from diagnostic isotopes	Observation	SNOMED	Event	S	"242811002"	2002-01-31	2099-12-31	
443065	Accidental exposure to metals or their compounds	Observation	SNOMED	Event	S	"242373001"	2002-01-31	2099-12-31	
444046	Cold exposure	Observation	SNOMED	Event	S	"40537000"	2002-01-31	2099-12-31	
444128	Exposure to ionizing radiation	Observation	SNOMED	Event	S	"122866006"	2002-01-31	2099-12-31	
604443	Occupational exposure to SARS-CoV-2	Observation	SNOMED	Event	S	"897036007"	2021-01-31	2099-12-31	
756064	Suspected exposure (but ruled out after evaluation) to Severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2)	Observation	OMOP Extension	Event	S	OMOP4873946	2020-03-18	2099-12-31	
756083	Suspected exposure to Severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2)	Observation	OMOP Extension	Event	S	OMOP4873962	2020-03-18	2099-12-31	
4008044	Exposure to polluted water, occupational	Observation	SNOMED	Event	S	"102428006"	2002-01-31	2099-12-31	
4008045	Exposure to polluted water, non-occupational	Observation	SNOMED	Event	S	"102429003"	2002-01-31	2099-12-31	
4008150	Exposure to toxic waste, occupational	Observation	SNOMED	Event	S	"102439009"	2002-01-31	2099-12-31	
4008152	Exposure to toxic dust, non-occupational	Observation	SNOMED	Event	S	"102446000"	2002-01-31	2099-12-31	
4009857	Exposure to environmental pollution, non-occupational	Observation	SNOMED	Event	S	"102423002"	2002-01-31	2099-12-31	
4009858	Exposure to polluted air, occupational	Observation	SNOMED	Event	S	"102425009"	2002-01-31	2099-12-31	
4009863	Exposure to toxic waste, non-occupational	Observation	SNOMED	Event	S	"102440006"	2002-01-31	2099-12-31	
4010326	Exposure to environmental pollution	Observation	SNOMED	Event	S	"102421000"	2002-01-31	2099-12-31	
4010327	Exposure to polluted air, non-occupational	Observation	SNOMED	Event	S	"102426005"	2002-01-31	2099-12-31	
4010328	Exposure to polluted soil, occupational	Observation	SNOMED	Event	S	"102433005"	2002-01-31	2099-12-31	

t/01-api-bff-pxf.t  view on Meta::CPAN

    my $got = $convert->bff2pxf;
    $got->{$_} = undef for qw(id metaData);

    is_deeply( $got, $pxf, 'bff2pxf module conversion matches fixture' );
}

{
    my $gender = load_json_file('t/openehr2bff/in/gecco_personendaten.json');
    my $ips    = load_json_file('t/openehr2bff/in/ips_canonical.json');
    my $lab    = load_json_file('t/openehr2bff/in/laboratory_report.json');
    my $corona = load_json_file('t/openehr2bff/in/compo_corona.json');

    my $convert = build_convert(
        method      => 'openehr2pxf',
        data        => {
            patient      => { id => 'openehr-patient-2' },
            compositions => [ $gender, $ips, $lab, $corona ],
        },
        in_textfile => 0,
    );

    my $tmp_file = temp_output_file( suffix => '.json' );
    write_json_file( $tmp_file, $convert->openehr2pxf );
    ok(
        structured_files_match( 't/openehr2pxf/out/pxf.json', $tmp_file ),
        'openehr2pxf module conversion matches fixture'
    );

t/19-cli-regression.t  view on Meta::CPAN


    my $tmp_file  = temp_output_file( suffix => '.json', dir => $tmpdir );
    my $input_file = temp_output_file( suffix => '.json', dir => $tmpdir );

    my $payload = {
        patient      => { id => 'openehr-patient-2' },
        compositions => [
            load_json_file('t/openehr2bff/in/gecco_personendaten.json'),
            load_json_file('t/openehr2bff/in/ips_canonical.json'),
            load_json_file('t/openehr2bff/in/laboratory_report.json'),
            load_json_file('t/openehr2bff/in/compo_corona.json'),
        ],
    };
    write_json_file( $input_file, $payload );

    my @cmd = ( $^X, $cli, '-iopenehr', $input_file, '-opxf', $tmp_file, '-O', '--test' );
    my ( $exit, $output ) = run_cli(@cmd);

    is( $exit, 0, 'CLI openehr2pxf exits successfully' )
      or diag $output;
    ok(

t/21-openehr-behavior.t  view on Meta::CPAN

  build_convert
  load_json_file
  temp_output_file
  write_json_file
  structured_files_match
);

my $gender = load_json_file('t/openehr2bff/in/gecco_personendaten.json');
my $ips    = load_json_file('t/openehr2bff/in/ips_canonical.json');
my $lab    = load_json_file('t/openehr2bff/in/laboratory_report.json');
my $corona = load_json_file('t/openehr2bff/in/compo_corona.json');

sub with_subject_id {
    my ( $composition, $id ) = @_;
    my %copy = %{$composition};
    $copy{subject} = {
        _type        => 'PARTY_SELF',
        external_ref => {
            id        => { _type => 'GENERIC_ID', value => $id, scheme => 'PMI' },
            namespace => 'PMI',
            type      => 'PERSON',

t/21-openehr-behavior.t  view on Meta::CPAN

    is( $individual->{id}, 'openehr-patient-1', 'uses patient id from the envelope' );
    is( $individual->{sex}{id}, 'NCIT:C20197', 'maps administrative gender to Beacon sex term' );
    is( scalar @{ $individual->{info}{openehr}{compositions} }, 2, 'preserves all source compositions under info.openehr' );
};

subtest 'openehr2bff emits first-class arrays from multiple canonical compositions' => sub {
    my $convert = build_convert(
        method      => 'openehr2bff',
        data        => {
            patient      => { id => 'openehr-patient-2' },
            compositions => [ $gender, $ips, $lab, $corona ],
        },
        in_textfile => 0,
    );

    my $individual = $convert->openehr2bff;

    is( scalar @{ $individual->{diseases} }, 3, 'maps problem diagnosis entries to diseases' );
    is( scalar @{ $individual->{measures} }, 2, 'maps multiple observations with values to measures' );
    is( scalar @{ $individual->{phenotypicFeatures} }, 7, 'maps symptom screening observations to phenotypicFeatures' );
    is( scalar @{ $individual->{interventionsOrProcedures} }, 1, 'maps procedure actions to interventionsOrProcedures' );

t/omop2bff/out/individuals.json  view on Meta::CPAN

               "iso8601duration" : "P51Y"
            }
         },
         "bodySite" : {
            "id" : "NCIT:C126101",
            "label" : "Not Available"
         },
         "dateOfProcedure" : "2012-06-06",
         "procedureCode" : {
            "id" : "SNOMED:415070008",
            "label" : "Percutaneous coronary intervention"
         }
      },
      {
         "_info" : {
            "PROCEDURE_OCCURRENCE" : {
               "OMOP_columns" : {
                  "modifier_concept_id" : 0,
                  "modifier_source_value" : null,
                  "person_id" : 662,
                  "procedure_concept_id" : 4336464,

t/omop2bff/out/individuals.json  view on Meta::CPAN

               "iso8601duration" : "P56Y"
            }
         },
         "bodySite" : {
            "id" : "NCIT:C126101",
            "label" : "Not Available"
         },
         "dateOfProcedure" : "2005-08-28",
         "procedureCode" : {
            "id" : "SNOMED:415070008",
            "label" : "Percutaneous coronary intervention"
         }
      },
      {
         "_info" : {
            "PROCEDURE_OCCURRENCE" : {
               "OMOP_columns" : {
                  "modifier_concept_id" : 0,
                  "modifier_source_value" : null,
                  "person_id" : 709,
                  "procedure_concept_id" : 4151422,

t/omop2pxf/out/pxf.json  view on Meta::CPAN

   "id" : null,
   "medicalActions" : [
      {
         "procedure" : {
            "bodySite" : {
               "id" : "NCIT:C126101",
               "label" : "Not Available"
            },
            "code" : {
               "id" : "SNOMED:415070008",
               "label" : "Percutaneous coronary intervention"
            },
            "performed" : {
               "age" : {
                  "iso8601duration" : "P51Y"
               }
            }
         }
      },
      {
         "procedure" : {

t/omop2pxf/out/pxf.json  view on Meta::CPAN

         }
      },
      {
         "procedure" : {
            "bodySite" : {
               "id" : "NCIT:C126101",
               "label" : "Not Available"
            },
            "code" : {
               "id" : "SNOMED:415070008",
               "label" : "Percutaneous coronary intervention"
            },
            "performed" : {
               "age" : {
                  "iso8601duration" : "P56Y"
               }
            }
         }
      },
      {
         "procedure" : {

t/openehr2bff/in/README.md  view on Meta::CPAN


- repository: <https://github.com/ehrbase/openEHR_SDK>
- source directory:
  `test-data/src/main/resources/composition/canonical_json/`

Copied files:

- `ips_canonical.json`
- `laboratory_report.json`
- `gecco_personendaten.json`
- `compo_corona.json`

Derived local fixture:

- `gecco_personendaten_patient.json`
  Derived from `gecco_personendaten.json` by adding
  `subject.external_ref.id.value = openehr-patient-2`
  for patient-identified openEHR input tests.

## Note



( run in 2.894 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )