pyamr.core.table package

Submodules

pyamr.core.table.acronym module

Classes:

AcronymBuilder()

Functions:

acronym(name[, length, prefix])

This method created the acronym for a given string

class pyamr.core.table.acronym.AcronymBuilder[source]

Bases: object

Methods:

fit(values, acronyms)

This method creates a dictionary with the acronyms

has_acronym()

has_value()

inverse_transform(acronyms)

This method returns the values for given acronyms.

transform(values)

This method returns the acronyms for given values

update()

fit(values, acronyms)[source]

This method creates a dictionary with the acronyms

TODO: Instead of just checking whether there are acronym conflicts or not ensure that always unique acronyms are created. Note that the implemented approach to create acronyms does not ensure they are always unique.

Parameters:
  • values (array-like (contains strings)) – The array with the possible values

  • acronyms (array-like (contains strings)) – The array with the corresponding acronyms.

has_acronym()[source]
has_value()[source]
inverse_transform(acronyms)[source]

This method returns the values for given acronyms.

Parameters:

values (array-like)

Return type:

array with acronyms

transform(values)[source]

This method returns the acronyms for given values

Parameters:

values (array-like)

Return type:

array with acronyms

update()[source]
pyamr.core.table.acronym.acronym(name, length=3, prefix='A_')[source]

This method created the acronym for a given string

Parameters:
  • name (string-like) – The string to construct the acronym

  • length (int-like) – The number of letters used for the first word of the acronym

  • prefix (string-like) – The prefix to add to the acronym for identification purposes

Return type:

string

pyamr.core.table.antibiotic module

Classes:

AntibioticTable([to_lowercase, ...])

AntibioticsTable()

class pyamr.core.table.antibiotic.AntibioticTable(to_lowercase=None, to_uppercase=None, delete_spaces=None, delete_parenthesis=None)[source]

Bases: object

Methods:

fit(dataframe)

fit(dataframe)[source]
class pyamr.core.table.antibiotic.AntibioticsTable[source]

Bases: object

Attributes:

codeF

codeO

l

nameF

nameO

usecols

Methods:

compute(input_path, output_path)

This method computes/updates a table from data.

create_table(data_path)

This method creates the table from input data

fit(values, acronym)

merge_table(df1, df2, on, conflicts)

This function merges the two basic columns name and code.

show_information(df, dfc, pathname)

This method shows important information.

update()

codeF = 'antibioticCode'
codeO = 'antibioticCodeOrig'
compute(input_path, output_path)[source]

This method computes/updates a table from data.

Parameters:
  • input_path (the path with the data.)

  • output_path (the path to store the table.)

create_table(data_path)[source]

This method creates the table from input data

fit(values, acronym)[source]
l = 8
merge_table(df1, df2, on, conflicts)[source]

This function merges the two basic columns name and code.

Parameters:
  • df1 (the old dataframe with name and code.)

  • df2 (the new dataframe with name and code.)

Returns:

  • df_m (merged dataframe.)

  • df_c (conflicts dataframe.)

nameF = 'antibioticName'
nameO = 'antibioticNameOrig'
show_information(df, dfc, pathname)[source]

This method shows important information.

update()[source]
usecols = ['antibioticNameOrig', 'antibioticCodeOrig']

pyamr.core.table.organism module

Classes:

OrganismsTable()

class pyamr.core.table.organism.OrganismsTable[source]

Bases: object

Attributes:

codeF

codeO

codeS

len_sp

len_tp

nameF

nameO

nameS

usecols

Methods:

compute(input_path, output_path)

This method computes/updates a table from data.

create_table(data_path)

This method creates the table from input data

merge_table(df1, df2, on, conflicts)

This function merges the two basic columns name and code.

show_information(df, dfc, pathname)

This method shows important information.

codeF = 'organismCode'
codeO = 'organismCodeOrig'
codeS = 'specieCode'
compute(input_path, output_path)[source]

This method computes/updates a table from data.

Parameters:
  • input_path (the path with the data.)

  • output_path (the path to store the table.)

create_table(data_path)[source]

This method creates the table from input data

len_sp = 8
len_tp = 8
merge_table(df1, df2, on, conflicts)[source]

This function merges the two basic columns name and code.

Parameters:
  • df1 (the old dataframe with name and code.)

  • df2 (the new dataframe with name and code.)

Returns:

  • df_m (merged dataframe.)

  • df_c (conflicts dataframe.)

nameF = 'organismName'
nameO = 'organismNameOrig'
nameS = 'specieName'
show_information(df, dfc, pathname)[source]

This method shows important information.

usecols = ['organismNameOrig', 'organismCodeOrig']

pyamr.core.table.utils module

Functions:

delete_numbers(df[, cols])

delete_parenthesis(df[, cols])

delete_spaces(df[, cols])

delete_types(df[, cols])

ending_specie(df[, cols])

lettercase(df[, cols, funct])

specie_abbreviation(df[, cols])

transform_rename(filepath, df)

This function rename codes (i.e.

pyamr.core.table.utils.delete_numbers(df, cols='all')[source]
pyamr.core.table.utils.delete_parenthesis(df, cols='all')[source]
pyamr.core.table.utils.delete_spaces(df, cols='all')[source]
pyamr.core.table.utils.delete_types(df, cols='all')[source]
pyamr.core.table.utils.ending_specie(df, cols='all')[source]
pyamr.core.table.utils.lettercase(df, cols='all', funct=<function _lower>)[source]
pyamr.core.table.utils.specie_abbreviation(df, cols='all')[source]
pyamr.core.table.utils.transform_rename(filepath, df)[source]

This function rename codes (i.e. PAER1,PAER2 to PEAR)

Module contents