Skip to main content

This is a utility package designed to enable data scientitists and analysts to easily access GDP data within a python environment

Project description

Gdp Tools Package

Code Checks Code Style

This is a utility package designed to enable data scientists and analysts to easily access GDP data within a python environment

Requirements:

  • The data professional should be able to clone the package at the start of new project and when in production
  • The package will contain a number of support functions serving the following objectives: -- Accessing data on GDP Base/CIM/Warehouse -- Accessing data in temp storage (LAB) -- Querying that data in SQL -- utlising that data as a Python/PySpark DataFrame -- Storing processed data to the temp storage space (LAB)
  • any data access configs should available to be used

Credentials

Contact a member of the Laing O'Rourke Data Science team to set up up your credentials.

SERVER, DATABASE, USERNAME and PASSWORD need to be entered in as arguments when initailising the tool, for example '''gdp_tools = GlobalDataPlatformTools(SERVER, DATABASE, USERNAME,PWD)'''

The designation of SERVER and DATABASE will determining if you are accessing PROD or PREPROD data. It is strongly advised to PREPROD to avoid interfering with PROD systems.

Functionality

Should be used in Azure ML Studio. NO access to GDP locally. Generally functionality covers:

v0

  • check/install drivers
  • search GDP by table name
  • query GDP with SQL

v1

  • load/test a LLM
  • access to CIM and Warehouse data
  • store data
  • access data from share point

GDP Tools

This module contains tools for accessing and storing data in the GDP.

The module will likely break if you use some of these functions successively. When changing between functionality, re-initialise the module with '''gdp_tools = GlobalDataPlatformTools(SERVER, DATABASE, USERNAME,PWD)'''

validate_odbc_drivers - check if the correct ODBC connectors are installed, install them as necessary automatically [check_odbc_driver, install_odbc_driver]

setup_odbc_connection - set up the ODBC with your credentials. Happens when class is initalised

query_gdp_to_pd - enter a SQL query as a string, return the data as a pandas dataframe

search_tables - will return a list of all table in the GDP. give it the argument 'source_system' = '[COINS]' to narrow your search for any table with the term 'COINS' in it (for example). Will also return the corresponding schema name and table type.

list_schema - list all available schema. This typically will include BASE, CIM and WAREHOUSE and variants on those.

save_df_to_lab_storage - provide a dataframe and location to save data into the LAB space in blob storage

load_df_from_lab - provide a location and load data from the LAB space in blob storage into a pandas dataframe

load_df_from_sharepoint - provide a URL and load data from the sharepoint into a pandas dataframe (NOT COMPLETED DO NOT USE)

LLM Tools

This module contains tools for access LOR LLM API end points

These methods require the following credentials, to be entered manually as arguments when initailised, for example '''llm = LORLargeLanguageModels(api_key,azure_endpoint)'''. Contact a member of the Data Science team to obtain these seperately.

tell_me_about_the_models_that_are_available - This function returns a pandas table with information about the models available. It covers cost, performance and accuracy. The numbers here were pulled from Chat GPT and checked, but may not be 100% accurate.

llm_architecture - the default architecture for using a chat gpt model. Takes guidence, prompt and the name of the model as strings.

test_llm - testing function, works for the pre-deffined list of models and a simple UAT prompt 'What is 2+2?'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lor_gdp_tools-1.2.7.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lor_gdp_tools-1.2.7-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file lor_gdp_tools-1.2.7.tar.gz.

File metadata

  • Download URL: lor_gdp_tools-1.2.7.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.5

File hashes

Hashes for lor_gdp_tools-1.2.7.tar.gz
Algorithm Hash digest
SHA256 750e1c92e35427c31d1a1d46869616a57f1ddc2529d5d46f46a119878e83b26c
MD5 132853980e8bd5d53ff1208e70d809c7
BLAKE2b-256 1dc5b4be624cb772b866189dbe16de58631c0bcc02aa550615541db2786d74aa

See more details on using hashes here.

File details

Details for the file lor_gdp_tools-1.2.7-py3-none-any.whl.

File metadata

  • Download URL: lor_gdp_tools-1.2.7-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.5

File hashes

Hashes for lor_gdp_tools-1.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d04758cce2c68b35cc7abb921bee086fafd76e41cb92b06f42c130a74372e7ef
MD5 5deefa2107b7b136f0f32cef90164e26
BLAKE2b-256 a1df108621ab9904b747f2cf2c034a61bc5fbac9041bbec0b133a3c86e995782

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page