Giter Site home page Giter Site logo

sphn-queries's Introduction

Explore SPHN datasets using a catalogue of queries

Set up the connection

from sphn import SPHNRepository

#example with a repo from GraphDB
sparql_endpoint = "http://<HOSTNAME>:7200/repositories/"

repository = "hospfair"
catalog_uri = "https://raw.githubusercontent.com/ddtxra/sphn-queries/main/"

repo = SPHNRepository(sparql_endpoint, repository, catalog_uri)

Execute a query from the catalogue

df = repo.execute_query("core/2022/administrative_case", 200)

Explore data visually

Using seaborn

import seaborn as sns
import pandas as pd
import numpy as np

df_plot = df.replace(np.nan, 'nan')
keys = ['origin_location_class', 'origin_location']
fig, axs = plt.subplots(len(keys), figsize=(20, 10))
for i in range(len(keys)):
    sns.countplot(y=df_plot[keys[i]], ax=axs[i])

bar

sns.histplot(df_plot['admission_date_time'], bins=50)

time

sns.histplot((df_plot['discharge_date_time'] - df_plot['admission_date_time']).dt.days)
plt.xlim([-20, 500])

time

Using matplot lib

import matplotlib.pyplot as plt
keys = ['origin_location_class', 'origin_location']
fig, axs = plt.subplots(len(keys), figsize=(20, 10))
for i in range(len(keys)):
    df.value_counts(keys[i], dropna=False).plot(kind='barh', ax=axs[i], subplots=True)
    plt.title(keys[i])
    plt.tight_layout()    

time

sphn-queries's People

Contributors

ddtxra avatar

Watchers

 avatar

Forkers

jklatt

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.