Service package

Service.admin module

The admin service module: Admin table services.

Provides the application with the modelled CRUD functionality needed to manage the admin SQLite table.

Src.Service.admin.create_admin(username, password, email)[source]

Create an Admin record within the applications Admin SQLite database table.

Parameters:
  • username (str) – The admins username

  • password (str) – The admins password, this is expected to be encrypted prior to this function call

  • email (str) – The admins email address

Src.Service.admin.delete_admin()[source]

Deletes the applications admin user by clearing all records from the Admin SQLite database table

Src.Service.admin.get_admin_email()[source]

Retrieves the applications admin users email address, queried from the admin SQLite database table.

Returns:

The admins email address

Return type:

str

Src.Service.admin.get_admin_user()[source]

Retrieves the applications admin user, queried from the admin SQLite database table.

Returns:

The applications admin user

Return type:

Admin

Src.Service.admin.get_admin_user_by_username(username)[source]

Retrieves the applications admin user by username, queried from the admin SQLite database table.

Parameters:

username (str) – The applications admin username

Returns:

The applications admin user

Return type:

Admin

Service.amt_rebuild module

The amt rebuild service module: Amt table rebuild services.

Provides the application with the modelled functionality needed to support the import of a new AMT distribution into the Amt SQLite table.

Src.Service.amt_rebuild.delete_amt_table()[source]

Deletes all records found within the AMT SQLite database table.

Src.Service.amt_rebuild.rebuild_table_from_dict(dist)[source]

Populates the Amt SQLite database table from a dictionary representation of an AMT distribution.

Parameters:

dist (dict) – The new AMT distribution to import into the Amt SQLite database table

Service.create module

The create service module: Create record services.

Provides the application with the modelled create functionality needed to construct a new AMT or Snomed database table record.

Src.Service.create.create_amt(CTPP_SCTID, CTPP_PT, ARTG_ID, TPP_SCTID, TPUU_PT, TPP_PT, TPUU_SCTID, TPP_TP_SCTID, TPP_TP_PT, TPUU_TP_SCTID, TPUU_TP_PT, MPP_SCTID, MPP_PT, MPUU_SCTID, MPUU_PT, MP_SCTID, MP_PT)[source]

Creates a new Amt record within the Amt SQLite database table.

Parameters:
  • CTPP_SCTID (str) – The new Amt records CTPP_SCTID field value

  • CTPP_PT (str) – The new Amt records CTPP_PT field value

  • ARTG_ID (str) – The new Amt records ARTG_ID field value

  • TPP_SCTID (str) – The new Amt records TPP_SCTID field value

  • TPUU_PT (str) – The new Amt records TPUU_PT field value

  • TPP_PT (str) – The new Amt records TPP_PT field value

  • TPUU_SCTID (str) – The new Amt records TPUU_SCTID field value

  • TPP_TP_SCTID (str) – The new Amt records TPP_TP_SCTID field value

  • TPP_TP_PT (str) – The new Amt records TPP_TP_PT field value

  • TPUU_TP_SCTID (str) – The new Amt records TPUU_TP_SCTID field value

  • TPUU_TP_PT (str) – The new Amt records TPUU_TP_PT field value

  • MPP_SCTID (str) – The new Amt records MPP_SCTID field value

  • MPP_PT (str) – The new Amt records MPP_PT field value

  • MPUU_SCTID (str) – The new Amt records MPUU_SCTID field value

  • MPUU_PT (str) – The new Amt records MPUU_PT field value

  • MP_SCTID (str) – The new Amt records MP_SCTID field value

  • MP_PT (str) – The new Amt records MP_PT field value

Returns:

The newly created Amt record

Return type:

Amt

Src.Service.create.create_snomed(MP_PT, AU_Substance_SCTID, Int_Substance_SCTID)[source]

Creates a new Snomed record within the Snomed SQLite database table.

Parameters:
  • MP_PT (str) – The new Snomed records MP_PT field value

  • AU_Substance_SCTID (str) – The new Snomed records AU_Substance_SCTID field value

  • Int_Substance_SCTID (str) – The new Snomed records Int_Substance_SCTID field value

Returns:

The newly created Snomed record

Return type:

Snomed

Service.delete module

The delete service module: Delete record services.

Provides the application with the modelled delete functionality needed to delete an AMT or Snomed database table record.

Src.Service.delete.amt_delete_by_filter(filters)[source]

Deletes an Amt record from the SQLite database table by field filter/s.

Parameters:

filters (JSON) – The field filters to query by

Returns:

The deleted Amt record

Return type:

Amt

Src.Service.delete.amt_delete_by_id(id)[source]

Deletes an Amt record from the SQLite database table by ID.

Parameters:

id (Int) – The ID field to query by

Returns:

The deleted Amt record

Return type:

Amt

Src.Service.delete.snomed_delete_by_filter(filters)[source]

Deletes a Snomed record from the SQLite database table by field filter/s.

Parameters:

filters (JSON) – The field filters to query by

Returns:

The deleted Snomed record

Return type:

Snomed

Src.Service.delete.snomed_delete_by_id(id)[source]

Deletes a Snomed record from the SQLite database table by ID.

Parameters:

