Giter Club home page Giter Club logo

policyengine's Introduction

PolicyEngine

This repository contains the core infrastructure for policyengine.org. Namely:

  • policyengine, a Python package which contains the server-side implementations, and
  • policyengine-client, a React library containing high-level components to build the client-side interface.

Development

NOTE: requires Python 3.7

First, ensure you have pnpm installed: https://pnpm.io/installation.

Then, install using make install. Then, to debug the client, run make debug-client, or to debug the server, run make debug-server.

If your changes involve the server, change useLocalServer = false; to useLocalServer = true; in policyengine-client/src/countries/country.jsx. Otherwise, change usePolicyEngineOrgServer = false; to usePolicyEngineOrgServer = true; in policyengine-client/src/countries/country.jsx.

If you don't have access to the UK Family Resources Survey, you can still run the UK population-wide calculator on an anonymised version. To do that, instead of running make debug-server, run UK_SYNTHETIC=1 make debug-server

policyengine's People

Contributors

fedderw avatar felix-cadiz avatar karth295 avatar maxghenis avatar mwufi avatar nikhilwoodruff avatar tolaouk avatar whiteheadol avatar yuantaoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

policyengine's Issues

Left-align parameter and variable titles

Since they're centered, they look like section breaks that would contain multiple parameters, and then the description seems more like the variable name. I think left-aligning would be more consistent with the theme and easier to read.

image

Similarly, the household variables could be left-aligned, but the descriptions don't seem necessary.

image

Donate page

Our current Donate link in the footer goes to https://opencollective.com/psl. This creates two problems:

  1. PSL-F won't know to direct donations to PolicyEngine
  2. OpenCollective charges a 10% fee which can be avoided by sending a check or wire transfer (though wire fees make OpenCollective cheaper for small gifts)

We should create a Donate page that describes the options for donors and suggests that they email us or PSL to direct the donation. PSL-F will likely do this soon, though I think we should mirror the information on PolicyEngine for a consistent user experience.

@jdebacker is it OK for us to put the PSL-F bank info on the site? Anything else you'd suggest here?

Align right side button text with tab name

  • Simulate on the population -> See UK impact
  • Skip to your household -> Describe your household
  • See your results -> See household impact
  • Change the policy reform -> Adjust the policy

Population waterfall chart looks like individual waterfall chart

e.g. from this:
image

This has colors flipped, doesn't use rdbl, and labels as if it's a household.

That chart gets created here:

waterfall_chart=population_waterfall_chart(
self.baseline, reformed, self.results_config
),

Which calls population_waterfall_chart here:

return charts.waterfall_chart(baseline, reformed, config)

And waterfall_chart has different logic for formatting the waterfall chart depending on:

is_pop = isinstance(baseline, Microsimulation)

The simplest explanation would be if isinstance(baseline, Microsimulation) no longer holds, but it still looks like that would be the case:

class PolicyEngineCountry:
name: str
system: Type[TaxBenefitSystem]
Microsimulation: Type[Microsimulation]

Generate parameter change text automatically instead of via `metadata.policyengine.summary`

Currently the text in Your Plan describing a parameter's change (light gray text) is specified from a template provided in openfisca. This requires extra work, creates redundant text, and produces inconsistencies:

image

Here's an example of the summary:
https://github.com/PolicyEngine/openfisca-uk/blob/192cea3c0c38c27cdb6ad574ae25b9f5943143fc/openfisca_uk/parameters/benefit/universal_credit/means_test/work_allowance.yaml#L19

I think this can instead be Change to @ for all. If we need to vary it by parameter type (I don't think we do), we can have logic based on metadata.policyengine.type.

Build warning about pip version

e.g. https://github.com/PolicyEngine/policyengine/runs/4012526696?check_suite_focus=true#step:5:452 says

WARNING: You are using pip version 21.3; however, version 21.3.1 is available.
You should consider upgrading via the '/opt/hostedtoolcache/Python/3.7.12/x64/bin/python -m pip install --upgrade pip' command.

This traces to https://github.com/actions/virtual-environments, e.g. actions/runner-images#3285. It isn't affecting anything so just logging to keep track.

Add hosted-site tests

Not exactly sure how to do this, but not having this type of test has caused a fair few issues recently. Essentially, we want to have a GH action briefly host the built site "locally", and test all the API endpoints and client pages.

Freeze right pane on impact pages

It'd be cool for the policy cart + buttons to be frozen on the right side, so as you scroll through the charts it remains visible.

Generalise PolicyEngine-Core

This is a significant rewrite, consolidating the PolicyEngine-UK and -US repos into one package, PolicyEngine (containing both PolicyEngine (python server) and policyengine-client (React app). The advantages include:

  • Significantly reduced dependency complexity (and therefore reverting to old versions becomes feasible)
  • Significantly easier deployment of PolicyEngine-US (different entity structures would've made it either very complex, or a high amount of duplicated code)

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.