The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Medical::OPCS4 - OPCS4 Wrapper module

VERSION

Version 0.03

SYNOPSIS

OPCS-4 is an abbreviation of the Office of Population, Censuses and Surveys Classification of Surgical Operations and Procedures (4th revision)[1]. It translates operations, procedures and interventions carried out on a patient during an episode of health care in the NHS into alphanumeric code usually done by trained health care professionals working in an area called clinical coding. As such it is comparable with ICD-10, which is used for coding diagnoses in the same setting. There are some areas of overlapping between ICD-10 and OPCS-4. for example both feature codes for the delivery of children. In the U.K. it is recommended clinical coders use the OPCS-4. codes for these procedures.

This modules provides a wrapper around the NHS CFH OPCS-4 distribution which can be found here http://www.connectingforhealth.nhs.uk/systemsandservices/data/clinicalcoding/codingstandards/opcs4

    my $O = Medical::OPCS4->new();
    $O->parse('./t/testdata.txt');
    my $Term = $O->get_term('O16');
    my $Parent = $O->get_parent_term( 'O16.1' );
    my $ra_ch = $O->get_child_terms( 'O16' );

The GitHub page for this module is here https://github.com/spiros/Medical-OPCS4

METHODS

new

Creates a new instance of the module.

   my $O = Medical::OPCS4->new();

parse

Parses the flat file containing the OPCS4 codes.

   $O->parse( "/path/to/tsv/file/with/codes.txt" );

This method returns true on success and undef on failure.

get_term

   my $Term = $O->get_term( 'A809' );

This method returns an Medical::OPCS4::Term object and undef on error.

get_all_terms

   my $ra_all_terms = $O->get_all_terms;

Returns a reference to an array of Medical::OPCS4::Term objects with all terms in the current file distribution.

This method returns undef on error.

get_all_terms_hashref

   my $rh_all_terms = $O->get_all_terms_hashref;
   

Returns a reference to a hash with all terms in the current file distribution. The keys of the hash are the OPCS4 terms and the values are the textual descriptions.

This method returns undef on error.

get_parent_term

   my $ParentTerm = $O->get_parent_term( 'A809' );
   

or

   my $ParentTerm = $O->get_parent_term( $Term );

Returns the immediate parent term of a given term as an Medical::OPCS4::Term object. This method accepts both a scalar with the term name and a Medical::OPCS4::Term object as input

This method returns undef on error.

get_parent_term_string

   my $ParentTerm = $O->get_parent_term_string( 'A809' );
   

or

   my $ParentTerm = $O->get_parent_term_string( $Term );

Returns the immediate parent term of a given term as a scalar. This method accepts both a scalar with the term name and a Medical::OPCS4::Term object as input.

This method returns undef on error.

get_parent_terms

   my $ra_parent_terms = $O->get_parent_terms( 'A809' );
   

or

   my $ra_parent_terms = $O->get_parent_terms( $Term );

Returns a reference to an array of Medical::OPCS4::Term objects of all parent terms of a given term. This method accepts both a scalar with the term name and a Medical::OPCS4::Term object as input.

This method returns undef on error.

get_parent_terms_string

   my $ra_parent_terms = $O->get_parent_terms_string( 'A809' );
   

or

   my $ra_parent_terms = $O->get_parent_terms_string( $Term );

Returns a reference to an array of scalars of all parent terms of a given term. This method accepts both a scalar with the term name and a Medical::OPCS4::Term object as input.

This method returns undef on error.

get_child_terms

   my $ra_child_terms = $O->get_child_terms( 'A809' );
   

or

   my $ra_child_terms = $O->get_child_terms( $Term );

Returns a reference to an array of Medical::OPCS4::Term objects of all child terms of a given term. This method accepts both a scalar with the term name and a Medical::OPCS4::Term object as input.

This method returns undef on error.

get_child_terms_string

   my $ra_child_terms = $O->get_child_terms_string( 'A809' );
   

or

   my $ra_child_terms = $O->get_child_terms_string( $Term );

Returns a reference to an array of scalars of all child terms of a given term. This method accepts both a scalar with the term name and a Medical::OPCS4::Term object as input.

This method returns undef on error.

_format_output

Internal method used to format the output from different methods. Do not use this method directly.