id (Int) – The ID field to query by

Returns:

The deleted Snomed record

Return type:

Snomed

Service.search module

The search service module: Search record services.

Provides the application with the modelled search functionality needed to query for an AMT or Snomed database table record.

Src.Service.search.amt_query_all()[source]

Queries all Amt records from the SQLite database table.

Returns:

The list containing all of the Amt records found within the table

Return type:

list

Src.Service.search.amt_search_by_fields_ret_all(search_filters)[source]

Queries the Amt SQLite database table by field filter/s

Parameters:

search_filters (JSON) – The field filter/s to query by

Returns:

The list containing all retrieved Amt records

Return type:

list

Src.Service.search.amt_search_by_fields_ret_one(search_filters)[source]

Queries the Amt SQLite database table by field filter/s

Parameters:

search_filters (JSON) – The field filter/s to query by

Returns:

The retrieved Amt record or None

Return type:

Amt/None

Src.Service.search.amt_search_by_id(id)[source]

Queries the Amt SQLite database table by id

Parameters:

id (Int) – The ID field value to query for

Returns:

The Amt record found

Return type:

Amt

Queries all Amt records from that have no relation mapped to the Snomed SQLite database table.

Returns:

The list consisting of all Amt records that have no mapping to the Snomed SQLite database table

Return type:

Amt

Src.Service.search.snomed_query_all()[source]

Queries all Snomed records from the SQLite database table.

Returns:

The list containing all of the Snomed records found within the table

Return type:

list

Src.Service.search.snomed_search_by_fields_ret_all(search_filters)[source]

Queries the Snomed SQLite database table by field filter/s

Parameters:

search_filters (JSON) – The field filter/s to query by

Returns:

The list containing all retrieved Snomed records

Return type:

list

Src.Service.search.snomed_search_by_fields_ret_one(search_filters)[source]

Queries the Snomed SQLite database table by field filter/s

Parameters:

search_filters (JSON) – The field filter/s to query by

Returns:

The retrieved Snomed record or None

Return type:

Snomed/None

Src.Service.search.snomed_search_by_id(id)[source]

Queries the Snomed SQLite database table by id (MP_PT)

Parameters:

id (str) – The MP_PT field value to query for

Returns:

The Snomed record found

Return type:

Snomed

Service.snomed_import module

The snomed import service module: Snomed import services.

Provides the application with the modelled Snomed import functionality needed to construct the Snomed SQLite table.

Src.Service.snomed_import.build_snomed_table_from_dict(snomed_dict)[source]

Populates the Snomed SQLite database table with values from the provided dict.

Parameters:

snomed_dict (dict) – The dictionary containing the Snomed table records

Src.Service.snomed_import.snomed_record_count()[source]

Queries the Snomed SQLite database table to retrieve a record count.

Returns:

The number of records found within the table

Return type:

int

Service.update module

The update service module: Update record services.

Provides the application with the modelled update functionality needed to update an existing AMT or Snomed database table record.

Src.Service.update.update_AU_Substance_SCTID_by_filters(filters, value)[source]

Queries a Snomed record by field filter/s and updates the AU_Substance_SCTID field of a Snomed Record

Parameters:
  • filters (JSON) – The field filters to query by

  • value (str) – The value to update the AU_Substance_SCTID field to

Returns:

The updates Snomed record

Return type:

Snomed

Src.Service.update.update_AU_Substance_SCTID_by_id(id, value)[source]

Queries a Snomed record by id (MP_PT) and updates the AU_Substance_SCTID field of a Snomed Record

Parameters:
  • id (str) – The MP_PT field to query by

  • value (str) – The value to update the AU_Substance_SCTID field to

Returns:

The updates Snomed record

Return type:

Snomed

Src.Service.update.update_Int_Substance_SCTID_by_filters(filters, value)[source]

Queries a Snomed record by field filter/s and updates the Int_Substance_SCTID field of a Snomed Record

Parameters:
  • filters (JSON) – The field filters to query by

  • value (str) – The value to update the Int_Substance_SCTID field to

Returns:

The updates Snomed record

Return type:

Snomed

Src.Service.update.update_Int_Substance_SCTID_by_id(id, value)[source]

Queries a Snomed record by id (MP_PT) and updates the Int_Substance_SCTID field of a Snomed Record

Parameters:
  • id (str) – The MP_PT field to query by

  • value (str) – The value to update the Int_Substance_SCTID field to

Returns:

The updates Snomed record

Return type:

Snomed

Service.version module

The version service module: Version table services.

Provides the application with the modelled CRUD functionality needed to manage the version SQLite table.

Src.Service.version.create_version(date, file, link)[source]

Creates a new Version record within the Version SQLite database table.

Parameters:
  • date (str) – The version date

  • file (str) – The file name

  • link (str) – The distribution download URL

Returns:

The newly created Version record

Return type:

Version

Src.Service.version.delete_versions()[source]

Deletes the applications current Version record found within the SQLite database table.

Returns:

The deleted version record

Return type:

Version

Src.Service.version.get_version()[source]

Queries the Version SQLite database table for the applications current AMT distribution version record.

Returns:

The Version record found within the SQLite database table

Return type:

Version