https://github.com/jbogaardt/chainladder-backend
https://github.com/jbogaardt/chainladder-backend
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jbogaardt/chainladder-backend
- Owner: jbogaardt
- License: mit
- Created: 2020-05-01T21:37:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-18T13:55:25.000Z (about 4 years ago)
- Last Synced: 2025-03-28T23:34:38.104Z (18 days ago)
- Language: Python
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - jbogaardt/chainladder-backend - (Python)
README
# chainladder-backend
A GraphQL wrapper around `chainladder-python` to act as backend for a larger application.
### Example
**Code in python**
```python
import chainladder as cl
clrd = cl.load_dataset('clrd')
clrd = clrd.loc[clrd['LOB']=='wkcomp', ['CumPaidLoss', 'EarnedPremNet']][clrd.origin>='1995']
clrd = clrd.dropna()
clrd.shape
```**equivalent code in GraphQL**
```graphql
mutation {
loadDataset(name: "clrd"){
triangle{shape}
}
loc(
name: "clrd", assignTo: "clrd"
whereIndex:{key: "LOB", operator: EQ, value:"wkcomp"},
columns:["CumPaidLoss", "EarnedPremNet"],
whereOrigin: {operator: GE, value: "1995"}) {
triangle {shape}
}
dropNa(name: "clrd", assignTo: "clrd"){
triangle{shape}
}
}
```
### Running the Server
```bash
/> python api.py
```
Then navigate to http://localhost:5000/graphql to see the explore the API.