Coder Social home page Coder Social logo

nhsdigital / rap_example_pipeline_python Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 117 KB

An example pipeline made in a RAP friendly way, using Python

License: MIT License

Python 100.00%
aggregation artificial hospital-episode-statistics pyspark python spark

rap_example_pipeline_python's Issues

Add type definitions to function definitions

          I recommend using type definitions in function definitions. It means the code is more self-documenting and can really aid development
def configure_logging(log_folder: Path, config: Dict[str, Any]) -> None:

This changed would be something that should be propegated to the rest of the repository, if it is a standard you want to adopt.

Originally posted by @josephwilson8-nhs in #6 (comment)

Implement pathlib

use Path objects from the pathlib library for all paths so they will be correct on different OSs

Add logging

Add logging to the new sections we've added

Requires Java to be installed?

Hi, I am getting the following error:

Java not found and JAVA_HOME environment variable is not set.
Install Java and set JAVA_HOME to point to the Java installation directory.

Do I need Java to be installed? I have done:

python -m pip install -r requirements.txt

Add tests

Add tests where possible:

  • unit tests to cover the individual functions
  • backtests as an end-to-end test

If making the test is too difficult, just add an "empty" placeholder - to show that we at least are aware it needs testing.

Use Pytest as the framework - see the examples.

Update imports to import whole module as alias

Update imports to import whole module as alias and update function references throughout.

A la Joe's suggestion:

          This is more of a personal style choice, but I like to import the file under an alias, rather than the function
from src.utils import file_paths as paths, logging_config as logs, spark
from src.data_ingestion import get_data as data, reading_data as read
from src.processing import aggregate_counts as agg
from src.data_exports import write_csv as write

You will need to change function calls e.g. get_config will become paths.get_config, but it will be more clear where the function is from

Originally posted by @josephwilson8-nhs in #6 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.