WebService-UMLSKS-Similarity

 view release on metacpan or  search on metacpan

lib/WebService/UMLSKS/GetCUIs.pm  view on Meta::CPAN


=head1 NAME

WebService::UMLSKS::GetCUIs - Get all the preferred terms and CUIs of the input term.

=head1 SYNOPSIS

=head2 Basic Usage


    use WebService::UMLSKS::GetCUIs;
    use WebService::UMLSKS::ConnectUMLS;
    
    my $getCUIs_obj =  new GetCUIs; 
  
    my $CUIs_ref = $getCUIs_obj->get_CUI_info($service,$term,\@sources,$verbose); 
   

=head1 DESCRIPTION

This module has package GetCUIs which has subroutines 'new',get_CUI_info, format _object, format_scalar, format_homogenous_hash, format_homogenous_array and extract_object_class.
This module returns the hash of all preferred terms and CUIs for the input Term.

=head1 SUBROUTINES

The subroutines are as follows:

=cut

###############################################################################
##########  CODE STARTS HERE  #################################################

#use lib "/home/mugdha/UMLS-HSO/UMLS-HSO/WebService-UMLSKS-Similarity/lib";

use strict;
use SOAP::Lite;
use warnings;
use WebService::UMLSKS::ConnectUMLS;
no warnings qw/redefine/;
use WebService::UMLSKS::Similarity;


package WebService::UMLSKS::GetCUIs;


use Log::Message::Simple qw[msg error debug];

my $got_term = 0;
my $term = "";
my $cui = "";
my %TermCUI = ();






# Creating Connect object to call sub get_pt while forming a query.

my $c = WebService::UMLSKS::ConnectUMLS->new;
my $verbose;

=head2 new

This sub creates a new object of GetCUIs.

=cut

sub new {
	my $class = shift;
	my $self  = {};
	bless( $self, $class );
	return $self;
}

=head2 get_CUI_info

This sub queries 'findCUIByExact' by calling run_query sub.

=cut

sub get_CUI_info
{
	my $self = shift;
	my $service = shift;
	my $query_term = shift;
	my $s_ref = shift;
	my $ver = shift;
	
	$verbose = $ver;
	%TermCUI = ();	
	
	my @sources = @$s_ref;
	
	msg("\n In getCUIs sources are : @sources", $verbose);
	# query
	$service->readable(1);
	my $ws_result_ref = run_query($service,
		  
	'findCUIByExact',
		  {
		   casTicket => $c->get_pt(),
		   # use SOAP::Data->type in order to prevent
		   # UTF-8 strings from being encoded into base64
		   # http://cookbook.soaplite.com/#internationalization%20and%20encoding
		   searchString => SOAP::Data->type(string => $query_term),

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.414 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )