Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy Update #6

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fd717e5
Added proxy parameter to all api calls.
benjamin-mouncer Jan 23, 2023
1075787
Added proxy variable to api_calls.py
xn4224nx Jan 24, 2023
4cef47e
Corrected wording of variable.
xn4224nx Jan 24, 2023
7f936d4
Added proxies variable to functions retrieving the metadata.
xn4224nx Jan 24, 2023
e84fb86
started changing function definitions.
xn4224nx Jan 25, 2023
c6dd781
Added proxy variable to all functions in metadata.py and refactored s…
xn4224nx Jan 25, 2023
7e34402
Added proxy variable to functions.
xn4224nx Jan 25, 2023
d2401bf
Added HTTP error exception to get_csv.
xn4224nx Jan 25, 2023
4cfbd2a
Removed extraneous lines and cleaned up text.
xn4224nx Jan 25, 2023
16c87d6
Added proxy variable to deprivation_decile.
xn4224nx Jan 25, 2023
3abb3eb
Changed function used to process JSONs to pd dataframes.
xn4224nx Jan 27, 2023
1f6823a
Updated test for get_all_areas as the area '1' has been removed. Chan…
xn4224nx Jan 27, 2023
202bfb2
Updated test for 'get_all_data_for_indicators()' as the number of col…
xn4224nx Jan 27, 2023
80084f0
Updated test for 'get_data_by_indicator_ids()' as the number of colum…
xn4224nx Jan 27, 2023
fed8f7a
Refactored 'get_metadata_for_all_indicators()' so all the columns are…
xn4224nx Jan 28, 2023
e1fa5cd
Updated 'get_all_areas_for_all_indicators()' to merge correctly.
xn4224nx Jan 29, 2023
44ab2a9
Updated tests for 'get_data_for_indicator_at_all_available_geographie…
xn4224nx Jan 29, 2023
76cac54
Updated tests to match changes in API.
xn4224nx Jan 29, 2023
7d7ab2e
Updated test for 'get_all_data_for_profile()' to match changes in API.
xn4224nx Jan 29, 2023
cad84fb
Corrected mistake in 'get_metadata()'.
xn4224nx Jan 29, 2023
94ef5a6
Rewrote 'deprivation_decile()' to fix errors.
xn4224nx Jan 30, 2023
c0378b4
Removed uneeded dict 'extra_areas'.
xn4224nx Jan 30, 2023
0d3f3e6
Removed obsolete function 'defined_qcut()'.
xn4224nx Jan 30, 2023
7f5f505
Removed uneeded import and cleaned description.
xn4224nx Jan 30, 2023
468b6ac
Updated unit test for 'deprivation_decile()'.
xn4224nx Jan 31, 2023
8d0d46b
Changed doc strings to render correctly in Sphinx.
xn4224nx Jan 31, 2023
8cbc9ba
Added more to the .gitignore file.
xn4224nx Jan 31, 2023
4c4e8be
Removed *.pyc files.
xn4224nx Jan 31, 2023
cd1c6d1
Updated the documentation files.
xn4224nx Feb 1, 2023
7b475a4
Made sure the eadme.md and index.rst were consistent.
xn4224nx Feb 1, 2023
5ab7489
Fixed incorrect documentation.
xn4224nx Feb 1, 2023
7d522ee
Added low mem option to cope with mixed types.
xn4224nx Feb 1, 2023
e775a4a
Refactored code to remove function that was depreciated.
xn4224nx Feb 1, 2023
81c2dbf
Added unit test for the new get_csv() function.
xn4224nx Feb 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 160 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,163 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

.idea
*.iml
out
gen
# Google Drive backup files
*.bak

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
Binary file modified build/doctrees/environment.pickle
Binary file not shown.
Binary file modified build/doctrees/index.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 8884911a5ed44584821fc3ecc143acb8
config: 8d99942262f8c4e21935453794cf8ecc
tags: 645f666f9bcd5a90fca523b33c5a78b7
61 changes: 33 additions & 28 deletions build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Introduction


