{"id":13520383,"url":"https://github.com/ultima-ib/ultima","last_synced_at":"2025-03-31T16:31:32.974Z","repository":{"id":214080018,"uuid":"457123216","full_name":"ultima-ib/ultima","owner":"ultima-ib","description":"The Ultimate BI tool","archived":false,"fork":false,"pushed_at":"2024-05-27T14:14:46.000Z","size":26924,"stargazers_count":6,"open_issues_count":19,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-03T22:20:49.102Z","etag":null,"topics":["frtb","pivot","pivot-tables","python","rust","ui"],"latest_commit_sha":null,"homepage":"https://ultimabi.uk/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ultima-ib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-08T22:21:19.000Z","updated_at":"2024-06-07T23:48:45.931Z","dependencies_parsed_at":null,"dependency_job_id":"ef0cca90-02e5-4415-92d5-95f11eef1e57","html_url":"https://github.com/ultima-ib/ultima","commit_stats":null,"previous_names":["ultima-ib/ultima"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultima-ib%2Fultima","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultima-ib%2Fultima/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultima-ib%2Fultima/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultima-ib%2Fultima/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ultima-ib","download_url":"https://codeload.github.com/ultima-ib/ultima/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222459962,"owners_count":16987954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frtb","pivot","pivot-tables","python","rust","ui"],"created_at":"2024-08-01T05:02:18.919Z","updated_at":"2024-11-02T03:31:28.958Z","avatar_url":"https://github.com/ultima-ib.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://ultimabi.uk/\" target=\"_blank\"\u003e\n    \u003cimg width=\"900\" src=\"https://ultima-bi.s3.eu-west-2.amazonaws.com/imgs/logo.png\" alt=\"Ultima Logo\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n\u003ch3 align=\"center\"\u003ethe ultimate data analytics tool \u003cbr\u003e for no code visualisation and collaborative exploration.\u003c/h3\u003e\n\n\u003ch3 align=\"center\"\u003ePresent easier. \u0026nbsp; Dig deeper. \u0026nbsp; Review together. \u0026nbsp;\u003c/h3\u003e\n\n# The Ultimate BI tool\nWith `Ultibi` you can turn your `DataFrame` into a pivot table with a UI and share it across organisation. You can also define measures applicable to your `DataFrame`.  This means your colleagues/consumers don't have to write any code to analyse the data.\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://frtb.demo.ultimabi.uk/\" target=\"_blank\"\u003e\n    \u003cimg width=\"900\" src=\"https://ultima-bi.s3.eu-west-2.amazonaws.com/imgs/UltimaScreenshotExplained.jpg\" alt=\"Ultima Logo\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\nUltibi leverages on the giants: [Actix](https://github.com/actix/actix-web), [Polars](https://github.com/pola-rs/polars) and Rust which make this possible. We use TypeScript for the frontend.\n\n# Examples\n\nOur [userguide](https://ultimabi.uk/ultibi-frtb-book/)\n\n## Python\n`pip install ultibi`\n\n### Quickstart\n```python\nimport ultibi as ul\nimport polars as pl\nimport os\nos.environ[\"RUST_LOG\"] = \"info\" # enable logs\nos.environ[\"ADDRESS\"] = \"0.0.0.0:8000\" # host on this address\n\n# Read Data\n# for more details: https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.read_csv.html\ndf = pl.read_csv(\"titanic.csv\")\n\n# Convert it into an Ultibi DataSet\nds = ul.DataSet.from_frame(df)\n\n# By default (might change in the future)\n# Fields are Utf8 (non numerics) and integers\n# Measures are numeric columns.\nds.ui() \n```\n\nThen navigate to `http://localhost:8000` or checkout `http://localhost:8000/swagger-ui` for the OpenAPI documentation.\n\n### More flexible - custom measures\n```python\nimport ultibi as ul\nimport polars as pl\nimport os\nos.environ[\"RUST_LOG\"] = \"info\" # enable logs\nos.environ[\"ADDRESS\"] = \"0.0.0.0:8000\" # host on this address\n\n# Read Data\n# for more details: https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.read_csv.html\ndf = pl.read_csv(\"titanic.csv\")\n\n# Let's add some Custom/Bespoke Calculations to our UI\n\n# Standard Calculator\ndef survival_mean_age(kwargs: dict[str, str]) -\u003e pl.Expr:\n    \"\"\"Mean Age of Survivals\n    pl.col(\"survived\") is 0 or 1\n    pl.col(\"age\") * pl.col(\"survived\") - age of survived person, otherwise 0\n    pl.col(\"survived\").sum() - number of survived\n    \"\"\"\n    return pl.col(\"age\") * pl.col(\"survived\") / pl.col(\"survived\").sum()\n\n# Also a Standard Calculator\ndef example_dep_calc(kwargs: dict[str, str]) -\u003e pl.Expr:\n    return pl.col(\"SurvivalMeanAge_sum\") + pl.col(\"SouthamptonFareDivAge_sum\")\n\n# When we need more involved calculations we go for a Custom Calculator\ndef custom_calculator(\n            srs: list[pl.Series], kwargs: dict[str, str]\n        ) -\u003e pl.Series:\n        \"\"\"\n        Southampton Fare/Age*multiplier\n        \"\"\"\n        df = pl.DataFrame({\"age\": srs[0], \n                           \"fare\": srs[1], \n                           \"e\": srs[2]}) \n        # Add Indicator Column for Southampton\n        df = df.with_columns(pl.when(pl.col(\"e\")==\"S\").then(1).otherwise(0).alias(\"S\")) \n        multiplier = float(kwargs.get(\"multiplier\", 1))\n        res = df[\"S\"] * df[\"fare\"] / df[\"age\"] * multiplier\n        return res\n\n# inputs for the custom_calculator srs param\ninputs = [\"age\", \"fare\", \"embarked\"]\n# We return Floats\nres_type = pl.Float64\n# We return a Series, not a scalar (which otherwise would be auto exploded)\nreturns_scalar = False\n\nmeasures = [\n            ul.BaseMeasure(\n                \"SouthamptonFareDivAge\",\n                ul.CustomCalculator(\n                    custom_calculator, res_type, inputs, returns_scalar\n                ),\n                # (Optional) - we are only interested in Southampton, so\n                # unless other measures requested we might as well filter for Southampton only\n                # However, if if multiple measures requested, their precompute_filters will be joined as OR.\n                [[ul.EqFilter(\"embarked\", \"S\")]],\n                # PARAMS tab of the UI\n                calc_params=[ul.CalcParam(\"mltplr\", \"1\", \"float\")]\n            ),\n            ul.BaseMeasure(\n                \"SurvivalMeanAge\",\n                ul.StandardCalculator(survival_mean_age),\n                aggregation_restriction=\"sum\",\n            ),\n            ul.DependantMeasure(\n                \"A_Dependant_Measure\",\n                ul.StandardCalculator(example_dep_calc),\n                [(\"SurvivalMeanAge\", \"sum\"), (\"SouthamptonFareDivAge\", \"sum\")],\n            ),\n        ]\n\n# Convert it into an Ultibi DataSet\nds = ul.DataSet.from_frame(df, bespoke_measures=measures)\n\n# By default (might change in the future)\n# Fields are Utf8 (non numerics) and integers\n# Measures are numeric columns.\nds.ui() \n```\n\nYou can also wite Rust native Custom calculators measure which wouldn't be bounded by GIL! Checkout the [userguide](https://ultimabi.uk/ultibi-frtb-book/).\n\n### DataSources - In and OutOf memory\nWe provide aim to support different sources of the data. \n```python\nscan = pl.read_csv(\"../frtb_engine/data/frtb/Delta.csv\", \n                           dtypes={\"SensitivitySpot\": pl.Float64})\ndsource = ul.DataSource.inmemory(scan)\nds = ul.DataSet.from_source(dsource)\nds.prepare() # .prepare() is only relevant to FRTB dataset currently\nds.ui()\n```\nIf you don't want to/can't hold all your data in the process memory, you can sacrifise performance for memory with Scan/DataBase\n```python\nimport polars as pl\nimport ultibi as ul\n# Note that the LazyFrame query must start with scan_\n# and must've NOT been collected\nscan = pl.scan_csv(\"../frtb_engine/data/frtb/Delta.csv\", \n                    dtypes={\"SensitivitySpot\": pl.Float64})\ndsource = ul.DataSource.scan(scan)\nds = ul.DataSet.from_source(dsource)\nds.ui()\n```\n\nNote: Naturally the later two options will be slower, because prior to computing your measures we will need to read the relevant bits of the data into the process memory. \n\n### FRTB SA\n[FRTB SA](https://en.wikipedia.org/wiki/Fundamental_Review_of_the_Trading_Book) is a great usecase for `ultibi`. FRTB SA is a set of standardised, computationally intensive rules established by the regulator. High business impact of these rules manifests in need for **analysis** and **visibility** thoroughout an organisation. Note: Ultima is not a certified aggregator. Always benchmark the results against your own interpretation of the rules.\nSee python frtb [userguide](https://ultimabi.uk/ultibi-frtb-book/).\n\n### Polars Compatibility \n| Ultibi      | Polars |\n| ----------- | ----------- |\n| 0.5      | 18.7       |\n| 0.6   | 19.18        |\n| 0.7   | 20.27        |\n\n### License \nLicensor:             Ultibi Ltd.\nLicensed Work:        Ultima\n                      The Licensed Work is (c) 2023 Ultibi Ltd.\n\n`ultibi` python library is made available for the purpose of demonstrating the possibilities offered by the Software so users can evaluate the possibilities and potential of the Software. You can choose one of the following:\n\n1) [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.html) \n\n2) Proprietary License. Allows you to use the software in whichever way you want. These `licenses` are extremely affordable, and you can check out the options by reaching out to us directly, via `anatoly at ultimabi dot uk`, or by visiting `ultimabi dot uk`\n\n### No Liability\nAs far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.\n\n### Contributions\nAll code in this Repository is a property of the Licensor. If you make a contribution via PR or any other way, you give the Licensor a right to use your code in whatever way they deem necessary, including copying or refactoring it to a private repository, provided that a copy of your work will remain available under the current conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultima-ib%2Fultima","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultima-ib%2Fultima","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultima-ib%2Fultima/lists"}