This is a python package to interact with Public Health England's
[Fingertips](https://fingertips.phe.org.uk/) data tool. Fingertips is a
`Fingertips <https://fingertips.phe.org.uk/>`_ data tool. Fingertips is a
major repository of population and public health indicators for England.
The site presents the information in many ways to improve accessibility
for a wide range of audiences ranging from public health professionals
Expand All @@ -30,15 +30,15 @@ Installation

This packaged should be installed using pip:

```
pip install fingertips_py
```
.. code-block:: console

pip install fingertips_py

Or it can be compiled from source (still requires pip):

```
pip install git+https://github.com/PublicHealthEngland/PHDS_fingertips_py.git
```
.. code-block:: console

pip install git+https://github.com/PublicHealthEngland/PHDS_fingertips_py.git

Usage
*****
Expand All @@ -47,20 +47,18 @@ fingertips_py should be imported and used in line with standard python
conventions. It is suggested that if the whole package is to be imported
then the following convention is used:

```
import fingertips_py as ftp
```
>>> import fingertips_py as ftp

The package returns data in a variety of types dependent on the
function.

For more information on any function, you can use:

```
help(*fingertips_py function name*)
```
>>> help(*fingertips_py function name*)


Or you can view the documents `here <https://fingertips-py.readthedocs.io/en/latest/>`_.

Or you can view the documents [here](https://fingertips-py.readthedocs.io/en/latest/).

Example
*******
Expand All @@ -69,32 +67,39 @@ This is an example of a workflow for retrieving data for the indicator
on *Healthy Life Expectancy at Birth* from the *Public Health Outcomes
Framework* profile.

```
import fingertips_py as ftp
.. code-block:: python

import fingertips_py as ftp

# Extract the metadata for a particular profile
phof = ftp.get_profile_by_name('public health outcomes framework')
phof_meta = ftp.get_metadata_for_profile_as_dataframe(phof['Id'])

phof = ftp.get_profile_by_name('public health outcomes framework')
phof_meta = ftp.get_metadata_for_profile_as_dataframe(phof['Id'])
indicator_meta = phof_indicators[phof_meta['Indicator'].str.contains('Healthy')]
print(indicator_meta)
# Extract metadata for indicators containing the string "Healthy"
indicator_meta = phof_meta[phof_meta['Indicator'].str.contains('Healthy')]

print(indicator_meta)

.. code-block:: console
:linenos:

Indicator ID Indicator ...
90362 0.1i - Healthy life expectancy at birth ...
92543 2.05ii - Proportion of children aged 2-2½yrs r ...

Indicator ID Indicator ...
0 90362 0.1i - Healthy life expectancy at birth ...
55 92543 2.05ii - Proportion of children aged 2-2½yrs r... ...
```

We can see that the *Healthy life expectancy at birth* indicator has an
id of 90362. The data for this indicator at all geographical breakdowns
can be retrieved using `get_data_for_indicator_at_all_available_geographies()`

```
healthy_life_data = ftp.get_data_for_indicator_at_all_available_geographies(90362)
```

>>> healthy_life_data = ftp.get_data_for_indicator_at_all_available_geographies(90362)


Licence
*******

This project is released under the [GPL-3](https://opensource.org/licenses/GPL-3.0)
This project is released under the `GPL-3 <https://opensource.org/licenses/GPL-3.0>`_
licence.

.. automodule:: fingertips_py.metadata
Expand Down
19 changes: 7 additions & 12 deletions build/html/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -222,7 +222,7 @@ table.modindextable td {
/* -- general body styles --------------------------------------------------- */

div.body {
min-width: 450px;
min-width: 360px;
max-width: 800px;
}

Expand All @@ -236,7 +236,6 @@ div.body p, div.body dd, div.body li, div.body blockquote {
a.headerlink {
visibility: hidden;
}

a.brackets:before,
span.brackets > a:before{
content: "[";
Expand All @@ -247,6 +246,7 @@ span.brackets > a:after {
content: "]";
}


h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
Expand Down Expand Up @@ -334,13 +334,11 @@ aside.sidebar {
p.sidebar-title {
font-weight: bold;
}

div.admonition, div.topic, blockquote {
clear: left;
}

/* -- topics ---------------------------------------------------------------- */

div.topic {
border: 1px solid #ccc;
padding: 7px;
Expand Down Expand Up @@ -428,10 +426,6 @@ table.docutils td, table.docutils th {
border-bottom: 1px solid #aaa;
}

table.footnote td, table.footnote th {
border: 0 !important;
}

th {
text-align: left;
padding-right: 5px;
Expand Down Expand Up @@ -614,7 +608,6 @@ ol.simple p,
ul.simple p {
margin-bottom: 0;
}

dl.footnote > dt,
dl.citation > dt {
float: left;
Expand Down Expand Up @@ -643,11 +636,11 @@ dl.field-list > dt {
padding-left: 0.5em;
padding-right: 5px;
}

dl.field-list > dt:after {
content: ":";
}


dl.field-list > dd {
padding-left: 0.5em;
margin-top: 0em;
Expand Down Expand Up @@ -731,8 +724,9 @@ dl.glossary dt {

.classifier:before {
font-style: normal;
margin: 0.5em;
margin: 0 0.5em;
content: ":";
display: inline-block;
}

abbr, acronym {
Expand All @@ -756,6 +750,7 @@ span.pre {
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
white-space: nowrap;
}

div[class*="highlight-"] {
Expand Down
2 changes: 1 addition & 1 deletion build/html/_static/css/badge_only.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading