Search is not available for this dataset
repo
stringlengths 2
152
⌀ | file
stringlengths 15
239
| code
stringlengths 0
58.4M
| file_length
int64 0
58.4M
| avg_line_length
float64 0
1.81M
| max_line_length
int64 0
12.7M
| extension_type
stringclasses 364
values |
---|---|---|---|---|---|---|
null | coax-main/doc/examples/pendulum/run_all.sh | #!/bin/bash
trap "kill 0" EXIT
gio trash -f ./data
for f in $(ls ./*.py); do
JAX_PLATFORM_NAME=cpu python3 $f &
done
wait
| 129 | 10.818182 | 38 | sh |
null | coax-main/doc/examples/pendulum/sac.py | import gymnasium
import jax
import coax
import haiku as hk
import jax.numpy as jnp
from numpy import prod
import optax
# the name of this script
name = 'sac'
# the Pendulum MDP
env = gymnasium.make('Pendulum-v1', render_mode='rgb_array')
env = coax.wrappers.TrainMonitor(env, name=name, tensorboard_dir=f"./data/tensorboard/{name}")
def func_pi(S, is_training):
seq = hk.Sequential((
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(prod(env.action_space.shape) * 2, w_init=jnp.zeros),
hk.Reshape((*env.action_space.shape, 2)),
))
x = seq(S)
mu, logvar = x[..., 0], x[..., 1]
return {'mu': mu, 'logvar': logvar}
def func_q(S, A, is_training):
seq = hk.Sequential((
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(1, w_init=jnp.zeros), jnp.ravel
))
X = jnp.concatenate((S, A), axis=-1)
return seq(X)
# main function approximators
pi = coax.Policy(func_pi, env)
q1 = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
q2 = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
# target network
q1_targ = q1.copy()
q2_targ = q2.copy()
# experience tracer
tracer = coax.reward_tracing.NStep(n=5, gamma=0.9, record_extra_info=True)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=25000)
alpha = 0.2
policy_regularizer = coax.regularizers.NStepEntropyRegularizer(pi,
beta=alpha / tracer.n,
gamma=tracer.gamma,
n=[tracer.n])
# updaters (use current pi to update the q-functions and use sampled action in contrast to TD3)
qlearning1 = coax.td_learning.SoftClippedDoubleQLearning(
q1, pi_targ_list=[pi], q_targ_list=[q1_targ, q2_targ],
loss_function=coax.value_losses.mse, optimizer=optax.adam(1e-3),
policy_regularizer=policy_regularizer)
qlearning2 = coax.td_learning.SoftClippedDoubleQLearning(
q2, pi_targ_list=[pi], q_targ_list=[q1_targ, q2_targ],
loss_function=coax.value_losses.mse, optimizer=optax.adam(1e-3),
policy_regularizer=policy_regularizer)
soft_pg = coax.policy_objectives.SoftPG(pi, [q1_targ, q2_targ], optimizer=optax.adam(
1e-3), regularizer=coax.regularizers.NStepEntropyRegularizer(pi,
beta=alpha / tracer.n,
gamma=tracer.gamma,
n=jnp.arange(tracer.n)))
# train
while env.T < 1000000:
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# trace rewards and add transition to replay buffer
tracer.add(s, a, r, done)
while tracer:
buffer.add(tracer.pop())
# learn
if len(buffer) >= 5000:
transition_batch = buffer.sample(batch_size=128)
# init metrics dict
metrics = {}
# flip a coin to decide which of the q-functions to update
qlearning = qlearning1 if jax.random.bernoulli(q1.rng) else qlearning2
metrics.update(qlearning.update(transition_batch))
# delayed policy updates
if env.T >= 7500 and env.T % 4 == 0:
metrics.update(soft_pg.update(transition_batch))
env.record_metrics(metrics)
# sync target networks
q1_targ.soft_update(q1, tau=0.001)
q2_targ.soft_update(q2, tau=0.001)
if done or truncated:
break
s = s_next
# generate an animated GIF to see what's going on
if env.period(name='generate_gif', T_period=10000) and env.T > 5000:
T = env.T - env.T % 10000 # round to 10000s
coax.utils.generate_gif(
env=env, policy=pi, filepath=f"./data/gifs/{name}/T{T:08d}.gif")
| 4,143 | 33.533333 | 95 | py |
null | coax-main/doc/examples/pendulum/td3.py | import gymnasium
import jax
import coax
import haiku as hk
import jax.numpy as jnp
from numpy import prod
import optax
# the name of this script
name = 'td3'
# the Pendulum MDP
env = gymnasium.make('Pendulum-v1', render_mode='rgb_array')
env = coax.wrappers.TrainMonitor(env, name=name, tensorboard_dir=f"./data/tensorboard/{name}")
def func_pi(S, is_training):
seq = hk.Sequential((
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(prod(env.action_space.shape), w_init=jnp.zeros),
hk.Reshape(env.action_space.shape),
))
mu = seq(S)
return {'mu': mu, 'logvar': jnp.full_like(mu, jnp.log(0.05))} # (almost) deterministic
def func_q(S, A, is_training):
seq = hk.Sequential((
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(1, w_init=jnp.zeros), jnp.ravel
))
X = jnp.concatenate((S, A), axis=-1)
return seq(X)
# main function approximators
pi = coax.Policy(func_pi, env)
q1 = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
q2 = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
# target network
q1_targ = q1.copy()
q2_targ = q2.copy()
pi_targ = pi.copy()
# experience tracer
tracer = coax.reward_tracing.NStep(n=5, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=25000)
# updaters
qlearning1 = coax.td_learning.ClippedDoubleQLearning(
q1, pi_targ_list=[pi_targ], q_targ_list=[q1_targ, q2_targ],
loss_function=coax.value_losses.mse, optimizer=optax.adam(1e-3))
qlearning2 = coax.td_learning.ClippedDoubleQLearning(
q2, pi_targ_list=[pi_targ], q_targ_list=[q1_targ, q2_targ],
loss_function=coax.value_losses.mse, optimizer=optax.adam(1e-3))
determ_pg = coax.policy_objectives.DeterministicPG(pi, q1_targ, optimizer=optax.adam(1e-3))
# action noise
noise = coax.utils.OrnsteinUhlenbeckNoise(mu=0., sigma=0.2, theta=0.15)
# train
while env.T < 1000000:
s, info = env.reset()
noise.reset()
noise.sigma *= 0.99 # slowly decrease noise scale
for t in range(env.spec.max_episode_steps):
a = noise(pi.mode(s))
s_next, r, done, truncated, info = env.step(a)
# trace rewards and add transition to replay buffer
tracer.add(s, a, r, done)
while tracer:
buffer.add(tracer.pop())
# learn
if len(buffer) >= 5000:
transition_batch = buffer.sample(batch_size=128)
# init metrics dict
metrics = {'OrnsteinUhlenbeckNoise/sigma': noise.sigma}
# flip a coin to decide which of the q-functions to update
qlearning = qlearning1 if jax.random.bernoulli(q1.rng) else qlearning2
metrics.update(qlearning.update(transition_batch))
# delayed policy updates
if env.T >= 7500 and env.T % 4 == 0:
metrics.update(determ_pg.update(transition_batch))
env.record_metrics(metrics)
# sync target networks
q1_targ.soft_update(q1, tau=0.001)
q2_targ.soft_update(q2, tau=0.001)
pi_targ.soft_update(pi, tau=0.001)
if done or truncated:
break
s = s_next
# generate an animated GIF to see what's going on
if env.period(name='generate_gif', T_period=10000) and env.T > 5000:
T = env.T - env.T % 10000 # round to 10000s
coax.utils.generate_gif(
env=env, policy=pi, filepath=f"./data/gifs/{name}/T{T:08d}.gif")
| 3,593 | 29.201681 | 94 | py |
null | coax-main/doc/examples/pendulum/td4.py | import gymnasium
import jax
import coax
import haiku as hk
import jax.numpy as jnp
from numpy import prod
import optax
# the name of this script
name = 'td3'
# the Pendulum MDP
env = gymnasium.make('Pendulum-v1', render_mode='rgb_array')
env = coax.wrappers.TrainMonitor(env, name=name, tensorboard_dir=f"./data/tensorboard/{name}")
quantile_embedding_dim = 64
layer_size = 256
num_quantiles = 32
def func_pi(S, is_training):
seq = hk.Sequential((
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(8), jax.nn.relu,
hk.Linear(prod(env.action_space.shape), w_init=jnp.zeros),
hk.Reshape(env.action_space.shape),
))
mu = seq(S)
return {'mu': mu, 'logvar': jnp.full_like(mu, jnp.log(0.05))} # (almost) deterministic
def quantile_net(x, quantile_fractions):
quantiles_emb = coax.utils.quantile_cos_embedding(
quantile_fractions, quantile_embedding_dim)
quantiles_emb = hk.Linear(x.shape[-1])(quantiles_emb)
quantiles_emb = jax.nn.relu(quantiles_emb)
x = x[:, None, :] * quantiles_emb
x = hk.Linear(layer_size)(x)
x = jax.nn.relu(x)
return x
def func_q(S, A, is_training):
encoder = hk.Sequential((
hk.Flatten(),
hk.Linear(layer_size),
jax.nn.relu
))
quantile_fractions = coax.utils.quantiles_uniform(rng=hk.next_rng_key(),
batch_size=S.shape[0],
num_quantiles=num_quantiles)
X = jnp.concatenate((S, A), axis=-1)
x = encoder(X)
quantile_x = quantile_net(x, quantile_fractions=quantile_fractions)
quantile_values = hk.Linear(1)(quantile_x)
return {'values': quantile_values.squeeze(axis=-1),
'quantile_fractions': quantile_fractions}
# main function approximators
pi = coax.Policy(func_pi, env)
q1 = coax.StochasticQ(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate,
value_range=None, num_bins=num_quantiles)
q2 = coax.StochasticQ(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate,
value_range=None, num_bins=num_quantiles)
# target network
q1_targ = q1.copy()
q2_targ = q2.copy()
pi_targ = pi.copy()
# experience tracer
tracer = coax.reward_tracing.NStep(n=5, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=25000)
# updaters
qlearning1 = coax.td_learning.ClippedDoubleQLearning(
q1, pi_targ_list=[pi_targ], q_targ_list=[q1_targ, q2_targ],
loss_function=coax.value_losses.mse, optimizer=optax.adam(1e-3))
qlearning2 = coax.td_learning.ClippedDoubleQLearning(
q2, pi_targ_list=[pi_targ], q_targ_list=[q1_targ, q2_targ],
loss_function=coax.value_losses.mse, optimizer=optax.adam(1e-3))
determ_pg = coax.policy_objectives.DeterministicPG(pi, q1_targ, optimizer=optax.adam(1e-3))
# train
while env.T < 1000000:
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi.mode(s)
s_next, r, done, truncated, info = env.step(a)
# trace rewards and add transition to replay buffer
tracer.add(s, a, r, done)
while tracer:
buffer.add(tracer.pop())
# learn
if len(buffer) >= 5000:
transition_batch = buffer.sample(batch_size=128)
# init metrics dict
metrics = {}
# flip a coin to decide which of the q-functions to update
qlearning = qlearning1 if jax.random.bernoulli(q1.rng) else qlearning2
metrics.update(qlearning.update(transition_batch))
# delayed policy updates
if env.T >= 7500 and env.T % 4 == 0:
metrics.update(determ_pg.update(transition_batch))
env.record_metrics(metrics)
# sync target networks
q1_targ.soft_update(q1, tau=0.001)
q2_targ.soft_update(q2, tau=0.001)
pi_targ.soft_update(pi, tau=0.001)
if done or truncated:
break
s = s_next
# generate an animated GIF to see what's going on
# if env.period(name='generate_gif', T_period=10000) and env.T > 5000:
# T = env.T - env.T % 10000 # round to 10000s
# coax.utils.generate_gif(
# env=env, policy=pi, filepath=f"./data/gifs/{name}/T{T:08d}.gif")
| 4,352 | 31.244444 | 94 | py |
null | coax-main/doc/examples/pendulum/experiments/ddpg_standalone.py | """
This script is a JAX port of the original Tensorflow-based script:
https://gist.github.com/heerad/1983d50c6657a55298b67e69a2ceeb44#file-ddpg-pendulum-v0-py
"""
import os
import json
import random
from collections import deque
from functools import partial
from copy import deepcopy
import gymnasium
import numpy as onp
import jax
import jax.numpy as jnp
import haiku as hk
import coax
import optax
class hparams:
gamma = 0.99 # reward discount factor
h1_actor = 8 # hidden layer 1 size for the actor
h2_actor = 8 # hidden layer 2 size for the actor
h3_actor = 8 # hidden layer 3 size for the actor
h1_critic = 8 # hidden layer 1 size for the critic
h2_critic = 8 # hidden layer 2 size for the critic
h3_critic = 8 # hidden layer 3 size for the critic
lr_actor = 1e-3 # learning rate for the actor
lr_critic = 1e-3 # learning rate for the critic
lr_decay = 1 # learning rate decay (per episode)
l2_reg_actor = 1e-6 # L2 regularization factor for the actor
l2_reg_critic = 1e-6 # L2 regularization factor for the critic
dropout_actor = 0 # dropout rate for actor (0 = no dropout)
dropout_critic = 0 # dropout rate for critic (0 = no dropout)
num_episodes = 15000 # number of episodes
max_steps_ep = 10000 # default max number of steps per episode (unless env has a lower hardcoded limit)
tau = 1e-2 # soft target update rate
train_every = 1 # number of steps to run the policy (and collect experience) before updating network weights
replay_memory_capacity = int(1e5) # capacity of experience replay memory
minibatch_size = 1024 # size of minibatch from experience replay memory for updates
noise_decay = 0.9999 # decay rate (per step) of the scale of the exploration noise process
exploration_mu = 0.0 # mu parameter for the exploration noise process: dXt = theta*(mu-Xt)*dt + sigma*dWt
exploration_theta = 0.15 # theta parameter for the exploration noise process: dXt = theta*(mu-Xt)*dt + sigma*dWt
exploration_sigma = 0.2 # sigma parameter for the exploration noise process: dXt = theta*(mu-Xt )*dt + sigma*dWt
@classmethod
def to_json(cls, dirpath):
dct = {k: v for k, v in cls.__dict__.items() if not k.startswith('_') and k != 'to_json'}
if not os.path.exists(dirpath):
os.makedirs(dirpath)
with open(os.path.join(dirpath, 'hparams.pkl'), 'w') as f:
json.dump(dct, f)
# filepaths etc
experiment_id, _ = os.path.splitext(__file__)
tensorboard_dir = f"./data/tensorboard/{experiment_id}"
coax.utils.enable_logging(experiment_id)
# the MDP
env = gymnasium.make('Pendulum-v1', render_mode='rgb_array')
env = coax.wrappers.BoxActionsToReals(env)
env = coax.wrappers.TrainMonitor(env, tensorboard_dir)
# store hparams to disk, just in case it gets lost
hparams.to_json(env.tensorboard.logdir)
# set seeds to 0
env.seed(0)
onp.random.seed(0)
# onp.set_printoptions(threshold=sys.maxsize)
# used for O(1) popleft() operation
replay_memory = deque(maxlen=hparams.replay_memory_capacity)
def add_to_memory(s, a, r, done, s_next):
replay_memory.append((s, a, r, float(done), s_next))
def sample_from_memory(minibatch_size):
transitions = random.sample(replay_memory, minibatch_size)
# S, A, R, D, S_next = (jnp.stack(x, axis=0) for x in zip(*transitions))
S = onp.stack([t[0] for t in transitions], axis=0)
A = onp.stack([t[1] for t in transitions], axis=0)
R = onp.stack([t[2] for t in transitions], axis=0)
D = onp.stack([t[3] for t in transitions], axis=0)
S_next = onp.stack([t[4] for t in transitions], axis=0)
In = hparams.gamma * (1 - D)
return coax.reward_tracing.TransitionBatch(S, A, None, R, In, S_next, None, None)
####################################################################################################
# forward-passes
def pi(S, is_training):
rng1, rng2, rng3 = hk.next_rng_keys(3)
shape = env.action_space.shape
rate = hparams.dropout_actor * is_training
seq = hk.Sequential((
hk.Linear(hparams.h1_actor), jax.nn.relu, partial(hk.dropout, rng1, rate),
hk.Linear(hparams.h2_actor), jax.nn.relu, partial(hk.dropout, rng2, rate),
hk.Linear(hparams.h3_actor), jax.nn.relu, partial(hk.dropout, rng3, rate),
hk.Linear(onp.prod(shape)), hk.Reshape(shape),
# lambda x: low + (high - low) * jax.nn.sigmoid(x), # disable: BoxActionsToReals
))
return seq(S) # batch of actions
def q(S, A, is_training):
rng1, rng2, rng3 = hk.next_rng_keys(3)
rate = hparams.dropout_critic * is_training
seq = hk.Sequential((
hk.Linear(hparams.h1_critic), jax.nn.relu, partial(hk.dropout, rng1, rate),
hk.Linear(hparams.h2_critic), jax.nn.relu, partial(hk.dropout, rng2, rate),
hk.Linear(hparams.h3_critic), jax.nn.relu, partial(hk.dropout, rng3, rate),
hk.Linear(1), jnp.ravel,
))
flatten = hk.Flatten()
X_sa = jnp.concatenate([flatten(S), jnp.tanh(flatten(A))], axis=1)
return seq(X_sa)
# dummy input (with batch axis) to initialize params
rngs = hk.PRNGSequence(13)
S = jnp.zeros((1,) + env.observation_space.shape)
A = jnp.zeros((1,) + env.action_space.shape)
# Haiku-transform actor
pi = hk.transform(pi, apply_rng=True)
params_pi = pi.init(next(rngs), S, True)
pi = jax.jit(pi.apply, static_argnums=3)
# Haiku-transform critic
q = hk.transform(q, apply_rng=True)
params_q = q.init(next(rngs), S, A, True)
q = jax.jit(q.apply, static_argnums=4)
# target-network params
target_params_pi = deepcopy(params_pi)
target_params_q = deepcopy(params_q)
@jax.jit
def soft_update(target_params, primary_params, tau=1.0):
return jax.tree_map(lambda a, b: a + tau * (b - a), target_params, primary_params)
####################################################################################################
# loss functions and optimizers
def loss_q(params_q, target_params_q, target_params_pi, rng, transition_batch):
rngs = hk.PRNGSequence(rng)
S, A, _, Rn, In, S_next, _, _ = transition_batch
A_next = pi(target_params_pi, next(rngs), S_next, False)
Q_next = q(target_params_q, next(rngs), S_next, A_next, False)
target = Rn + In * Q_next
pred = q(params_q, next(rngs), S, A, True)
return jnp.mean(jnp.square(pred - target))
def loss_pi(params_pi, target_params_q, rng, transition_batch):
rngs = hk.PRNGSequence(rng)
S, A = transition_batch[:2]
A = pi(params_pi, next(rngs), S, True)
Q = q(target_params_q, next(rngs), S, A, False)
return -jnp.mean(Q) # flip sign
@partial(jax.jit, static_argnums=2)
def update_fn(params, grads, optimizer, optimizer_state):
updates, new_optimizer_state = optimizer.update(grads, optimizer_state)
new_params = optax.apply_updates(params, updates)
return new_params, new_optimizer_state
# loss + gradient functions
loss_and_grad_pi = jax.jit(jax.value_and_grad(loss_pi))
loss_and_grad_q = jax.jit(jax.value_and_grad(loss_q))
# actor optimizer
optimizer_pi = optax.adam(hparams.lr_actor)
optimizer_state_pi = optimizer_pi.init(params_pi)
# critic optimizer
optimizer_q = optax.adam(hparams.lr_critic)
optimizer_state_q = optimizer_q.init(params_q)
def update(transition_batch):
""" high-level utility function for updating the actor-critic """
global params_pi, optimizer_state_pi, params_q, optimizer_state_q
# update the actor
loss_pi, grads_pi = loss_and_grad_pi(params_pi, target_params_q, next(rngs), transition_batch)
params_pi, optimizer_state_pi = update_fn(params_pi, grads_pi, optimizer_pi, optimizer_state_pi)
# update the critic
loss_q, grads_q = loss_and_grad_q(
params_q, target_params_q, target_params_pi, next(rngs), transition_batch)
params_q, optimizer_state_q = update_fn(params_q, grads_q, optimizer_q, optimizer_state_q)
return {'pi/loss': loss_pi, 'q/loss': loss_q}
####################################################################################################
# action noise
def noise(a, ep):
a = jnp.asarray(a)
shape = env.action_space.shape
mu, sigma, theta = hparams.exploration_mu, hparams.exploration_sigma, hparams.exploration_theta
scale = hk.get_state('scale', shape=(), dtype=a.dtype, init=jnp.ones)
noise = hk.get_state('noise', shape=a.shape, dtype=a.dtype, init=jnp.zeros)
scale = scale * hparams.noise_decay
noise = theta * (mu - noise) + sigma * jax.random.normal(hk.next_rng_key(), shape)
hk.set_state('scale', scale)
hk.set_state('noise', noise)
return a + noise * scale
# Haiku-transform
noise = hk.transform_with_state(noise)
noise_params, noise_init_state = noise.init(next(rngs), env.action_space.sample(), 13)
noise = jax.jit(partial(noise.apply, noise_params)) # params are trivial, so we'll discard them
del noise_params
def sample_action(s, with_noise=False):
global noise_state
S = jnp.expand_dims(s, axis=0)
A = pi(params_pi, next(rngs), S, False)
a = jnp.squeeze(A, axis=0)
if not with_noise:
return a
a, noise_state = noise(noise_state, next(rngs), a, env.ep)
return onp.clip(a, env.action_space.low, env.action_space.high) # ordinary numpy array
####################################################################################################
# train
for _ in range(hparams.num_episodes):
noise_state = noise_init_state # reset noise state
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = sample_action(s, with_noise=True)
s_next, r, done, truncated, info = env.step(a)
# add to replay buffer
add_to_memory(s, a, r, done, s_next)
if len(replay_memory) >= max(hparams.minibatch_size, 5000):
transition_batch = sample_from_memory(hparams.minibatch_size)
metrics = update(transition_batch)
env.record_metrics(metrics)
# update target networks
target_params_pi = soft_update(target_params_pi, params_pi, hparams.tau)
target_params_q = soft_update(target_params_q, params_q, hparams.tau)
if done or truncated:
break
s = s_next
# generate an animated GIF to see what's going on
if env.period(name='generate_gif', T_period=10000) and env.T > 5000:
T = env.T - env.T % 10000
coax.utils.generate_gif(
env=env, policy=sample_action,
filepath=os.path.join(env.tensorboard.logdir, f'T{T:08d}.gif'))
| 10,692 | 35.872414 | 120 | py |
null | coax-main/doc/examples/stubs/a2c.py | import gymnasium
import coax
import optax
import haiku as hk
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def torso(S, is_training):
# custom haiku function for the shared preprocessor
with hk.experimental.name_scope('torso'):
net = hk.Sequential([...])
return net(S)
def func_v(S, is_training):
# custom haiku function
X = torso(S, is_training)
with hk.experimental.name_scope('v'):
value = hk.Sequential([...])
return value(X) # output shape: (batch_size,)
def func_pi(S, is_training):
# custom haiku function (for discrete actions in this example)
X = torso(S, is_training)
with hk.experimental.name_scope('pi'):
logits = hk.Sequential([...])
return {'logits': logits(X)} # logits shape: (batch_size, num_actions)
# function approximators
v = coax.V(func_v, env)
pi = coax.Policy(func_pi, env)
# specify how to update policy and value function
vanilla_pg = coax.policy_objectives.VanillaPG(pi, optimizer=optax.adam(0.001))
simple_td = coax.td_learning.SimpleTD(v, optimizer=optax.adam(0.002))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=5, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=256)
for ep in range(100):
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a, logp = pi(s, return_logp=True)
s_next, r, done, truncated, info = env.step(a)
# add transition to buffer
# N.B. vanilla-pg doesn't use logp but we include it to make it easy to
# swap in another policy updater that does require it, e.g. ppo-clip
tracer.add(s, a, r, done or truncated, logp)
while tracer:
buffer.add(tracer.pop())
# update
if len(buffer) == buffer.capacity:
for _ in range(4 * buffer.capacity // 32): # ~4 passes
transition_batch = buffer.sample(batch_size=32)
metrics_v, td_error = simple_td.update(transition_batch, return_td_error=True)
metrics_pi = vanilla_pg.update(transition_batch, td_error)
env.record_metrics(metrics_v)
env.record_metrics(metrics_pi)
# optional: sync shared parameters (this is not always optimal)
pi.params, v.params = coax.utils.sync_shared_params(pi.params, v.params)
buffer.clear()
if done or truncated:
break
s = s_next
| 2,497 | 29.463415 | 94 | py |
null | coax-main/doc/examples/stubs/ddpg.py | import gymnasium
import coax
import optax
import haiku as hk
import jax.numpy as jnp
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_pi(S, is_training):
# custom haiku function (for continuous actions in this example)
mu = hk.Sequential([...])(S) # mu.shape: (batch_size, *action_space.shape)
return {'mu': mu, 'logvar': jnp.full_like(mu, -10)} # deterministic policy
def func_q(S, A, is_training):
# custom haiku function
value = hk.Sequential([...])
return value(S) # output shape: (batch_size,)
# define function approximator
pi = coax.Policy(func_pi, env)
q = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
# target networks
pi_targ = pi.copy()
q_targ = q.copy()
# specify how to update policy and value function
determ_pg = coax.policy_objectives.DeterministicPG(pi, q, optimizer=optax.adam(0.001))
qlearning = coax.td_learning.QLearning(q, pi_targ, q_targ, optimizer=optax.adam(0.002))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=1, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=1000000)
# action noise
noise = coax.utils.OrnsteinUhlenbeckNoise(mu=0., sigma=0.2, theta=0.15)
for ep in range(100):
s, info = env.reset()
noise.reset()
noise.sigma *= 0.99 # slowly decrease noise scale
for t in range(env.spec.max_episode_steps):
a = noise(pi(s))
s_next, r, done, truncated, info = env.step(a)
# add transition to buffer
tracer.add(s, a, r, done)
while tracer:
buffer.add(tracer.pop())
# update
transition_batch = buffer.sample(batch_size=32)
metrics_q = qlearning.update(transition_batch)
metrics_pi = determ_pg.update(transition_batch)
env.record_metrics(metrics_q)
env.record_metrics(metrics_pi)
# periodically sync target models
if ep % 10 == 0:
pi_targ.soft_update(pi, tau=1.0)
q_targ.soft_update(q, tau=1.0)
if done or truncated:
break
s = s_next
| 2,120 | 25.848101 | 87 | py |
null | coax-main/doc/examples/stubs/dqn.py | import gymnasium
import coax
import optax
import haiku as hk
import jax
import jax.numpy as jnp
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_type1(S, A, is_training):
# custom haiku function: s,a -> q(s,a)
value = hk.Sequential([...])
X = jax.vmap(jnp.kron)(S, A) # or jnp.concatenate((S, A), axis=-1) or whatever you like
return value(X) # output shape: (batch_size,)
def func_type2(S, is_training):
# custom haiku function: s -> q(s,.)
value = hk.Sequential([...])
return value(S) # output shape: (batch_size, num_actions)
# function approximator
func = ... # func_type1 or func_type2
q = coax.Q(func, env)
pi = coax.EpsilonGreedy(q, epsilon=0.1)
# target network
q_targ = q.copy()
# specify how to update q-function
qlearning = coax.td_learning.QLearning(q, q_targ=q_targ, optimizer=optax.adam(0.001))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=1, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=1000000)
# schedule for pi.epsilon (exploration)
epsilon = coax.utils.StepwiseLinearFunction((0, 1), (1000000, 0.1), (2000000, 0.01))
while env.T < 3000000:
pi.epsilon = epsilon(env.T)
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# add transition to buffer
tracer.add(s, a, r, done)
while tracer:
transition = tracer.pop()
buffer.add(transition)
# update
transition_batch = buffer.sample(batch_size=32)
metrics = qlearning.update(transition_batch)
env.record_metrics(metrics)
# periodically sync target model
if env.ep % 10 == 0:
q_targ.soft_update(q, tau=1.0)
if done or truncated:
break
s = s_next
| 1,900 | 23.688312 | 92 | py |
null | coax-main/doc/examples/stubs/dqn_per.py | import gymnasium
import coax
import optax
import haiku as hk
import jax
import jax.numpy as jnp
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_type1(S, A, is_training):
# custom haiku function: s,a -> q(s,a)
value = hk.Sequential([...])
X = jax.vmap(jnp.kron)(S, A) # or jnp.concatenate((S, A), axis=-1) or whatever you like
return value(X) # output shape: (batch_size,)
def func_type2(S, is_training):
# custom haiku function: s -> q(s,.)
value = hk.Sequential([...])
return value(S) # output shape: (batch_size, num_actions)
# function approximator
func = ... # func_type1 or func_type2
q = coax.Q(func, env)
pi = coax.EpsilonGreedy(q, epsilon=1.0) # epsilon will be updated
# target network
q_targ = q.copy()
# specify how to update q-function
qlearning = coax.td_learning.QLearning(q, q_targ=q_targ, optimizer=optax.adam(0.001))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=1, gamma=0.9)
buffer = coax.experience_replay.PrioritizedReplayBuffer(capacity=1000000, alpha=0.6, beta=0.4)
# schedules for pi.epsilon and buffer.beta
epsilon = coax.utils.StepwiseLinearFunction((0, 1), (1000000, 0.1), (2000000, 0.01))
beta = coax.utils.StepwiseLinearFunction((0, 0.4), (1000000, 1))
while env.T < 3000000:
pi.epsilon = epsilon(env.T)
buffer.beta = beta(env.T)
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# add transition to buffer
tracer.add(s, a, r, done)
while tracer:
transition = tracer.pop()
buffer.add(transition, qlearning.td_error(transition))
# update
transition_batch = buffer.sample(batch_size=32)
metrics, td_error = qlearning.update(transition_batch, return_td_error=True)
buffer.update(transition_batch.idx, td_error)
env.record_metrics(metrics)
# periodically sync target model
if env.ep % 10 == 0:
q_targ.soft_update(q, tau=1.0)
if done or truncated:
break
s = s_next
| 2,170 | 25.802469 | 94 | py |
null | coax-main/doc/examples/stubs/iqn.py | import gymnasium
import coax
import optax
import haiku as hk
import jax
import jax.numpy as jnp
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
# choose iqn hyperparameters
quantile_embedding_dim = 32
num_quantiles = 32
def func_type1(S, A, is_training):
# custom haiku function: s,a -> q(s,a)
net = hk.Sequential([...])
X = jax.vmap(jnp.kron)(S, A) # or jnp.concatenate((S, A), axis=-1) or whatever you like
quantile_values, quantile_fractions = net(X)
return {'values': quantile_values, # output shape: (batch_size, num_quantiles)
'quantile_fractions': quantile_fractions}
def func_type2(S, is_training):
# custom haiku function: s -> q(s,.)
quantile_values, quantile_fractions = hk.Sequential([...])
return {'values': quantile_values, # output shape: (batch_size, num_actions, num_quantiles)
'quantile_fractions': quantile_fractions}
# function approximator
func = ... # func_type1 or func_type2
# quantile value function and its derived policy
q = coax.StochasticQ(func, env, num_bins=num_quantiles, value_range=None)
pi = coax.BoltzmannPolicy(q)
# target network
q_targ = q.copy()
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=1, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=100000)
# specify how to update q-function
qlearning = coax.td_learning.QLearning(q, q_targ=q_targ, optimizer=optax.adam(0.001))
for ep in range(1000):
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# trace rewards and add transition to replay buffer
tracer.add(s, a, r, done)
while tracer:
buffer.add(tracer.pop())
# learn
if len(buffer) >= 100:
transition_batch = buffer.sample(batch_size=32)
metrics = qlearning.update(transition_batch)
env.record_metrics(metrics)
# sync target network
q_targ.soft_update(q, tau=0.01)
if done or truncated:
break
s = s_next
# early stopping
if env.avg_G > env.spec.reward_threshold:
break
| 2,227 | 26.506173 | 96 | py |
null | coax-main/doc/examples/stubs/ppo.py | import gymnasium
import coax
import optax
import haiku as hk
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_v(S, is_training):
# custom haiku function
value = hk.Sequential([...])
return value(S) # output shape: (batch_size,)
def func_pi(S, is_training):
# custom haiku function (for discrete actions in this example)
logits = hk.Sequential([...])
return {'logits': logits(S)} # logits shape: (batch_size, num_actions)
# function approximators
v = coax.V(func_v, env)
pi = coax.Policy(func_pi, env)
# slow-moving avg of pi
pi_behavior = pi.copy()
# specify how to update policy and value function
ppo_clip = coax.policy_objectives.PPOClip(pi, optimizer=optax.adam(0.001))
simple_td = coax.td_learning.SimpleTD(v, optimizer=optax.adam(0.001))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=5, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=256)
for ep in range(100):
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a, logp = pi_behavior(s, return_logp=True)
s_next, r, done, truncated, info = env.step(a)
# add transition to buffer
tracer.add(s, a, r, done or truncated, logp)
while tracer:
buffer.add(tracer.pop())
# update
if len(buffer) == buffer.capacity:
for _ in range(4 * buffer.capacity // 32): # ~4 passes
transition_batch = buffer.sample(batch_size=32)
metrics_v, td_error = simple_td.update(transition_batch, return_td_error=True)
metrics_pi = ppo_clip.update(transition_batch, td_error)
env.record_metrics(metrics_v)
env.record_metrics(metrics_pi)
buffer.clear()
pi_behavior.soft_update(pi, tau=0.1)
if done or truncated:
break
s = s_next
| 1,935 | 26.267606 | 94 | py |
null | coax-main/doc/examples/stubs/qlearning.py | import gymnasium
import coax
import optax
import haiku as hk
import jax
import jax.numpy as jnp
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_type1(S, A, is_training):
# custom haiku function: s,a -> q(s,a)
value = hk.Sequential([...])
X = jax.vmap(jnp.kron)(S, A) # or jnp.concatenate((S, A), axis=-1) or whatever you like
return value(X) # output shape: (batch_size,)
def func_type2(S, is_training):
# custom haiku function: s -> q(s,.)
value = hk.Sequential([...])
return value(S) # output shape: (batch_size, num_actions)
# function approximator
func = ... # func_type1 or func_type2
q = coax.Q(func, env)
pi = coax.EpsilonGreedy(q, epsilon=0.1)
# specify how to update q-function
qlearning = coax.td_learning.QLearning(q, optimizer=optax.adam(0.001))
# specify how to trace the transitions
cache = coax.reward_tracing.NStep(n=1, gamma=0.9)
for ep in range(100):
pi.epsilon = ... # exploration schedule
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# add transition to cache
cache.add(s, a, r, done)
# update
while cache:
transition_batch = cache.pop()
metrics = qlearning.update(transition_batch)
env.record_metrics(metrics)
if done or truncated:
break
s = s_next
| 1,468 | 22.693548 | 92 | py |
null | coax-main/doc/examples/stubs/reinforce.py | import gymnasium
import coax
import optax
import haiku as hk
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_pi(S, is_training):
# custom haiku function (for discrete actions in this example)
logits = hk.Sequential([...])
return {'logits': logits(S)} # logits shape: (batch_size, num_actions)
# function approximator
pi = coax.Policy(func_pi, env)
# specify how to update policy and value function
vanilla_pg = coax.policy_objectives.VanillaPG(pi, optimizer=optax.adam(0.001))
# specify how to trace the transitions
tracer = coax.reward_tracing.MonteCarlo(gamma=0.9)
for ep in range(100):
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a, logp = pi(s, return_logp=True)
s_next, r, done, truncated, info = env.step(a)
# trace rewards to create training data
# N.B. vanilla-pg doesn't use logp but we include it to make it easy to
# swap in another policy updater that does require it, e.g. ppo-clip
tracer.add(s, a, r, done or truncated, logp)
# update
while tracer:
transition_batch = tracer.pop()
Gn = transition_batch.Rn # 'Rn' is full return 'Gn' in MC-cache
metrics = vanilla_pg.update(transition_batch, Adv=Gn)
env.record_metrics(metrics)
if done or truncated:
break
s = s_next
| 1,425 | 25.90566 | 79 | py |
null | coax-main/doc/examples/stubs/sarsa.py | import gymnasium
import coax
import optax
import haiku as hk
import jax
import jax.numpy as jnp
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_type1(S, A, is_training):
# custom haiku function: s,a -> q(s,a)
value = hk.Sequential([...])
X = jax.vmap(jnp.kron)(S, A) # or jnp.concatenate((S, A), axis=-1) or whatever you like
return value(X) # output shape: (batch_size,)
def func_type2(S, is_training):
# custom haiku function: s -> q(s,.)
value = hk.Sequential([...])
return value(S) # output shape: (batch_size, num_actions)
# function approximator
func = ... # func_type1 or func_type2
q = coax.Q(func, env)
pi = coax.EpsilonGreedy(q, epsilon=0.1)
# specify how to update q-function
sarsa = coax.td_learning.Sarsa(q, optimizer=optax.adam(0.001))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=1, gamma=0.9)
for ep in range(100):
pi.epsilon = ... # exploration schedule
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# trace rewards to create training data
tracer.add(s, a, r, done)
# update
while tracer:
transition_batch = tracer.pop()
metrics = sarsa.update(transition_batch)
env.record_metrics(metrics)
if done or truncated:
break
s = s_next
| 1,474 | 22.790323 | 92 | py |
null | coax-main/doc/examples/stubs/soft_qlearning.py | import gymnasium
import coax
import haiku as hk
import jax
import jax.numpy as jnp
from optax import adam
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_type1(S, A, is_training):
# custom haiku function: s,a -> q(s,a)
value = hk.Sequential([...])
X = jax.vmap(jnp.kron)(S, A) # or jnp.concatenate((S, A), axis=-1) or whatever you like
return value(X) # output shape: (batch_size,)
def func_type2(S, is_training):
# custom haiku function: s -> q(s,.)
value = hk.Sequential([...])
return value(S) # output shape: (batch_size, num_actions)
# function approximator
func = ... # func_type1 or func_type2
q = coax.Q(func, env)
pi = coax.BoltzmannPolicy(q, temperature=0.1)
# specify how to update q-function
qlearning = coax.td_learning.SoftQLearning(q, optimizer=adam(0.001), temperature=pi.temperature)
# specify how to trace the transitions
cache = coax.reward_tracing.NStep(n=1, gamma=0.9)
for ep in range(100):
pi.epsilon = ... # exploration schedule
s, info = env.reset()
for t in range(env.spec.max_episode_steps):
a = pi(s)
s_next, r, done, truncated, info = env.step(a)
# add transition to cache
cache.add(s, a, r, done)
# update
while cache:
transition_batch = cache.pop()
metrics = qlearning.update(transition_batch)
env.record_metrics(metrics)
if done or truncated:
break
s = s_next
| 1,510 | 23.370968 | 96 | py |
null | coax-main/doc/examples/stubs/td3.py | import gymnasium
import coax
import jax
import jax.numpy as jnp
import haiku as hk
import optax
# pick environment
env = gymnasium.make(...)
env = coax.wrappers.TrainMonitor(env)
def func_pi(S, is_training):
# custom haiku function (for continuous actions in this example)
mu = hk.Sequential([...])(S) # mu.shape: (batch_size, *action_space.shape)
return {'mu': mu, 'logvar': jnp.full_like(mu, -10)} # deterministic policy
def func_q(S, A, is_training):
# custom haiku function
value = hk.Sequential([...])
return value(S) # output shape: (batch_size,)
# define function approximator
pi = coax.Policy(func_pi, env)
q1 = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
q2 = coax.Q(func_q, env, action_preprocessor=pi.proba_dist.preprocess_variate)
# target networks
pi_targ = pi.copy()
q1_targ = q1.copy()
q2_targ = q2.copy()
# specify how to update policy and value function
determ_pg = coax.policy_objectives.DeterministicPG(pi, q1, optimizer=optax.adam(0.001))
qlearning1 = coax.td_learning.ClippedDoubleQLearning(
q1, q_targ_list=[q1_targ, q2_targ], optimizer=optax.adam(0.001))
qlearning2 = coax.td_learning.ClippedDoubleQLearning(
q2, q_targ_list=[q1_targ, q2_targ], optimizer=optax.adam(0.001))
# specify how to trace the transitions
tracer = coax.reward_tracing.NStep(n=1, gamma=0.9)
buffer = coax.experience_replay.SimpleReplayBuffer(capacity=1000000)
# action noise
noise = coax.utils.OrnsteinUhlenbeckNoise(mu=0., sigma=0.2, theta=0.15)
for ep in range(100):
s, info = env.reset()
noise.reset()
noise.sigma *= 0.99 # slowly decrease noise scale
for t in range(env.spec.max_episode_steps):
a = noise(pi(s))
s_next, r, done, truncated, info = env.step(a)
# add transition to buffer
tracer.add(s, a, r, done)
while tracer:
buffer.add(tracer.pop())
# update
if len(buffer) >= 128:
transition_batch = buffer.sample(batch_size=32)
# flip a coin to decide which of the q-functions to update
qlearning = qlearning1 if jax.random.bernoulli(q1.rng) else qlearning2
metrics = qlearning.update(transition_batch)
env.record_metrics(metrics)
# delay policy updates
if env.T % 2 == 0:
metrics = determ_pg.update(transition_batch)
env.record_metrics(metrics)
# sync target models
pi_targ.soft_update(pi, tau=0.01)
q1_targ.soft_update(q1, tau=0.01)
q2_targ.soft_update(q2, tau=0.01)
if done or truncated:
break
s = s_next
| 2,679 | 28.130435 | 87 | py |
null | hspo-ontology-main/CODE_OF_CONDUCT.md | # Contributor Covenant Code of Conduct
This project's Code of Conduct is based on the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).
For any questions please contact one of our maintainers listed in the [MAINTAINERS.md](MAINTAINERS.md) page.
| 401 | 49.25 | 143 | md |
null | hspo-ontology-main/CONTRIBUTING.md | ## Contributing
We need your help to continue to develop this project!
This project welcomes contributions from anyone interested in one or more areas covered by the HSPO ontology (e.g. healthcare, social care) or anyone interested in methods that can leverage the ontology (e.g. knowledge graphs, graph embeddings).
We are currently in the process of writing the guidelines for new contributions and will be updating this page with more information soon. In the meantime, if you'd like to get involved please e-mail one of the maintainers listed in the [MAINTAINERS.md](MAINTAINERS.md) page.
| 597 | 65.444444 | 275 | md |
null | hspo-ontology-main/MAINTAINERS.md | # MAINTAINERS
- Joao Bettencourt - [@bettenj](https://github.com/bettenj)
- Natasha Mulligan - [@natasha-mulligan](https://github.ibm.com/natasha-mulligan)
Maintainers can be contacted at [[email protected]](mailto:[email protected]). | 248 | 40.5 | 90 | md |
null | hspo-ontology-main/README.md | <img width="373" alt="image" src="docs/img/hspo-logo.png">
# Health & Social Person-centric Ontology (HSPO)
[](ontology/hspo.ttl)
[](https://ibm.github.io/hspo-ontology/ontology-specification/)
[](https://ibm.github.io/hspo-ontology/ontology-specification/webvowl/index.html#)
[](LICENSE)
[](https://ibm.github.io/hspo-ontology/)
*Representing a 360-view of a person (or cohort) that spans across multiple domains, from health to social.*
The HSPO is an ontology that aims to represent and link together information about an individual from multiple domains. This work is motivated by the need to better understand the drivers of health outcomes that may arise from other domains including, but not limited to, the social determinants of health (e.g. ethnicity, transportation, education). This ontology can also describe a group of individuals that share similar characteristics (i.e. a cohort). Through this ontology we attempt to define a number of social contexts or social domains which can be useful to organise information coming from different terminologies such as ICD and SNOMED.
The ontology can be used to generate person-centered or cohort-centered knowledge graphs (i.e. instances of the ontology) and support predictive analytics and other inference tasks in healthcare, life sciences, clinical research and social care use cases. For more uses and how-to's please see the [user guide](https://ibm.github.io/hspo-ontology/).
## Quick links
- [User Guide and Examples](https://ibm.github.io/hspo-ontology/)
- [Visualize with WebVOWL](https://ibm.github.io/hspo-ontology/ontology-specification/webvowl/index.html#)
- [Ontology Specification](https://ibm.github.io/hspo-ontology/ontology-specification/)
- [How to Contribute](CONTRIBUTING.md)
- [Github repository](https://github.com/IBM/hspo-ontology)
## Getting Started
The HSPO ontology can be used to create a knowledge graph (KG) of an individual person. Below is a fictitious example of a Person KG created from their electronic health records (EHRs). In this example, the person graph represents information about a patient's hospital episode after their were discharged. The patient is a 52 year-old female diagnosed with acute kidney failure. Demographic characteristics such as race, ethnicity and religion are included. Any medical interventions recorded during her hospital stay are also included in the graph, e.g. the use of critical care services. Social context factors recorded in her EHR indicate that she lives alone. Social context factors are important to consider particularly if they present barriers to follow-up treatment, for example, if the patient requires regular trips back to the hospital for dialysis. Bringing different facets together (e.g. clinical, social, behavioral) can allow physicians and care workers to better plan around the patient's needs in order to ensure better health outcomes (e.g. no further hospital readmissions). This example illustrates how, when available, information regarding the social context or social barriers for an individual can be brought together with their clinical information. Graphs can be created for all individuals attending critical care services and this ontology helps to query the information contained in those graphs (e.g. what are the social facets seen in patients attending these services or seen in specific ethnic groups). Further details about examples of how this representation is achieved and downstream KGs usage are included in the [user guide](https://ibm.github.io/hspo-ontology/).
<img width="1140" src="docs/img/hspo-sam-main-example.png">
Figure 1. Example of an individual patient knowledge graph derived from the HSPO ontology.
## Help and Support
Please feel free to reach out to one of the maintainers listed in the [MAINTAINERS.md](MAINTAINERS.md) page.
## Contributing
We are always looking for help and support to continue to develop this project. Please see our [guidance](CONTRIBUTING.md) for details on how to contribute.
## Citing this Project
If you use the HSPO Ontology or code, please consider citing:
```bib
@software{HSPO,
author = {HSPO Team},
month = {9},
title = {{Health and Social Person-centric Ontology}},
url = {https://github.com/IBM/hspo-ontology},
version = {main},
year = {2022}
}
```
## License
The HSPO project is under the Apache 2.0 license. Please [see details here](LICENSE).
| 4,739 | 79.338983 | 1,704 | md |
null | hspo-ontology-main/mkdocs.yml | # Health & Social Person-centric Ontology (HSPO)
site_name: Health & Social Person-centric Ontology (HSPO) User Guide
site_description: Representing a 360-view of a person (or cohort) that spans across multiple domains, from health to social.
#Repository
repo_name: Dublin-Research-Lab/hspo-ontology
repo_url: https://github.ibm.com/Dublin-Research-Lab/hspo-ontology
edit_uri: ''
nav:
- Overview: index.md
- Classes: classes.md
- Building Knowledge Graphs: building-kgs-hspo.md
- Ontology Specification: "ontology-specification/"
#Theme
theme:
name: material
features:
- navigation.top
- navigation.tracking
- toc.follow
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
primary: black
accent: purple
toggle:
icon: material/weather-night
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: black
accent: lime
toggle:
icon: material/weather-sunny
name: Switch to light mode
icon:
repo: fontawesome/brands/github-alt
language: en
markdown_extensions:
- attr_list
- def_list
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
#Plugins
plugins:
- search
#Extensions
#markdown_extensions:
#- toc:
# permalink: true
#- admonition
#- extra
#- attr_list
#- md_in_html
#Customization
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.ibm.com/Dublin-Research-Lab/hspo-ontology
# Copyright
copyright: Copyright © 2022 <strong>IBM</strong> Research Europe
| 1,676 | 21.972603 | 124 | yml |
null | hspo-ontology-main/docs/building-kgs-hspo.md | Coming soon... | 14 | 14 | 14 | md |
null | hspo-ontology-main/docs/classes.md | # Classes
:construction: Documentation under construction.
<br/>Please see the [Ontology Specification](ontology-specification/) for further technical details.
The central point of a graph is a person (Class: Person) and has the following facets (ontology classes):
- [Disease](#disease)
- [Social Context](#social-context)
- [Behavior](#behavior)
- [Intervention](#intervention)
- [Demographics](#demographics)
- Age
- Gender
- Race & Ethnicity
- Marital Status
- Religion
- Location
- [Evidence](#evidence)
HSPO classes will continue to be reviewed and extended in the future.
### Disease
HSPO uses the [Experimental Factor Ontology (EFO)](https://www.ebi.ac.uk/ols/ontologies/efo) for diagnosis definition. Diagnoses are defined by the Disease class.
The EFO ontology includes links to other terminologies and classification systems as exemplified in Figure 1.
<img width="300" src="../img/hspo-sam-example-disease.png">
Figure 1. Example of adding a disease to patient Sam.
### Social Context
The HSPO defines 11 different social context domains:
| Social Context | Description |
| ----------- | ----------- |
| Built Environment | The location surrounding an individual including neighborhood. |
| Educational | The educational attainment and literacy of an individual. |
| Employment | The labor context of an individual including unemployment. |
| Financial | The financial context of an individual including economic stability, material hardship and medical cost burden. |
| Food Security | The context in which an individual consumes or has access to food including nutritious or fresh foods and food poverty. |
| Health and Welfare System | The context and environment in which healthcare or social welfare are provided including access to services. |
| Housing | The physical environment context in which an individual finds shelter and/or resides. |
| Judicial | The judicial context of an individual including imprisonment, involvement in legal actions or jury duty. |
| Political | The political and government context of an individual including political affiliations and distrust in government institutions. |
| Interpersonal, Social and Community Environment | The social environment context of an individual including interpersonal relationships, community and culture. |
| Transportation | The context in which an individual requires to travel between locations including commuting. |
The above social context domains were derived based on definitions of the social determinants of health from the following sources:
- [HL7 Gravity Project](https://confluence.hl7.org/display/GRAV/Terminology+Workstream+Dashboard)
- [WHO Social Determinants of Health](https://www.who.int/health-topics/social-determinants-of-health)
- [Healthy People 2030](https://health.gov/healthypeople/priority-areas/social-determinants-health)
- [ICD-11 Factors influencing health status or contact with health services](https://icd.who.int/browse11/l-m/en#/http%3a%2f%2fid.who.int%2ficd%2fentity%2f1249056269)
- [ICD-10 Z Codes](https://icd.who.int/browse10/2019/en#/XXI)
### Behavior
:construction: Work in progress.
### Intervention
HSPO defines the class intervention as a way to represent both social or clinical intervention including medical procedures, medication provision, social programs, etc.
#### Intervention Types
The intervention types used in the HSPO ontology are defined by the [HL7 Gravity Project Interventions Framework](https://confluence.hl7.org/display/GRAV) which includes 8 different intervention types ([see example for Food Insecurity domain](https://confluence.hl7.org/display/GRAV/Food+Insecurity)).
### Demographics
The following demographics facets (classes) are included in this ontology:
- Age
- Gender
- Race & Ethnicity
- Marital Status
- Religion
- Location
### Evidence
:construction: Work in progress.
| 4,005 | 46.690476 | 301 | md |
null | hspo-ontology-main/docs/index.md |
<img width="173" alt="image" src="img/hspo-logo.png">
# Documentation & User Guide
[](https://pages.github.ibm.com/Dublin-Research-Lab/hspo-ontology/ontology.ttl)
[](ontology-specification/)
[](https://pages.github.ibm.com/Dublin-Research-Lab/hspo-ontology/ontology-specification/webvowl/index.html#)
[](LICENSE)
[](https://pages.github.ibm.com/Dublin-Research-Lab/hspo-ontology/)
:construction: Documentation under construction.
<br/>Please see the [Ontology Specification](ontology-specification/) for further technical details.
# Overview
HSPO is an ontology that aims to build a holistic view centered around the individual and spans across their multiple facets (e.g. clinical, social, behavior). This ontology allows users to:
- Create star-shaped person-centered knowledge graphs which can then be, for example, translated into graph embeddings and used for downstream prediction or inference tasks
- Lift data from transactional records (e.g. Electronic Health Records) into a graph representation (e.g. represent a patient's hospital admission)
- Create a cohort of interest (e.g. group of patients in a clinical trial sharing similar characteristics)
- Mapping between existing terminologies and standards (e.g. UMLS, ICD)
- Annotation of unstructured data written in natural language
The ontology also defines the notion of evidence (e.g. information or knowledge extracted from research publications, statistical models, etc) which, in turn, enables graph completion. For example, the graph of an individual patient may be completed with information extracted from external sources of evidence (e.g. a research paper) and accompanied by a confidence score.
In the next chapter we will cover the available [Ontology classes](classes.md).
| 2,104 | 76.962963 | 373 | md |
null | hspo-ontology-main/docs/ontology-specification/406.html | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head>
<body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource could not be found on this server.</p>
Available variants:<ul><li><a href="index-en.html">html</a></li><li><a href="ontology.jsonld">JSON-LD</a></li><li><a href="ontology.rdf">RDF/XML</a></li><li><a href="ontology.nt">N-Triples</a></li><li><a href="ontology.ttl">TTL</a></li></ul>
</body></html> | 493 | 48.4 | 242 | html |
null | hspo-ontology-main/docs/ontology-specification/index.html | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="resources/primer.css" media="screen" /> <link rel="stylesheet" href="resources/rec.css" media="screen" /> <link rel="stylesheet" href="resources/extra.css" media="screen" /> <link rel="stylesheet" href="resources/owl.css" media="screen" /> <title>Health and Social Person-centric Ontology (HSPO)</title>
<!-- SCHEMA.ORG METADATA -->
<script type="application/ld+json">{"@context":"https://schema.org","@type":"TechArticle","url":"http://research.ibm.com/ontologies/hspo/","image":"http://vowl.visualdataweb.org/webvowl/#iri=http://research.ibm.com/ontologies/hspo/","name":"Health and Social Person-centric Ontology (HSPO)", "headline":"The Health and Social Person-centric Ontology (HSPO) describes a schema for specifying evidences about a person in a consistent way. The model allows but not limited to specify evidence, interventions and outcomes in health and social care domains.", "datePublished":"2023-02-15", "version":"0.0.19", "author":[{"@type":"Person","name":"IBM Research Europe"}]}</script>
<script src="resources/jquery.js"></script>
<script src="resources/marked.min.js"></script>
<script>
function loadHash() {
jQuery(".markdown").each(function(el){jQuery(this).after(marked(jQuery(this).text())).remove()});
var hash = location.hash;
if($(hash).offset()!=null){
$('html, body').animate({scrollTop: $(hash).offset().top}, 0);
}
loadTOC();
}
function loadTOC(){
//process toc dynamically
var t='<h2>Table of contents</h2><ul>';i = 1;j=0;
jQuery(".list").each(function(){
if(jQuery(this).is('h2')){
if(j>0){
t+='</ul>';
j=0;
}
t+= '<li>'+i+'. <a href=#'+ jQuery(this).attr('id')+'>'+ jQuery(this).ignore("span").text()+'</a></li>';
i++;
}
if(jQuery(this).is('h3')){
if(j==0){
t+='<ul>';
}
j++;
t+= '<li>'+(i-1)+'.'+j+'. '+'<a href=#'+ jQuery(this).attr('id')+'>'+ jQuery(this).ignore("span").text()+'</a></li>';
}
});
t+='</ul>';
$("#toc").html(t);
}
$(function(){
loadHash();
}); $.fn.ignore = function(sel){
return this.clone().find(sel||">*").remove().end();
};
</script>
</head>
<body>
<div class="container">
<div class="head">
<div style="float:right">language <a href="index.html"><b>en</b></a> </div>
<h1>Health and Social Person-centric Ontology (HSPO)</h1>
<h2>Release 2023-02-15</h2>
<dl>
<dt>Latest version:</dt>
<dd><a href="http://research.ibm.com/ontologies/hspo/">http://research.ibm.com/ontologies/hspo/</a></dd>
<dt>Revision:</dt>
<dd>0.0.19</dd>
<dt>Authors:</dt>
<dd>IBM Research Europe</dd>
<dt>Publisher:</dt>
<dd>IBM</dd>
<dt>Download serialization:</dt><dd><span><a href="ontology.jsonld" target="_blank"><img src="https://img.shields.io/badge/Format-JSON_LD-blue.svg" alt="JSON-LD" /></a> </span><span><a href="ontology.rdf" target="_blank"><img src="https://img.shields.io/badge/Format-RDF/XML-blue.svg" alt="RDF/XML" /></a> </span><span><a href="ontology.nt" target="_blank"><img src="https://img.shields.io/badge/Format-N_Triples-blue.svg" alt="N-Triples" /></a> </span><span><a href="ontology.ttl" target="_blank"><img src="https://img.shields.io/badge/Format-TTL-blue.svg" alt="TTL" /></a> </span></dd><dt>License:</dt><dd><img src="https://img.shields.io/badge/License-Apache_2.0-green.svg" alt="Apache 2.0">
</dd><dt>Visualization:</dt><dd><a href="webvowl/index.html#" target="_blank"><img src="https://img.shields.io/badge/Visualize_with-WebVowl-blue.svg" alt="Visualize with WebVowl" /></a></dd>
<!-- <dt>Evaluation:</dt><dd><a href="OOPSEvaluation/oopsEval.html#" target="_blank"><img src="https://img.shields.io/badge/Evaluate_with-OOPS! (OntOlogy Pitfall Scanner!)-blue.svg" alt="Evaluate with OOPS!" /></a></dd> --><dt>Cite as:</dt>
<dd>IBM Research Europe. Health and Social Person-centric Ontology (HSPO). Revision: 0.0.19.</dd>
</dl>
<hr/>
</div>
<div class="status">
<div>
<span>Ontology Specification Draft</span>
</div>
</div> <div id="abstract"><h2>Abstract</h2><span class="markdown">
The Health and Social Person-centric Ontology (HSPO) describes a schema for specifying evidences about a person in a consistent way.
The model allows but not limited to specify evidence, interventions and outcomes in health and social care domains.</span>
</div>
<div id="toc"></div>
<!--INTRODUCTION SECTION-->
<div id="introduction"><h2 id="intro" class="list">Introduction <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
<span class="markdown">
Please see the HSPO documentation and user guide for further information here:
<a href="https://ibm.github.io/hspo-ontology/">https://ibm.github.io/hspo-ontology</a>.</span>
<div id="namespacedeclarations">
<h3 id="ns" class="list">Namespace declarations</h3>
<div id="ns" align="center">
<table>
<caption> <a href="#ns"> Table 1</a>: Namespaces used in the document </caption>
<tbody>
<tr><td><b>[Ontology NS Prefix]</b></td><td><http://research.ibm.com/ontologies/hspo/></td></tr>
<tr><td></td><td></td></tr>
<tr><td><b>owl</b></td><td><http://www.w3.org/2002/07/owl></td></tr>
<tr><td><b>rdf</b></td><td><http://www.w3.org/1999/02/22-rdf-syntax-ns></td></tr>
<tr><td><b>terms</b></td><td><http://purl.org/dc/terms></td></tr>
<tr><td><b>oboInOwl</b></td><td><http://www.geneontology.org/formats/oboInOwl></td></tr>
<tr><td><b>xml</b></td><td><http://www.w3.org/XML/1998/namespace></td></tr>
<tr><td><b>xsd</b></td><td><http://www.w3.org/2001/XMLSchema></td></tr>
<tr><td><b>skos</b></td><td><http://www.w3.org/2004/02/skos/core></td></tr>
<tr><td><b>rdfs</b></td><td><http://www.w3.org/2000/01/rdf-schema></td></tr>
<tr><td><b>prov</b></td><td><http://www.w3.org/ns/prov></td></tr>
<tr><td><b>dc</b></td><td><http://purl.org/dc/elements/1.1></td></tr>
<tr><td><b>efo</b></td><td><http://www.ebi.ac.uk/efo></td></tr>
</tbody>
</table>
</div>
</div>
</div>
<!--OVERVIEW SECTION-->
<div id="overview"><h2 id="overv" class="list">Health and Social Person-centric Ontology (HSPO): Overview <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
<span class="markdown">
This ontology has the following classes and properties.</span>
<h4>Classes</h4>
<ul xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" class="hlist">
<li>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
</li>
<li>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
</li>
<li>
<a href="#AlignmentScore"
title="http://research.ibm.com/ontologies/hspo/AlignmentScore">Alignment Score</a>
</li>
<li>
<a href="#Behaviour"
title="http://research.ibm.com/ontologies/hspo/Behaviour">Behaviour</a>
</li>
<li>
<a href="#BuiltEnvironment"
title="http://research.ibm.com/ontologies/hspo/BuiltEnvironment">Built Environment</a>
</li>
<li>
<a href="#ConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/ConfidenceScore">Confidence Score</a>
</li>
<li>
<a href="#DatasourceTrustScore"
title="http://research.ibm.com/ontologies/hspo/DatasourceTrustScore">Datasource Trust Score</a>
</li>
<li>
<a href="#Disease" title="http://research.ibm.com/ontologies/hspo/Disease">Disease</a>
</li>
<li>
<a href="#Duration"
title="http://research.ibm.com/ontologies/hspo/Duration">Duration</a>
</li>
<li>
<a href="#Educational"
title="http://research.ibm.com/ontologies/hspo/Educational">Educational</a>
</li>
<li>
<a href="#Employment"
title="http://research.ibm.com/ontologies/hspo/Employment">Employment</a>
</li>
<li>
<a href="#Evidence"
title="http://research.ibm.com/ontologies/hspo/Evidence">Evidence</a>
</li>
<li>
<a href="#EvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/EvidenceGraph">Evidence Graph</a>
</li>
<li>
<a href="#EvidenceSource"
title="http://research.ibm.com/ontologies/hspo/EvidenceSource">Evidence Source</a>
</li>
<li>
<a href="#Financial"
title="http://research.ibm.com/ontologies/hspo/Financial">Financial</a>
</li>
<li>
<a href="#Food" title="http://research.ibm.com/ontologies/hspo/Food">Food Security</a>
</li>
<li>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
</li>
<li>
<a href="#HealthAndWelfare"
title="http://research.ibm.com/ontologies/hspo/HealthAndWelfare">Health and Welfare System</a>
</li>
<li>
<a href="#Homelessness"
title="http://research.ibm.com/ontologies/hspo/Homelessness">Homelessness</a>
</li>
<li>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
</li>
<li>
<a href="#HouseholdCrowding"
title="http://research.ibm.com/ontologies/hspo/HouseholdCrowding">Household Crowding</a>
</li>
<li>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
</li>
<li>
<a href="#HousingStability"
title="http://research.ibm.com/ontologies/hspo/HousingStability">Housing Stability</a>
</li>
<li>
<a href="#InterpersonalSocialAndCommunityEnvironment"
title="http://research.ibm.com/ontologies/hspo/InterpersonalSocialAndCommunityEnvironment">Interpersonal, Social and Community Environment</a>
</li>
<li>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
</li>
<li>
<a href="#InterventionByAssessment"
title="http://research.ibm.com/ontologies/hspo/InterventionByAssessment">Intervention by Assessment</a>
</li>
<li>
<a href="#InterventionByAssistance"
title="http://research.ibm.com/ontologies/hspo/InterventionByAssistance">Intervention by Assistance</a>
</li>
<li>
<a href="#InterventionByCoordination"
title="http://research.ibm.com/ontologies/hspo/InterventionByCoordination">Intervention by Coordination</a>
</li>
<li>
<a href="#InterventionByCounseling"
title="http://research.ibm.com/ontologies/hspo/InterventionByCounseling">Intervention by Counseling</a>
</li>
<li>
<a href="#InterventionByEducation"
title="http://research.ibm.com/ontologies/hspo/InterventionByEducation">Intervention by Education</a>
</li>
<li>
<a href="#InterventionByEvaluationOfEligibility"
title="http://research.ibm.com/ontologies/hspo/InterventionByEvaluationOfEligibility">Intervention by Evaluation of Eligibility</a>
</li>
<li>
<a href="#InterventionByProvisioning"
title="http://research.ibm.com/ontologies/hspo/InterventionByProvisioning">Intervention by Provisioning</a>
</li>
<li>
<a href="#InterventionByReffering"
title="http://research.ibm.com/ontologies/hspo/InterventionByReffering">Intervention by Referral</a>
</li>
<li>
<a href="#InterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcome">Intervention Outcome</a>
</li>
<li>
<a href="#InterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeMetric">Intervention Outcome Metric</a>
</li>
<li>
<a href="#InterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeResult">Intervention Outcome Result</a>
</li>
<li>
<a href="#InterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeType">Intervention Outcome Type</a>
</li>
<li>
<a href="#InterventionProvider"
title="http://research.ibm.com/ontologies/hspo/InterventionProvider">Intervention Provider</a>
</li>
<li>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
</li>
<li>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
</li>
<li>
<a href="#Judicial"
title="http://research.ibm.com/ontologies/hspo/Judicial">Judicial</a>
</li>
<li>
<a href="#LivingConditions"
title="http://research.ibm.com/ontologies/hspo/LivingConditions">Living Conditions</a>
</li>
<li>
<a href="#Location"
title="http://research.ibm.com/ontologies/hspo/Location">Location</a>
</li>
<li>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
</li>
<li>
<a href="#OriginalProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/OriginalProbabilityScore">Original Probability Score</a>
</li>
<li>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
</li>
<li>
<a href="#Political"
title="http://research.ibm.com/ontologies/hspo/Political">Political</a>
</li>
<li>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
</li>
<li>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
</li>
<li>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
</li>
<li>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
</li>
<li>
<a href="#Transportation"
title="http://research.ibm.com/ontologies/hspo/Transportation">Transportation</a>
</li>
<li>
<a href="#HousingProblemUnspecified"
title="http://research.ibm.com/ontologies/hspo/HousingProblemUnspecified">Unspecified Housing Problem</a>
</li>
</ul><h4>Object Properties</h4><ul xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" class="hlist">
<li>
<a href="#belongsToAgeGroup"
title="http://research.ibm.com/ontologies/hspo/belongsToAgeGroup">belongsToAgeGroup</a>
</li>
<li>
<a href="#followsReligion"
title="http://research.ibm.com/ontologies/hspo/followsReligion">followsReligion</a>
</li>
<li>
<a href="#hasAge" title="http://research.ibm.com/ontologies/hspo/hasAge">hasAge</a>
</li>
<li>
<a href="#hasAlignmentScore"
title="http://research.ibm.com/ontologies/hspo/hasAlignmentScore">hasAlignmentScore</a>
</li>
<li>
<a href="#hasBehaviour"
title="http://research.ibm.com/ontologies/hspo/hasBehaviour">hasBehaviour</a>
</li>
<li>
<a href="#hasConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/hasConfidenceScore">hasConfidenceScore</a>
</li>
<li>
<a href="#hasDisease"
title="http://research.ibm.com/ontologies/hspo/hasDisease">hasDisease</a>
</li>
<li>
<a href="#hasDuration"
title="http://research.ibm.com/ontologies/hspo/hasDuration">hasDuration</a>
</li>
<li>
<a href="#hasEvidence"
title="http://research.ibm.com/ontologies/hspo/hasEvidence">hasEvidence</a>
</li>
<li>
<a href="#hasEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceGraph">hasEvidenceGraph</a>
</li>
<li>
<a href="#hasEvidenceSource"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceSource">hasEvidenceSource</a>
</li>
<li>
<a href="#hasGender"
title="http://research.ibm.com/ontologies/hspo/hasGender">hasGender</a>
</li>
<li>
<a href="#hasIntervention"
title="http://research.ibm.com/ontologies/hspo/hasIntervention">hasIntervention</a>
</li>
<li>
<a href="#hasInterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcome">hasInterventionOutcome</a>
</li>
<li>
<a href="#hasInterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeMetric">hasInterventionOutcomeMetric</a>
</li>
<li>
<a href="#hasInterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeResult">hasInterventionOutcomeResult</a>
</li>
<li>
<a href="#hasInterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeType">hasInterventionOutcomeType</a>
</li>
<li>
<a href="#hasInterventionProvider"
title="http://research.ibm.com/ontologies/hspo/hasInterventionProvider">hasInterventionProvider</a>
</li>
<li>
<a href="#hasInterventionStatus"
title="http://research.ibm.com/ontologies/hspo/hasInterventionStatus">hasInterventionStatus</a>
</li>
<li>
<a href="#hasInterventionType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionType">hasInterventionType</a>
</li>
<li>
<a href="#hasMaritalStatus"
title="http://research.ibm.com/ontologies/hspo/hasMaritalStatus">hasMaritalStatus</a>
</li>
<li>
<a href="#hasProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/hasProbabilityScore">hasProbabilityScore</a>
</li>
<li>
<a href="#hasRaceOrEthnicity"
title="http://research.ibm.com/ontologies/hspo/hasRaceOrEthnicity">hasRaceOrEthnicity</a>
</li>
<li>
<a href="#hasSocialContext"
title="http://research.ibm.com/ontologies/hspo/hasSocialContext">hasSocialContext</a>
</li>
<li>
<a href="#hasStageOfLife"
title="http://research.ibm.com/ontologies/hspo/hasStageOfLife">hasStageOfLife</a>
</li>
<li>
<a href="#hasTrustScore"
title="http://research.ibm.com/ontologies/hspo/hasTrustScore">hasTrustScore</a>
</li>
<li>
<a href="#isPartOfEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/isPartOfEvidenceGraph">isPartOfEvidenceGraph</a>
</li>
<li>
<a href="#lives" title="http://research.ibm.com/ontologies/hspo/lives">lives</a>
</li>
</ul><h4>Data Properties</h4><ul xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" class="hlist">
<li>
<a href="#age_in_years"
title="http://research.ibm.com/ontologies/hspo/age_in_years">Age in years</a>
</li>
<li>
<a href="#alignment_score_value"
title="http://research.ibm.com/ontologies/hspo/alignment_score_value">Alignment score value</a>
</li>
<li>
<a href="#source_ID"
title="http://research.ibm.com/ontologies/hspo/source_ID">Datasource ID</a>
</li>
<li>
<a href="#intervention_code"
title="http://research.ibm.com/ontologies/hspo/intervention_code">Intervention code</a>
</li>
<li>
<a href="#intervention_code_system"
title="http://research.ibm.com/ontologies/hspo/intervention_code_system">Intervention code system</a>
</li>
<li>
<a href="#intervention_name"
title="http://research.ibm.com/ontologies/hspo/intervention_name">Intervention name</a>
</li>
<li>
<a href="#number_in_household"
title="http://research.ibm.com/ontologies/hspo/number_in_household">Number in household</a>
</li>
<li>
<a href="#person_id"
title="http://research.ibm.com/ontologies/hspo/person_id">Person ID</a>
</li>
<li>
<a href="#positivity_indicator"
title="http://research.ibm.com/ontologies/hspo/positivity_indicator">Positivity indicator</a>
</li>
<li>
<a href="#probability_score_metric"
title="http://research.ibm.com/ontologies/hspo/probability_score_metric">Probability score metric</a>
</li>
<li>
<a href="#probability_score_value"
title="http://research.ibm.com/ontologies/hspo/probability_score_value">Probability score value</a>
</li>
<li>
<a href="#trust_score"
title="http://research.ibm.com/ontologies/hspo/trust_score">Trust score</a>
</li>
</ul><h4>Annotation Properties</h4><ul xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" class="hlist">
<li>
<a href="#http://purl.org/dc/elements/1.1/abstract" title="http://purl.org/dc/elements/1.1/abstract">
<span>abstract</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2004/02/skos/core#broader" title="http://www.w3.org/2004/02/skos/core#broader">
<span>broader</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2002/07/owl#cardinality" title="http://www.w3.org/2002/07/owl#cardinality">
<span>cardinality</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/created" title="http://purl.org/dc/elements/1.1/created">
<span>created</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/terms/created" title="http://purl.org/dc/terms/created">
<span>created</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/creator" title="http://purl.org/dc/elements/1.1/creator">
<span>creator</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/description" title="http://purl.org/dc/elements/1.1/description">
<span>description</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2000/01/rdf-schema#displayName" title="http://www.w3.org/2000/01/rdf-schema#displayName">
<span>display name</span>
</a>
</li>
<li>
<a href="#http://www.geneontology.org/formats/oboInOwl#hasDbXref"
title="http://www.geneontology.org/formats/oboInOwl#hasDbXref">hasMapping</a>
</li>
<li>
<a href="#icd10Code" title="http://research.ibm.com/ontologies/hspo/icd10Code">
<span>icd10 code</span>
</a>
</li>
<li>
<a href="#icd9Code" title="http://research.ibm.com/ontologies/hspo/icd9Code">
<span>icd9 code</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/modified" title="http://purl.org/dc/elements/1.1/modified">
<span>modified</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/terms/modified" title="http://purl.org/dc/terms/modified">
<span>modified</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2004/02/skos/core#narrower" title="http://www.w3.org/2004/02/skos/core#narrower">
<span>narrower</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/publisher" title="http://purl.org/dc/elements/1.1/publisher">
<span>publisher</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"
title="http://www.w3.org/1999/02/22-rdf-syntax-ns#resource">
<span>resource</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/source" title="http://purl.org/dc/elements/1.1/source">
<span>source</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/title" title="http://purl.org/dc/elements/1.1/title">
<span>title</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/terms/title" title="http://purl.org/dc/terms/title">
<span>title</span>
</a>
</li>
<li>
<a href="#umlsCui" title="http://research.ibm.com/ontologies/hspo/umlsCui">
<span>umls cui</span>
</a>
</li>
</ul><h4>Named Individuals</h4><ul xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" class="hlist">
<li>
<a href="#ten_to_fourteen"
title="http://research.ibm.com/ontologies/hspo/ten_to_fourteen">10 to 14</a>
</li>
<li>
<a href="#fifteen_to_nineteen"
title="http://research.ibm.com/ontologies/hspo/fifteen_to_nineteen">15 to 19</a>
</li>
<li>
<a href="#twenty_to_twentyfour"
title="http://research.ibm.com/ontologies/hspo/twenty_to_twentyfour">20 to 24</a>
</li>
<li>
<a href="#twentyfive_to_twentynine"
title="http://research.ibm.com/ontologies/hspo/twentyfive_to_twentynine">25 to 29</a>
</li>
<li>
<a href="#thirty_to_thirtyfour"
title="http://research.ibm.com/ontologies/hspo/thirty_to_thirtyfour">30 to 34</a>
</li>
<li>
<a href="#thirtyfive_to_thirtynine"
title="http://research.ibm.com/ontologies/hspo/thirtyfive_to_thirtynine">35 to 39</a>
</li>
<li>
<a href="#forty_to_fortyfour"
title="http://research.ibm.com/ontologies/hspo/forty_to_fortyfour">40 to 44</a>
</li>
<li>
<a href="#fortyfive_to_fortynine"
title="http://research.ibm.com/ontologies/hspo/fortyfive_to_fortynine">45 to 49</a>
</li>
<li>
<a href="#five_to_nine"
title="http://research.ibm.com/ontologies/hspo/five_to_nine">5 to 9</a>
</li>
<li>
<a href="#fifty_to_fiftyfour"
title="http://research.ibm.com/ontologies/hspo/fifty_to_fiftyfour">50 to 54</a>
</li>
<li>
<a href="#fiftyfive_to_fiftynine"
title="http://research.ibm.com/ontologies/hspo/fiftyfive_to_fiftynine">55 to 59</a>
</li>
<li>
<a href="#sixty_to_sixtyfour"
title="http://research.ibm.com/ontologies/hspo/sixty_to_sixtyfour">60 to 64</a>
</li>
<li>
<a href="#sixtyfive_to_sixtynine"
title="http://research.ibm.com/ontologies/hspo/sixtyfive_to_sixtynine">65 to 69</a>
</li>
<li>
<a href="#seventy_to_seventyfour"
title="http://research.ibm.com/ontologies/hspo/seventy_to_seventyfour">70 to 74</a>
</li>
<li>
<a href="#seventyfive_to_seventynine"
title="http://research.ibm.com/ontologies/hspo/seventyfive_to_seventynine">75 to 79</a>
</li>
<li>
<a href="#eighty_to_eightyfour"
title="http://research.ibm.com/ontologies/hspo/eighty_to_eightyfour">80 to 84</a>
</li>
<li>
<a href="#eightyfive_and_over"
title="http://research.ibm.com/ontologies/hspo/eightyfive_and_over">85 and over</a>
</li>
<li>
<a href="#adult" title="http://research.ibm.com/ontologies/hspo/adult">Adult</a>
</li>
<li>
<a href="#african_race"
title="http://research.ibm.com/ontologies/hspo/african_race">African race</a>
</li>
<li>
<a href="#agnosticism"
title="http://research.ibm.com/ontologies/hspo/agnosticism">Agnosticism</a>
</li>
<li>
<a href="#american_indian_or_alaska_native"
title="http://research.ibm.com/ontologies/hspo/american_indian_or_alaska_native">American Indian or Alaska native</a>
</li>
<li>
<a href="#applied_intervention"
title="http://research.ibm.com/ontologies/hspo/applied_intervention">Applied intervention</a>
</li>
<li>
<a href="#asian_or_pacific_islander"
title="http://research.ibm.com/ontologies/hspo/asian_or_pacific_islander">Asian or Pacific islander</a>
</li>
<li>
<a href="#atheism" title="http://research.ibm.com/ontologies/hspo/atheism">Atheism</a>
</li>
<li>
<a href="#australian_aborigine"
title="http://research.ibm.com/ontologies/hspo/australian_aborigine">Australian aborigine</a>
</li>
<li>
<a href="#available_intervention"
title="http://research.ibm.com/ontologies/hspo/available_intervention">Available intervention</a>
</li>
<li>
<a href="#bachelor"
title="http://research.ibm.com/ontologies/hspo/bachelor">Bachelor</a>
</li>
<li>
<a href="#bahai" title="http://research.ibm.com/ontologies/hspo/bahai">Baha'i Faith</a>
</li>
<li>
<a href="#broken_engagement"
title="http://research.ibm.com/ontologies/hspo/broken_engagement">Broken engagement</a>
</li>
<li>
<a href="#broken_with_partner"
title="http://research.ibm.com/ontologies/hspo/broken_with_partner">Broken with partner</a>
</li>
<li>
<a href="#buddhism"
title="http://research.ibm.com/ontologies/hspo/buddhism">Buddhism</a>
</li>
<li>
<a href="#mahayana"
title="http://research.ibm.com/ontologies/hspo/mahayana">Buddhism: Mahayana</a>
</li>
<li>
<a href="#buddhism_other"
title="http://research.ibm.com/ontologies/hspo/buddhism_other">Buddhism: Other</a>
</li>
<li>
<a href="#tantrayana"
title="http://research.ibm.com/ontologies/hspo/tantrayana">Buddhism: Tantrayana</a>
</li>
<li>
<a href="#theravada"
title="http://research.ibm.com/ontologies/hspo/theravada">Buddhism: Theravada</a>
</li>
<li>
<a href="#caucasian"
title="http://research.ibm.com/ontologies/hspo/caucasian">Caucasian</a>
</li>
<li>
<a href="#child" title="http://research.ibm.com/ontologies/hspo/child">Child</a>
</li>
<li>
<a href="#child_lives_with_unrelated_adult"
title="http://research.ibm.com/ontologies/hspo/child_lives_with_unrelated_adult">Child lives with unrelated adult</a>
</li>
<li>
<a href="#chinese_folk_religion"
title="http://research.ibm.com/ontologies/hspo/chinese_folk_religion">Chinese Folk Religion</a>
</li>
<li>
<a href="#christian"
title="http://research.ibm.com/ontologies/hspo/christian">Christian</a>
</li>
<li>
<a href="#african_methodist_episcopal"
title="http://research.ibm.com/ontologies/hspo/african_methodist_episcopal">Christian: African Methodist Episcopal</a>
</li>
<li>
<a href="#african_methodist_episcopal_zion"
title="http://research.ibm.com/ontologies/hspo/african_methodist_episcopal_zion">Christian: African Methodist Episcopal Zion</a>
</li>
<li>
<a href="#american_baptist_church"
title="http://research.ibm.com/ontologies/hspo/american_baptist_church">Christian: American Baptist Church</a>
</li>
<li>
<a href="#anglican"
title="http://research.ibm.com/ontologies/hspo/anglican">Christian: Anglican</a>
</li>
<li>
<a href="#assembly_of_god"
title="http://research.ibm.com/ontologies/hspo/assembly_of_god">Christian: Assembly of God</a>
</li>
<li>
<a href="#aptist_church"
title="http://research.ibm.com/ontologies/hspo/aptist_church">Christian: Baptist Church</a>
</li>
<li>
<a href="#christian_missionary_alliance"
title="http://research.ibm.com/ontologies/hspo/christian_missionary_alliance">Christian: Christian Missionary Alliance</a>
</li>
<li>
<a href="#christian_reformed"
title="http://research.ibm.com/ontologies/hspo/christian_reformed">Christian: Christian Reformed</a>
</li>
<li>
<a href="#christian_science"
title="http://research.ibm.com/ontologies/hspo/christian_science">Christian: Christian Science Church</a>
</li>
<li>
<a href="#church_of_christ"
title="http://research.ibm.com/ontologies/hspo/church_of_christ">Christian: Church of Christ</a>
</li>
<li>
<a href="#church_of_god"
title="http://research.ibm.com/ontologies/hspo/church_of_god">Christian: Church of God</a>
</li>
<li>
<a href="#church_of_god_in_christ"
title="http://research.ibm.com/ontologies/hspo/church_of_god_in_christ">Christian: Church of God in Christ</a>
</li>
<li>
<a href="#church_of_the_nazarene"
title="http://research.ibm.com/ontologies/hspo/church_of_the_nazarene">Christian: Church of the Nazarene</a>
</li>
<li>
<a href="#community_church"
title="http://research.ibm.com/ontologies/hspo/community_church">Christian: Community Church</a>
</li>
<li>
<a href="#congregational_church"
title="http://research.ibm.com/ontologies/hspo/congregational_church">Christian: Congregational</a>
</li>
<li>
<a href="#eastern_orthodox"
title="http://research.ibm.com/ontologies/hspo/eastern_orthodox">Christian: Eastern Orthodox</a>
</li>
<li>
<a href="#episcopalian"
title="http://research.ibm.com/ontologies/hspo/episcopalian">Christian: Episcopalian</a>
</li>
<li>
<a href="#evangelical_church"
title="http://research.ibm.com/ontologies/hspo/evangelical_church">Christian: Evangelical Church</a>
</li>
<li>
<a href="#free_will_baptist"
title="http://research.ibm.com/ontologies/hspo/free_will_baptist">Christian: Free Will Baptist</a>
</li>
<li>
<a href="#friends_church"
title="http://research.ibm.com/ontologies/hspo/friends_church">Christian: Friends Church or Quakers</a>
</li>
<li>
<a href="#greek_orthodox"
title="http://research.ibm.com/ontologies/hspo/greek_orthodox">Christian: Greek Orthodox</a>
</li>
<li>
<a href="#jehovahs_witness"
title="http://research.ibm.com/ontologies/hspo/jehovahs_witness">Christian: Jehovahs Witness</a>
</li>
<li>
<a href="#latter_day_saints_church"
title="http://research.ibm.com/ontologies/hspo/latter_day_saints_church">Christian: Latter-day Saints</a>
</li>
<li>
<a href="#lutheran"
title="http://research.ibm.com/ontologies/hspo/lutheran">Christian: Lutheran</a>
</li>
<li>
<a href="#lutheran_missouri_synod"
title="http://research.ibm.com/ontologies/hspo/lutheran_missouri_synod">Christian: Lutheran Missouri Synod</a>
</li>
<li>
<a href="#mennonite"
title="http://research.ibm.com/ontologies/hspo/mennonite">Christian: Mennonite</a>
</li>
<li>
<a href="#methodist"
title="http://research.ibm.com/ontologies/hspo/methodist">Christian: Methodist</a>
</li>
<li>
<a href="#orthodox"
title="http://research.ibm.com/ontologies/hspo/orthodox">Christian: Orthodox</a>
</li>
<li>
<a href="#christian_other"
title="http://research.ibm.com/ontologies/hspo/christian_other">Christian: Other</a>
</li>
<li>
<a href="#other_pentecostal"
title="http://research.ibm.com/ontologies/hspo/other_pentecostal">Christian: Other Pentecostal</a>
</li>
<li>
<a href="#other_protestant"
title="http://research.ibm.com/ontologies/hspo/other_protestant">Christian: Other Protestant</a>
</li>
<li>
<a href="#pentecostal"
title="http://research.ibm.com/ontologies/hspo/pentecostal">Christian: Pentecostal</a>
</li>
<li>
<a href="#presbyterian"
title="http://research.ibm.com/ontologies/hspo/presbyterian">Christian: Presbyterian</a>
</li>
<li>
<a href="#protestant"
title="http://research.ibm.com/ontologies/hspo/protestant">Christian: Protestant</a>
</li>
<li>
<a href="#reformed_church"
title="http://research.ibm.com/ontologies/hspo/reformed_church">Christian: Reformed Church</a>
</li>
<li>
<a href="#rlds" title="http://research.ibm.com/ontologies/hspo/rlds">Christian: Reorganized Church of Jesus Christ of LDS</a>
</li>
<li>
<a href="#roman_catholic"
title="http://research.ibm.com/ontologies/hspo/roman_catholic">Christian: Roman Catholic</a>
</li>
<li>
<a href="#salvation_army"
title="http://research.ibm.com/ontologies/hspo/salvation_army">Christian: Salvation Army</a>
</li>
<li>
<a href="#seventh_day_adventist"
title="http://research.ibm.com/ontologies/hspo/seventh_day_adventist">Christian: Seventh Day Adventist</a>
</li>
<li>
<a href="#southern_baptist"
title="http://research.ibm.com/ontologies/hspo/southern_baptist">Christian: Southern Baptist Convention</a>
</li>
<li>
<a href="#unitarian"
title="http://research.ibm.com/ontologies/hspo/unitarian">Christian: Unitarian</a>
</li>
<li>
<a href="#unitarian_universalism"
title="http://research.ibm.com/ontologies/hspo/unitarian_universalism">Christian: Unitarian Universalism</a>
</li>
<li>
<a href="#united_church_of_christ"
title="http://research.ibm.com/ontologies/hspo/united_church_of_christ">Christian: United Church of Christ</a>
</li>
<li>
<a href="#united_methodist"
title="http://research.ibm.com/ontologies/hspo/united_methodist">Christian: United Methodist</a>
</li>
<li>
<a href="#wesleyan"
title="http://research.ibm.com/ontologies/hspo/wesleyan">Christian: Wesleyan</a>
</li>
<li>
<a href="#cohabitee_left_home"
title="http://research.ibm.com/ontologies/hspo/cohabitee_left_home">Cohabitee left home</a>
</li>
<li>
<a href="#cohabiting"
title="http://research.ibm.com/ontologies/hspo/cohabiting">Cohabiting</a>
</li>
<li>
<a href="#common_law_partnership"
title="http://research.ibm.com/ontologies/hspo/common_law_partnership">Common law partnership</a>
</li>
<li>
<a href="#confucianism"
title="http://research.ibm.com/ontologies/hspo/confucianism">Confucianism</a>
</li>
<li>
<a href="#divorced"
title="http://research.ibm.com/ontologies/hspo/divorced">Divorced</a>
</li>
<li>
<a href="#divorced_couple_sharing_house"
title="http://research.ibm.com/ontologies/hspo/divorced_couple_sharing_house">Divorced couple sharing house</a>
</li>
<li>
<a href="#domestic_partnership"
title="http://research.ibm.com/ontologies/hspo/domestic_partnership">Domestic partnership</a>
</li>
<li>
<a href="#elderly_relative_lives_with_family"
title="http://research.ibm.com/ontologies/hspo/elderly_relative_lives_with_family">Elderly relative lives with family</a>
</li>
<li>
<a href="#eloped" title="http://research.ibm.com/ontologies/hspo/eloped">Eloped</a>
</li>
<li>
<a href="#engaged_to_be_married"
title="http://research.ibm.com/ontologies/hspo/engaged_to_be_married">Engaged to be married</a>
</li>
<li>
<a href="#ethnic_religion"
title="http://research.ibm.com/ontologies/hspo/ethnic_religion">Ethnic Religion</a>
</li>
<li>
<a href="#feminine_gender"
title="http://research.ibm.com/ontologies/hspo/feminine_gender">Feminine gender</a>
</li>
<li>
<a href="#gender_unknown"
title="http://research.ibm.com/ontologies/hspo/gender_unknown">Gender unknown</a>
</li>
<li>
<a href="#gender_unspecified"
title="http://research.ibm.com/ontologies/hspo/gender_unspecified">Gender unspecified</a>
</li>
<li>
<a href="#hinduism"
title="http://research.ibm.com/ontologies/hspo/hinduism">Hinduism</a>
</li>
<li>
<a href="#hinduism_other"
title="http://research.ibm.com/ontologies/hspo/hinduism_other">Hinduism: Other</a>
</li>
<li>
<a href="#shaivism"
title="http://research.ibm.com/ontologies/hspo/shaivism">Hinduism: Shaivism</a>
</li>
<li>
<a href="#vaishnavism"
title="http://research.ibm.com/ontologies/hspo/vaishnavism">Hinduism: Vaishnavism</a>
</li>
<li>
<a href="#hispanic"
title="http://research.ibm.com/ontologies/hspo/hispanic">Hispanic</a>
</li>
<li>
<a href="#homosexual_marriage"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage">Homosexual marriage</a>
</li>
<li>
<a href="#homosexual_marriage_female"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage_female">Homosexual marriage, female</a>
</li>
<li>
<a href="#homosexual_marriage_male"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage_male">Homosexual marriage, male</a>
</li>
<li>
<a href="#husband_left_home"
title="http://research.ibm.com/ontologies/hspo/husband_left_home">Husband left home</a>
</li>
<li>
<a href="#indian" title="http://research.ibm.com/ontologies/hspo/indian">Indian</a>
</li>
<li>
<a href="#infant" title="http://research.ibm.com/ontologies/hspo/infant">Infant</a>
</li>
<li>
<a href="#medication_provisioning"
title="http://research.ibm.com/ontologies/hspo/medication_provisioning">Intervention by provisioning a medication</a>
</li>
<li>
<a href="#procedure_provisioning"
title="http://research.ibm.com/ontologies/hspo/procedure_provisioning">Intervention by provisioning a procedure</a>
</li>
<li>
<a href="#social_action_provisioning"
title="http://research.ibm.com/ontologies/hspo/social_action_provisioning">Intervention by provisioning a social action</a>
</li>
<li>
<a href="#jainism" title="http://research.ibm.com/ontologies/hspo/jainism">Jainism</a>
</li>
<li>
<a href="#judaism" title="http://research.ibm.com/ontologies/hspo/judaism">Judaism</a>
</li>
<li>
<a href="#conservative_judaism"
title="http://research.ibm.com/ontologies/hspo/conservative_judaism">Judaism: Conservative Judaism</a>
</li>
<li>
<a href="#jewish_renewal"
title="http://research.ibm.com/ontologies/hspo/jewish_renewal">Judaism: Jewish Renewal</a>
</li>
<li>
<a href="#orthodox_judaism"
title="http://research.ibm.com/ontologies/hspo/orthodox_judaism">Judaism: Orthodox Judaism</a>
</li>
<li>
<a href="#judaism_other"
title="http://research.ibm.com/ontologies/hspo/judaism_other">Judaism: Other</a>
</li>
<li>
<a href="#reconstructionist_judaism"
title="http://research.ibm.com/ontologies/hspo/reconstructionist_judaism">Judaism: Reconstructionist Judaism</a>
</li>
<li>
<a href="#reform_judaism"
title="http://research.ibm.com/ontologies/hspo/reform_judaism">Judaism: Reform Judaism</a>
</li>
<li>
<a href="#legally_separated_with_interlocutory_decree"
title="http://research.ibm.com/ontologies/hspo/legally_separated_with_interlocutory_decree">Legally separated with interlocutory decree</a>
</li>
<li>
<a href="#lives_alone"
title="http://research.ibm.com/ontologies/hspo/lives_alone">Lives alone</a>
</li>
<li>
<a href="#lives_alone_help_available"
title="http://research.ibm.com/ontologies/hspo/lives_alone_help_available">Lives alone, help available</a>
</li>
<li>
<a href="#lives_alone_needs_housekeeper"
title="http://research.ibm.com/ontologies/hspo/lives_alone_needs_housekeeper">Lives alone, needs housekeeper</a>
</li>
<li>
<a href="#lives_alone_no_help_available"
title="http://research.ibm.com/ontologies/hspo/lives_alone_no_help_available">Lives alone, no help available</a>
</li>
<li>
<a href="#lives_as_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_companion">Lives as companion</a>
</li>
<li>
<a href="#lives_as_paid_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_paid_companion">Lives as paid companion</a>
</li>
<li>
<a href="#lives_as_unpaid_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_unpaid_companion">Lives as unpaid companion</a>
</li>
<li>
<a href="#lives_in_a_commune"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_commune">Lives in a commune</a>
</li>
<li>
<a href="#lives_in_a_community"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_community">Lives in a community</a>
</li>
<li>
<a href="#lives_in_a_school_community"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_school_community">Lives in a school community</a>
</li>
<li>
<a href="#lives_in_boarding_school"
title="http://research.ibm.com/ontologies/hspo/lives_in_boarding_school">Lives in boarding school</a>
</li>
<li>
<a href="#lives_with_children"
title="http://research.ibm.com/ontologies/hspo/lives_with_children">Lives with children</a>
</li>
<li>
<a href="#lives_with_companion"
title="http://research.ibm.com/ontologies/hspo/lives_with_companion">Lives with companion</a>
</li>
<li>
<a href="#lives_with_daughter"
title="http://research.ibm.com/ontologies/hspo/lives_with_daughter">Lives with daughter</a>
</li>
<li>
<a href="#lives_with_family"
title="http://research.ibm.com/ontologies/hspo/lives_with_family">Lives with family</a>
</li>
<li>
<a href="#lives_with_father"
title="http://research.ibm.com/ontologies/hspo/lives_with_father">Lives with father</a>
</li>
<li>
<a href="#lives_with_friends"
title="http://research.ibm.com/ontologies/hspo/lives_with_friends">Lives with friends</a>
</li>
<li>
<a href="#lives_with_grandfather"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandfather">Lives with grandfather</a>
</li>
<li>
<a href="#lives_with_grandmother"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandmother">Lives with grandmother</a>
</li>
<li>
<a href="#lives_with_grandparents"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandparents">Lives with grandparents</a>
</li>
<li>
<a href="#lives_with_husband"
title="http://research.ibm.com/ontologies/hspo/lives_with_husband">Lives with husband</a>
</li>
<li>
<a href="#lives_with_lodger"
title="http://research.ibm.com/ontologies/hspo/lives_with_lodger">Lives with lodger</a>
</li>
<li>
<a href="#lives_with_mother"
title="http://research.ibm.com/ontologies/hspo/lives_with_mother">Lives with mother</a>
</li>
<li>
<a href="#lives_with_parents"
title="http://research.ibm.com/ontologies/hspo/lives_with_parents">Lives with parents</a>
</li>
<li>
<a href="#lives_with_partner"
title="http://research.ibm.com/ontologies/hspo/lives_with_partner">Lives with partner</a>
</li>
<li>
<a href="#lives_with_roommate"
title="http://research.ibm.com/ontologies/hspo/lives_with_roommate">Lives with roommate</a>
</li>
<li>
<a href="#lives_with_son"
title="http://research.ibm.com/ontologies/hspo/lives_with_son">Lives with son</a>
</li>
<li>
<a href="#lives_with_spouse"
title="http://research.ibm.com/ontologies/hspo/lives_with_spouse">Lives with spouse</a>
</li>
<li>
<a href="#lives_with_spouse_only"
title="http://research.ibm.com/ontologies/hspo/lives_with_spouse_only">Lives with spouse only</a>
</li>
<li>
<a href="#lives_with_wife"
title="http://research.ibm.com/ontologies/hspo/lives_with_wife">Lives with wife</a>
</li>
<li>
<a href="#living_temporarily_with_relatives"
title="http://research.ibm.com/ontologies/hspo/living_temporarily_with_relatives">Living temporarily with relatives</a>
</li>
<li>
<a href="#marital_state_unknown"
title="http://research.ibm.com/ontologies/hspo/marital_state_unknown">Marital state unknown</a>
</li>
<li>
<a href="#marriage_annulment"
title="http://research.ibm.com/ontologies/hspo/marriage_annulment">Marriage annulment</a>
</li>
<li>
<a href="#married" title="http://research.ibm.com/ontologies/hspo/married">Married</a>
</li>
<li>
<a href="#masculine_gender"
title="http://research.ibm.com/ontologies/hspo/masculine_gender">Masculine gender</a>
</li>
<li>
<a href="#middle_age_adult"
title="http://research.ibm.com/ontologies/hspo/middle_age_adult">Middle age adult</a>
</li>
<li>
<a href="#monogamous"
title="http://research.ibm.com/ontologies/hspo/monogamous">Monogamous</a>
</li>
<li>
<a href="#muslim" title="http://research.ibm.com/ontologies/hspo/muslim">Muslim</a>
</li>
<li>
<a href="#muslim_other"
title="http://research.ibm.com/ontologies/hspo/muslim_other">Muslim: Other</a>
</li>
<li>
<a href="#shia_islam"
title="http://research.ibm.com/ontologies/hspo/shia_islam">Muslim: Shia Islam</a>
</li>
<li>
<a href="#sunni_islam"
title="http://research.ibm.com/ontologies/hspo/sunni_islam">Muslim: Sunni Islam</a>
</li>
<li>
<a href="#native_american"
title="http://research.ibm.com/ontologies/hspo/native_american">Native American</a>
</li>
<li>
<a href="#new_religion"
title="http://research.ibm.com/ontologies/hspo/new_religion">New Religion Movement</a>
</li>
<li>
<a href="#newly_wed"
title="http://research.ibm.com/ontologies/hspo/newly_wed">Newly wed</a>
</li>
<li>
<a href="#nonreligious"
title="http://research.ibm.com/ontologies/hspo/nonreligious">Non religious</a>
</li>
<li>
<a href="#non_binary_gender"
title="http://research.ibm.com/ontologies/hspo/non_binary_gender">Non-binary gender</a>
</li>
<li>
<a href="#ongoing_intervention"
title="http://research.ibm.com/ontologies/hspo/ongoing_intervention">Ongoing intervention</a>
</li>
<li>
<a href="#other_religion"
title="http://research.ibm.com/ontologies/hspo/other_religion">Other religion</a>
</li>
<li>
<a href="#planned_intervention"
title="http://research.ibm.com/ontologies/hspo/planned_intervention">Planned intervention</a>
</li>
<li>
<a href="#polygamous"
title="http://research.ibm.com/ontologies/hspo/polygamous">Polygamous</a>
</li>
<li>
<a href="#purposely_unmarried_and_sexually_abstinent"
title="http://research.ibm.com/ontologies/hspo/purposely_unmarried_and_sexually_abstinent">Purposely unmarried and sexually abstinent</a>
</li>
<li>
<a href="#race_not_stated"
title="http://research.ibm.com/ontologies/hspo/race_not_stated">Race not stated</a>
</li>
<li>
<a href="#recommended_intervention"
title="http://research.ibm.com/ontologies/hspo/recommended_intervention">Recommended intervention</a>
</li>
<li>
<a href="#rejected_intervention"
title="http://research.ibm.com/ontologies/hspo/rejected_intervention">Rejected intervention</a>
</li>
<li>
<a href="#religion_unknown"
title="http://research.ibm.com/ontologies/hspo/religion_unknown">Religion is unknown</a>
</li>
<li>
<a href="#remarried"
title="http://research.ibm.com/ontologies/hspo/remarried">Remarried</a>
</li>
<li>
<a href="#senior_adult"
title="http://research.ibm.com/ontologies/hspo/senior_adult">Senior Adult</a>
</li>
<li>
<a href="#separated"
title="http://research.ibm.com/ontologies/hspo/separated">Separated</a>
</li>
<li>
<a href="#separated_from_cohabitee"
title="http://research.ibm.com/ontologies/hspo/separated_from_cohabitee">Separated from cohabitee</a>
</li>
<li>
<a href="#shinto" title="http://research.ibm.com/ontologies/hspo/shinto">Shinto or Shintoism</a>
</li>
<li>
<a href="#sikhism" title="http://research.ibm.com/ontologies/hspo/sikhism">Sikhism</a>
</li>
<li>
<a href="#single_person"
title="http://research.ibm.com/ontologies/hspo/single_person">Single person</a>
</li>
<li>
<a href="#single_never_married"
title="http://research.ibm.com/ontologies/hspo/single_never_married">Single, never married</a>
</li>
<li>
<a href="#spinster"
title="http://research.ibm.com/ontologies/hspo/spinster">Spinster</a>
</li>
<li>
<a href="#spiritualism"
title="http://research.ibm.com/ontologies/hspo/spiritualism">Spiritualism</a>
</li>
<li>
<a href="#spouse_left_home"
title="http://research.ibm.com/ontologies/hspo/spouse_left_home">Spouse left home</a>
</li>
<li>
<a href="#transgender_female_to_male"
title="http://research.ibm.com/ontologies/hspo/transgender_female_to_male">Surgically transgendered transsexual, female-to-male</a>
</li>
<li>
<a href="#transgender_male_to_female"
title="http://research.ibm.com/ontologies/hspo/transgender_male_to_female">Surgically transgendered transsexual, male-to-female</a>
</li>
<li>
<a href="#teen" title="http://research.ibm.com/ontologies/hspo/teen">Teenager</a>
</li>
<li>
<a href="#toddler" title="http://research.ibm.com/ontologies/hspo/toddler">Toddler</a>
</li>
<li>
<a href="#transgender"
title="http://research.ibm.com/ontologies/hspo/transgender">Transgender</a>
</li>
<li>
<a href="#trial_separation"
title="http://research.ibm.com/ontologies/hspo/trial_separation">Trial separation</a>
</li>
<li>
<a href="#under_five"
title="http://research.ibm.com/ontologies/hspo/under_five">Under 5</a>
</li>
<li>
<a href="#race_unknown"
title="http://research.ibm.com/ontologies/hspo/race_unknown">Unknown racial group</a>
</li>
<li>
<a href="#widow" title="http://research.ibm.com/ontologies/hspo/widow">Widow</a>
</li>
<li>
<a href="#widowed" title="http://research.ibm.com/ontologies/hspo/widowed">Widowed</a>
</li>
<li>
<a href="#widower" title="http://research.ibm.com/ontologies/hspo/widower">Widower</a>
</li>
<li>
<a href="#wife_left_home"
title="http://research.ibm.com/ontologies/hspo/wife_left_home">Wife left home</a>
</li>
</ul><iframe align="center" width="100%" height ="500px" src="webvowl/index.html"></iframe>
</div>
<!--DESCRIPTION SECTION-->
<div id="description"><h2 id="desc" class="list">Health and Social Person-centric Ontology (HSPO): Description <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
<span class="markdown">
This is a placeholder text for the description of your ontology. The description should include an explanation and a diagram explaining how the classes are related, examples of usage, etc.</span>
</div>
<!--CROSSREF SECTION-->
<div id="crossref"><h2 id="crossreference" class="list">Cross-reference for Health and Social Person-centric Ontology (HSPO) classes, object properties and data properties <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
This section provides details for each class and property defined by Health and Social Person-centric Ontology (HSPO).
<div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="classes">
<h3 id="classes-headline" class="list">Classes</h3>
<ul class="hlist">
<li>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
</li>
<li>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
</li>
<li>
<a href="#AlignmentScore"
title="http://research.ibm.com/ontologies/hspo/AlignmentScore">Alignment Score</a>
</li>
<li>
<a href="#Behaviour"
title="http://research.ibm.com/ontologies/hspo/Behaviour">Behaviour</a>
</li>
<li>
<a href="#BuiltEnvironment"
title="http://research.ibm.com/ontologies/hspo/BuiltEnvironment">Built Environment</a>
</li>
<li>
<a href="#ConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/ConfidenceScore">Confidence Score</a>
</li>
<li>
<a href="#DatasourceTrustScore"
title="http://research.ibm.com/ontologies/hspo/DatasourceTrustScore">Datasource Trust Score</a>
</li>
<li>
<a href="#Disease" title="http://research.ibm.com/ontologies/hspo/Disease">Disease</a>
</li>
<li>
<a href="#Duration"
title="http://research.ibm.com/ontologies/hspo/Duration">Duration</a>
</li>
<li>
<a href="#Educational"
title="http://research.ibm.com/ontologies/hspo/Educational">Educational</a>
</li>
<li>
<a href="#Employment"
title="http://research.ibm.com/ontologies/hspo/Employment">Employment</a>
</li>
<li>
<a href="#Evidence"
title="http://research.ibm.com/ontologies/hspo/Evidence">Evidence</a>
</li>
<li>
<a href="#EvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/EvidenceGraph">Evidence Graph</a>
</li>
<li>
<a href="#EvidenceSource"
title="http://research.ibm.com/ontologies/hspo/EvidenceSource">Evidence Source</a>
</li>
<li>
<a href="#Financial"
title="http://research.ibm.com/ontologies/hspo/Financial">Financial</a>
</li>
<li>
<a href="#Food" title="http://research.ibm.com/ontologies/hspo/Food">Food Security</a>
</li>
<li>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
</li>
<li>
<a href="#HealthAndWelfare"
title="http://research.ibm.com/ontologies/hspo/HealthAndWelfare">Health and Welfare System</a>
</li>
<li>
<a href="#Homelessness"
title="http://research.ibm.com/ontologies/hspo/Homelessness">Homelessness</a>
</li>
<li>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
</li>
<li>
<a href="#HouseholdCrowding"
title="http://research.ibm.com/ontologies/hspo/HouseholdCrowding">Household Crowding</a>
</li>
<li>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
</li>
<li>
<a href="#HousingStability"
title="http://research.ibm.com/ontologies/hspo/HousingStability">Housing Stability</a>
</li>
<li>
<a href="#InterpersonalSocialAndCommunityEnvironment"
title="http://research.ibm.com/ontologies/hspo/InterpersonalSocialAndCommunityEnvironment">Interpersonal, Social and Community Environment</a>
</li>
<li>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
</li>
<li>
<a href="#InterventionByAssessment"
title="http://research.ibm.com/ontologies/hspo/InterventionByAssessment">Intervention by Assessment</a>
</li>
<li>
<a href="#InterventionByAssistance"
title="http://research.ibm.com/ontologies/hspo/InterventionByAssistance">Intervention by Assistance</a>
</li>
<li>
<a href="#InterventionByCoordination"
title="http://research.ibm.com/ontologies/hspo/InterventionByCoordination">Intervention by Coordination</a>
</li>
<li>
<a href="#InterventionByCounseling"
title="http://research.ibm.com/ontologies/hspo/InterventionByCounseling">Intervention by Counseling</a>
</li>
<li>
<a href="#InterventionByEducation"
title="http://research.ibm.com/ontologies/hspo/InterventionByEducation">Intervention by Education</a>
</li>
<li>
<a href="#InterventionByEvaluationOfEligibility"
title="http://research.ibm.com/ontologies/hspo/InterventionByEvaluationOfEligibility">Intervention by Evaluation of Eligibility</a>
</li>
<li>
<a href="#InterventionByProvisioning"
title="http://research.ibm.com/ontologies/hspo/InterventionByProvisioning">Intervention by Provisioning</a>
</li>
<li>
<a href="#InterventionByReffering"
title="http://research.ibm.com/ontologies/hspo/InterventionByReffering">Intervention by Referral</a>
</li>
<li>
<a href="#InterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcome">Intervention Outcome</a>
</li>
<li>
<a href="#InterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeMetric">Intervention Outcome Metric</a>
</li>
<li>
<a href="#InterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeResult">Intervention Outcome Result</a>
</li>
<li>
<a href="#InterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeType">Intervention Outcome Type</a>
</li>
<li>
<a href="#InterventionProvider"
title="http://research.ibm.com/ontologies/hspo/InterventionProvider">Intervention Provider</a>
</li>
<li>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
</li>
<li>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
</li>
<li>
<a href="#Judicial"
title="http://research.ibm.com/ontologies/hspo/Judicial">Judicial</a>
</li>
<li>
<a href="#LivingConditions"
title="http://research.ibm.com/ontologies/hspo/LivingConditions">Living Conditions</a>
</li>
<li>
<a href="#Location"
title="http://research.ibm.com/ontologies/hspo/Location">Location</a>
</li>
<li>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
</li>
<li>
<a href="#OriginalProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/OriginalProbabilityScore">Original Probability Score</a>
</li>
<li>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
</li>
<li>
<a href="#Political"
title="http://research.ibm.com/ontologies/hspo/Political">Political</a>
</li>
<li>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
</li>
<li>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
</li>
<li>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
</li>
<li>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
</li>
<li>
<a href="#Transportation"
title="http://research.ibm.com/ontologies/hspo/Transportation">Transportation</a>
</li>
<li>
<a href="#HousingProblemUnspecified"
title="http://research.ibm.com/ontologies/hspo/HousingProblemUnspecified">Unspecified Housing Problem</a>
</li>
</ul>
<div class="entity" id="Age">
<h3>Age<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Age</p>
<div class="comment">
<span class="markdown">The age of a person</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#age_in_years"
title="http://research.ibm.com/ontologies/hspo/age_in_years">Age in years</a>
<sup class="type-dp" title="data property">dp</sup>, <a href="#belongsToAgeGroup"
title="http://research.ibm.com/ontologies/hspo/belongsToAgeGroup">belongsToAgeGroup</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasStageOfLife"
title="http://research.ibm.com/ontologies/hspo/hasStageOfLife">hasStageOfLife</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasAge" title="http://research.ibm.com/ontologies/hspo/hasAge">hasAge</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="AgeGroup">
<h3>Age group<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/AgeGroup</p>
<div class="comment">
<span class="markdown">The age group the person belongs to</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#belongsToAgeGroup"
title="http://research.ibm.com/ontologies/hspo/belongsToAgeGroup">belongsToAgeGroup</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#ten_to_fourteen"
title="http://research.ibm.com/ontologies/hspo/ten_to_fourteen">10 to 14</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#fifteen_to_nineteen"
title="http://research.ibm.com/ontologies/hspo/fifteen_to_nineteen">15 to 19</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#twenty_to_twentyfour"
title="http://research.ibm.com/ontologies/hspo/twenty_to_twentyfour">20 to 24</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#twentyfive_to_twentynine"
title="http://research.ibm.com/ontologies/hspo/twentyfive_to_twentynine">25 to 29</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#thirty_to_thirtyfour"
title="http://research.ibm.com/ontologies/hspo/thirty_to_thirtyfour">30 to 34</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#thirtyfive_to_thirtynine"
title="http://research.ibm.com/ontologies/hspo/thirtyfive_to_thirtynine">35 to 39</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#forty_to_fortyfour"
title="http://research.ibm.com/ontologies/hspo/forty_to_fortyfour">40 to 44</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#fortyfive_to_fortynine"
title="http://research.ibm.com/ontologies/hspo/fortyfive_to_fortynine">45 to 49</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#five_to_nine"
title="http://research.ibm.com/ontologies/hspo/five_to_nine">5 to 9</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#fifty_to_fiftyfour"
title="http://research.ibm.com/ontologies/hspo/fifty_to_fiftyfour">50 to 54</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#fiftyfive_to_fiftynine"
title="http://research.ibm.com/ontologies/hspo/fiftyfive_to_fiftynine">55 to 59</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#sixty_to_sixtyfour"
title="http://research.ibm.com/ontologies/hspo/sixty_to_sixtyfour">60 to 64</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#sixtyfive_to_sixtynine"
title="http://research.ibm.com/ontologies/hspo/sixtyfive_to_sixtynine">65 to 69</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#seventy_to_seventyfour"
title="http://research.ibm.com/ontologies/hspo/seventy_to_seventyfour">70 to 74</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#seventyfive_to_seventynine"
title="http://research.ibm.com/ontologies/hspo/seventyfive_to_seventynine">75 to 79</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#eighty_to_eightyfour"
title="http://research.ibm.com/ontologies/hspo/eighty_to_eightyfour">80 to 84</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#eightyfive_and_over"
title="http://research.ibm.com/ontologies/hspo/eightyfive_and_over">85 and over</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#under_five"
title="http://research.ibm.com/ontologies/hspo/under_five">Under 5</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="AlignmentScore">
<h3>Alignment Score<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/AlignmentScore</p>
<div class="comment">
<span class="markdown">Alignment proximity score between the nodes of Evidence and Person Graphs</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#alignment_score_value"
title="http://research.ibm.com/ontologies/hspo/alignment_score_value">Alignment score value</a>
<sup class="type-dp" title="data property">dp</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasAlignmentScore"
title="http://research.ibm.com/ontologies/hspo/hasAlignmentScore">hasAlignmentScore</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Behaviour">
<h3>Behaviour<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Behaviour</p>
<div class="comment">
<span class="markdown">Human behaviour, e.g. diet, smoking, exercising, sleep, etc.</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasBehaviour"
title="http://research.ibm.com/ontologies/hspo/hasBehaviour">hasBehaviour</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="BuiltEnvironment">
<h3>Built Environment<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/BuiltEnvironment</p>
<div class="comment">
<span class="markdown">The location surrounding an individual including neighborhood.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="ConfidenceScore">
<h3>Confidence Score<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/ConfidenceScore</p>
<div class="comment">
<span class="markdown">Confidence score includes alignment accuracy, probablity of an event and datasource trust score</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#hasAlignmentScore"
title="http://research.ibm.com/ontologies/hspo/hasAlignmentScore">hasAlignmentScore</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/hasProbabilityScore">hasProbabilityScore</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasTrustScore"
title="http://research.ibm.com/ontologies/hspo/hasTrustScore">hasTrustScore</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/hasConfidenceScore">hasConfidenceScore</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="DatasourceTrustScore">
<h3>Datasource Trust Score<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/DatasourceTrustScore</p>
<div class="comment">
<span class="markdown">Datasource trust score</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#trust_score"
title="http://research.ibm.com/ontologies/hspo/trust_score">Trust score</a>
<sup class="type-dp" title="data property">dp</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasTrustScore"
title="http://research.ibm.com/ontologies/hspo/hasTrustScore">hasTrustScore</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Disease">
<h3>Disease<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Disease</p>
<dl class="description">
<dt>is equivalent to</dt>
<dd>
<a href="http://www.ebi.ac.uk/efo/EFO_0000408"
target="_blank"
title="http://www.ebi.ac.uk/efo/EFO_0000408">e f o 0000408</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasDisease"
title="http://research.ibm.com/ontologies/hspo/hasDisease">hasDisease</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Duration">
<h3>Duration<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Duration</p>
<div class="comment">
<span class="markdown">Duration of some action</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasDuration"
title="http://research.ibm.com/ontologies/hspo/hasDuration">hasDuration</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Educational">
<h3>Educational<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Educational</p>
<div class="comment">
<span class="markdown">The educational attainment and literacy of an individual.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Employment">
<h3>Employment<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Employment</p>
<div class="comment">
<span class="markdown">The labor context of an individual including unemployment.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Evidence">
<h3>Evidence<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Evidence</p>
<div class="comment">
<span class="markdown">Knowledge evidence</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="http://www.w3.org/ns/prov#Entity"
target="_blank"
title="http://www.w3.org/ns/prov#Entity">entity</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in domain of</dt>
<dd>
<a href="#hasConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/hasConfidenceScore">hasConfidenceScore</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceGraph">hasEvidenceGraph</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasEvidenceSource"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceSource">hasEvidenceSource</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasEvidence"
title="http://research.ibm.com/ontologies/hspo/hasEvidence">hasEvidence</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="EvidenceGraph">
<h3>Evidence Graph<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/EvidenceGraph</p>
<div class="comment">
<span class="markdown">The subgraph extracted from the source of evidences, for example using SPARQL CONSTRUCT query.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="http://www.w3.org/ns/prov#Activity"
target="_blank"
title="http://www.w3.org/ns/prov#Activity">activity</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in domain of</dt>
<dd>
<a href="#isPartOfEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/isPartOfEvidenceGraph">isPartOfEvidenceGraph</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceGraph">hasEvidenceGraph</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="EvidenceSource">
<h3>Evidence Source<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/EvidenceSource</p>
<div class="comment">
<span class="markdown">The source of the evidence</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="http://www.w3.org/ns/prov#Entity"
target="_blank"
title="http://www.w3.org/ns/prov#Entity">entity</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in domain of</dt>
<dd>
<a href="#source_ID"
title="http://research.ibm.com/ontologies/hspo/source_ID">Datasource ID</a>
<sup class="type-dp" title="data property">dp</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasEvidenceSource"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceSource">hasEvidenceSource</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Financial">
<h3>Financial<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Financial</p>
<div class="comment">
<span class="markdown">The financial context of an individual including economic stability, material hardship and medical cost burden.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Food">
<h3>Food Security<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Food</p>
<div class="comment">
<span class="markdown">The context in which an individual consumes or has access to food including nutritious or fresh foods and food poverty. </span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Gender">
<h3>Gender<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Gender</p>
<div class="comment">
<span class="markdown">The gender of a person</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasGender"
title="http://research.ibm.com/ontologies/hspo/hasGender">hasGender</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#feminine_gender"
title="http://research.ibm.com/ontologies/hspo/feminine_gender">Feminine gender</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#gender_unknown"
title="http://research.ibm.com/ontologies/hspo/gender_unknown">Gender unknown</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#gender_unspecified"
title="http://research.ibm.com/ontologies/hspo/gender_unspecified">Gender unspecified</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#masculine_gender"
title="http://research.ibm.com/ontologies/hspo/masculine_gender">Masculine gender</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#non_binary_gender"
title="http://research.ibm.com/ontologies/hspo/non_binary_gender">Non-binary gender</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#transgender_female_to_male"
title="http://research.ibm.com/ontologies/hspo/transgender_female_to_male">Surgically transgendered transsexual, female-to-male</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#transgender_male_to_female"
title="http://research.ibm.com/ontologies/hspo/transgender_male_to_female">Surgically transgendered transsexual, male-to-female</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#transgender"
title="http://research.ibm.com/ontologies/hspo/transgender">Transgender</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="HealthAndWelfare">
<h3>Health and Welfare System<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/HealthAndWelfare</p>
<div class="comment">
<span class="markdown">The context and environment in which healthcare or social welfare are provided including access to services.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Homelessness">
<h3>Homelessness<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Homelessness</p>
<div class="comment">
<span class="markdown">Housing Subategory: Homelessness</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Household">
<h3>Household Composition<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Household</p>
<div class="comment">
<span class="markdown">The household composition</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterpersonalSocialAndCommunityEnvironment"
title="http://research.ibm.com/ontologies/hspo/InterpersonalSocialAndCommunityEnvironment">Interpersonal, Social and Community Environment</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in domain of</dt>
<dd>
<a href="#number_in_household"
title="http://research.ibm.com/ontologies/hspo/number_in_household">Number in household</a>
<sup class="type-dp" title="data property">dp</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#child_lives_with_unrelated_adult"
title="http://research.ibm.com/ontologies/hspo/child_lives_with_unrelated_adult">Child lives with unrelated adult</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#divorced_couple_sharing_house"
title="http://research.ibm.com/ontologies/hspo/divorced_couple_sharing_house">Divorced couple sharing house</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#elderly_relative_lives_with_family"
title="http://research.ibm.com/ontologies/hspo/elderly_relative_lives_with_family">Elderly relative lives with family</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_alone"
title="http://research.ibm.com/ontologies/hspo/lives_alone">Lives alone</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_alone_help_available"
title="http://research.ibm.com/ontologies/hspo/lives_alone_help_available">Lives alone, help available</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_alone_needs_housekeeper"
title="http://research.ibm.com/ontologies/hspo/lives_alone_needs_housekeeper">Lives alone, needs housekeeper</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_alone_no_help_available"
title="http://research.ibm.com/ontologies/hspo/lives_alone_no_help_available">Lives alone, no help available</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_as_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_companion">Lives as companion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_as_paid_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_paid_companion">Lives as paid companion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_as_unpaid_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_unpaid_companion">Lives as unpaid companion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_in_a_commune"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_commune">Lives in a commune</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_in_a_community"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_community">Lives in a community</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_in_a_school_community"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_school_community">Lives in a school community</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_in_boarding_school"
title="http://research.ibm.com/ontologies/hspo/lives_in_boarding_school">Lives in boarding school</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_children"
title="http://research.ibm.com/ontologies/hspo/lives_with_children">Lives with children</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_companion"
title="http://research.ibm.com/ontologies/hspo/lives_with_companion">Lives with companion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_daughter"
title="http://research.ibm.com/ontologies/hspo/lives_with_daughter">Lives with daughter</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_family"
title="http://research.ibm.com/ontologies/hspo/lives_with_family">Lives with family</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_father"
title="http://research.ibm.com/ontologies/hspo/lives_with_father">Lives with father</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_friends"
title="http://research.ibm.com/ontologies/hspo/lives_with_friends">Lives with friends</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_grandfather"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandfather">Lives with grandfather</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_grandmother"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandmother">Lives with grandmother</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_grandparents"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandparents">Lives with grandparents</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_husband"
title="http://research.ibm.com/ontologies/hspo/lives_with_husband">Lives with husband</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_lodger"
title="http://research.ibm.com/ontologies/hspo/lives_with_lodger">Lives with lodger</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_mother"
title="http://research.ibm.com/ontologies/hspo/lives_with_mother">Lives with mother</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_parents"
title="http://research.ibm.com/ontologies/hspo/lives_with_parents">Lives with parents</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_partner"
title="http://research.ibm.com/ontologies/hspo/lives_with_partner">Lives with partner</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_roommate"
title="http://research.ibm.com/ontologies/hspo/lives_with_roommate">Lives with roommate</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_son"
title="http://research.ibm.com/ontologies/hspo/lives_with_son">Lives with son</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_spouse"
title="http://research.ibm.com/ontologies/hspo/lives_with_spouse">Lives with spouse</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_spouse_only"
title="http://research.ibm.com/ontologies/hspo/lives_with_spouse_only">Lives with spouse only</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lives_with_wife"
title="http://research.ibm.com/ontologies/hspo/lives_with_wife">Lives with wife</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#living_temporarily_with_relatives"
title="http://research.ibm.com/ontologies/hspo/living_temporarily_with_relatives">Living temporarily with relatives</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="HouseholdCrowding">
<h3>Household Crowding<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/HouseholdCrowding</p>
<div class="comment">
<span class="markdown">Housing Subategory: Household space and crowding</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Housing">
<h3>Housing<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Housing</p>
<div class="comment">
<span class="markdown">The physical environment context in which an individual finds shelter and/or resides, including access to computer.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has sub-classes</dt>
<dd>
<a href="#Homelessness"
title="http://research.ibm.com/ontologies/hspo/Homelessness">Homelessness</a>
<sup class="type-c" title="class">c</sup>, <a href="#HouseholdCrowding"
title="http://research.ibm.com/ontologies/hspo/HouseholdCrowding">Household Crowding</a>
<sup class="type-c" title="class">c</sup>, <a href="#HousingStability"
title="http://research.ibm.com/ontologies/hspo/HousingStability">Housing Stability</a>
<sup class="type-c" title="class">c</sup>, <a href="#LivingConditions"
title="http://research.ibm.com/ontologies/hspo/LivingConditions">Living Conditions</a>
<sup class="type-c" title="class">c</sup>, <a href="#HousingProblemUnspecified"
title="http://research.ibm.com/ontologies/hspo/HousingProblemUnspecified">Unspecified Housing Problem</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="HousingStability">
<h3>Housing Stability<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/HousingStability</p>
<div class="comment">
<span class="markdown">Housing Subategory: Housing stability or instability</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterpersonalSocialAndCommunityEnvironment">
<h3>Interpersonal, Social and Community Environment<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterpersonalSocialAndCommunityEnvironment</p>
<div class="comment">
<span class="markdown">The social environment context of an individual including interpersonal relationships, community and culture.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has sub-classes</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Intervention">
<h3>Intervention<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Intervention</p>
<div class="comment">
<span class="markdown">An intervention for the person.</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#intervention_code"
title="http://research.ibm.com/ontologies/hspo/intervention_code">Intervention code</a>
<sup class="type-dp" title="data property">dp</sup>, <a href="#intervention_code_system"
title="http://research.ibm.com/ontologies/hspo/intervention_code_system">Intervention code system</a>
<sup class="type-dp" title="data property">dp</sup>, <a href="#intervention_name"
title="http://research.ibm.com/ontologies/hspo/intervention_name">Intervention name</a>
<sup class="type-dp" title="data property">dp</sup>, <a href="#hasDuration"
title="http://research.ibm.com/ontologies/hspo/hasDuration">hasDuration</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasInterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcome">hasInterventionOutcome</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasInterventionProvider"
title="http://research.ibm.com/ontologies/hspo/hasInterventionProvider">hasInterventionProvider</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasInterventionStatus"
title="http://research.ibm.com/ontologies/hspo/hasInterventionStatus">hasInterventionStatus</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasInterventionType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionType">hasInterventionType</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasIntervention"
title="http://research.ibm.com/ontologies/hspo/hasIntervention">hasIntervention</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByAssessment">
<h3>Intervention by Assessment<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByAssessment</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByAssistance">
<h3>Intervention by Assistance<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByAssistance</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByCoordination">
<h3>Intervention by Coordination<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByCoordination</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByCounseling">
<h3>Intervention by Counseling<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByCounseling</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByEducation">
<h3>Intervention by Education<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByEducation</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByEvaluationOfEligibility">
<h3>Intervention by Evaluation of Eligibility<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByEvaluationOfEligibility</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByProvisioning">
<h3>Intervention by Provisioning<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByProvisioning</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#medication_provisioning"
title="http://research.ibm.com/ontologies/hspo/medication_provisioning">Intervention by provisioning a medication</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#procedure_provisioning"
title="http://research.ibm.com/ontologies/hspo/procedure_provisioning">Intervention by provisioning a procedure</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#social_action_provisioning"
title="http://research.ibm.com/ontologies/hspo/social_action_provisioning">Intervention by provisioning a social action</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionByReffering">
<h3>Intervention by Referral<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionByReffering</p>
<div class="comment">
<span class="markdown"/>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionOutcome">
<h3>Intervention Outcome<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionOutcome</p>
<div class="comment">
<span class="markdown">The outcome of an intervention.</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#hasInterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeMetric">hasInterventionOutcomeMetric</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasInterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeResult">hasInterventionOutcomeResult</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasInterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeType">hasInterventionOutcomeType</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcome">hasInterventionOutcome</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionOutcomeMetric">
<h3>Intervention Outcome Metric<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionOutcomeMetric</p>
<div class="comment">
<span class="markdown">Specific metric of an intervention outcome</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeMetric">hasInterventionOutcomeMetric</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionOutcomeResult">
<h3>Intervention Outcome Result<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionOutcomeResult</p>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeResult">hasInterventionOutcomeResult</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionOutcomeType">
<h3>Intervention Outcome Type<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionOutcomeType</p>
<div class="comment">
<span class="markdown">The type of intervention outcome</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeType">hasInterventionOutcomeType</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionProvider">
<h3>Intervention Provider<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionProvider</p>
<div class="comment">
<span class="markdown">The provider of an intervention</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionProvider"
title="http://research.ibm.com/ontologies/hspo/hasInterventionProvider">hasInterventionProvider</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionStatus">
<h3>Intervention Status<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionStatus</p>
<div class="comment">
<span class="markdown">The status of an intervention, for example, applied, recommended, planned, ongoing, available, etc.</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionStatus"
title="http://research.ibm.com/ontologies/hspo/hasInterventionStatus">hasInterventionStatus</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#applied_intervention"
title="http://research.ibm.com/ontologies/hspo/applied_intervention">Applied intervention</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#available_intervention"
title="http://research.ibm.com/ontologies/hspo/available_intervention">Available intervention</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#ongoing_intervention"
title="http://research.ibm.com/ontologies/hspo/ongoing_intervention">Ongoing intervention</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#planned_intervention"
title="http://research.ibm.com/ontologies/hspo/planned_intervention">Planned intervention</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#recommended_intervention"
title="http://research.ibm.com/ontologies/hspo/recommended_intervention">Recommended intervention</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#rejected_intervention"
title="http://research.ibm.com/ontologies/hspo/rejected_intervention">Rejected intervention</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="InterventionType">
<h3>Intervention Type<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/InterventionType</p>
<div class="comment">
<span class="markdown">A type of intervention. E.g. education, assessment, assistance, coordination, counseling, provision, referral</span>
</div>
<dl class="description">
<dt>has sub-classes</dt>
<dd>
<a href="#InterventionByAssessment"
title="http://research.ibm.com/ontologies/hspo/InterventionByAssessment">Intervention by Assessment</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByAssistance"
title="http://research.ibm.com/ontologies/hspo/InterventionByAssistance">Intervention by Assistance</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByCoordination"
title="http://research.ibm.com/ontologies/hspo/InterventionByCoordination">Intervention by Coordination</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByCounseling"
title="http://research.ibm.com/ontologies/hspo/InterventionByCounseling">Intervention by Counseling</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByEducation"
title="http://research.ibm.com/ontologies/hspo/InterventionByEducation">Intervention by Education</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByEvaluationOfEligibility"
title="http://research.ibm.com/ontologies/hspo/InterventionByEvaluationOfEligibility">Intervention by Evaluation of Eligibility</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByProvisioning"
title="http://research.ibm.com/ontologies/hspo/InterventionByProvisioning">Intervention by Provisioning</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterventionByReffering"
title="http://research.ibm.com/ontologies/hspo/InterventionByReffering">Intervention by Referral</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasInterventionType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionType">hasInterventionType</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Judicial">
<h3>Judicial<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Judicial</p>
<div class="comment">
<span class="markdown">The judicial context of an individual including imprisionment, involvement in legal actions or jury duty.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="LivingConditions">
<h3>Living Conditions<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/LivingConditions</p>
<div class="comment">
<span class="markdown">Housing Subategory: Quality of living conditions</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="Location">
<h3>Location<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Location</p>
<div class="comment">
<span class="markdown">The location oe setting where a person lives</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#lives" title="http://research.ibm.com/ontologies/hspo/lives">lives</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="MaritalStatus">
<h3>Marital Status<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/MaritalStatus</p>
<div class="comment">
<span class="markdown">The marital status of a person</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasMaritalStatus"
title="http://research.ibm.com/ontologies/hspo/hasMaritalStatus">hasMaritalStatus</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#bachelor"
title="http://research.ibm.com/ontologies/hspo/bachelor">Bachelor</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#broken_engagement"
title="http://research.ibm.com/ontologies/hspo/broken_engagement">Broken engagement</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#broken_with_partner"
title="http://research.ibm.com/ontologies/hspo/broken_with_partner">Broken with partner</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#cohabitee_left_home"
title="http://research.ibm.com/ontologies/hspo/cohabitee_left_home">Cohabitee left home</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#cohabiting"
title="http://research.ibm.com/ontologies/hspo/cohabiting">Cohabiting</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#common_law_partnership"
title="http://research.ibm.com/ontologies/hspo/common_law_partnership">Common law partnership</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#divorced"
title="http://research.ibm.com/ontologies/hspo/divorced">Divorced</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#domestic_partnership"
title="http://research.ibm.com/ontologies/hspo/domestic_partnership">Domestic partnership</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#eloped" title="http://research.ibm.com/ontologies/hspo/eloped">Eloped</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#engaged_to_be_married"
title="http://research.ibm.com/ontologies/hspo/engaged_to_be_married">Engaged to be married</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#homosexual_marriage"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage">Homosexual marriage</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#homosexual_marriage_female"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage_female">Homosexual marriage, female</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#homosexual_marriage_male"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage_male">Homosexual marriage, male</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#husband_left_home"
title="http://research.ibm.com/ontologies/hspo/husband_left_home">Husband left home</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#legally_separated_with_interlocutory_decree"
title="http://research.ibm.com/ontologies/hspo/legally_separated_with_interlocutory_decree">Legally separated with interlocutory decree</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#marital_state_unknown"
title="http://research.ibm.com/ontologies/hspo/marital_state_unknown">Marital state unknown</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#marriage_annulment"
title="http://research.ibm.com/ontologies/hspo/marriage_annulment">Marriage annulment</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#married" title="http://research.ibm.com/ontologies/hspo/married">Married</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#monogamous"
title="http://research.ibm.com/ontologies/hspo/monogamous">Monogamous</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#newly_wed"
title="http://research.ibm.com/ontologies/hspo/newly_wed">Newly wed</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#polygamous"
title="http://research.ibm.com/ontologies/hspo/polygamous">Polygamous</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#purposely_unmarried_and_sexually_abstinent"
title="http://research.ibm.com/ontologies/hspo/purposely_unmarried_and_sexually_abstinent">Purposely unmarried and sexually abstinent</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#remarried"
title="http://research.ibm.com/ontologies/hspo/remarried">Remarried</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#separated"
title="http://research.ibm.com/ontologies/hspo/separated">Separated</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#separated_from_cohabitee"
title="http://research.ibm.com/ontologies/hspo/separated_from_cohabitee">Separated from cohabitee</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#single_person"
title="http://research.ibm.com/ontologies/hspo/single_person">Single person</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#single_never_married"
title="http://research.ibm.com/ontologies/hspo/single_never_married">Single, never married</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#spinster"
title="http://research.ibm.com/ontologies/hspo/spinster">Spinster</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#spouse_left_home"
title="http://research.ibm.com/ontologies/hspo/spouse_left_home">Spouse left home</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#trial_separation"
title="http://research.ibm.com/ontologies/hspo/trial_separation">Trial separation</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#widow" title="http://research.ibm.com/ontologies/hspo/widow">Widow</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#widowed" title="http://research.ibm.com/ontologies/hspo/widowed">Widowed</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#widower" title="http://research.ibm.com/ontologies/hspo/widower">Widower</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#wife_left_home"
title="http://research.ibm.com/ontologies/hspo/wife_left_home">Wife left home</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="OriginalProbabilityScore">
<h3>Original Probability Score<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/OriginalProbabilityScore</p>
<div class="comment">
<span class="markdown">Probability score of the evidence</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#probability_score_metric"
title="http://research.ibm.com/ontologies/hspo/probability_score_metric">Probability score metric</a>
<sup class="type-dp" title="data property">dp</sup>, <a href="#probability_score_value"
title="http://research.ibm.com/ontologies/hspo/probability_score_value">Probability score value</a>
<sup class="type-dp" title="data property">dp</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/hasProbabilityScore">hasProbabilityScore</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Person">
<h3>Person<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Person</p>
<div class="comment">
<span class="markdown">A person.</span>
</div>
<dl class="description">
<dt>is in domain of</dt>
<dd>
<a href="#person_id"
title="http://research.ibm.com/ontologies/hspo/person_id">Person ID</a>
<sup class="type-dp" title="data property">dp</sup>, <a href="#followsReligion"
title="http://research.ibm.com/ontologies/hspo/followsReligion">followsReligion</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasAge" title="http://research.ibm.com/ontologies/hspo/hasAge">hasAge</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasBehaviour"
title="http://research.ibm.com/ontologies/hspo/hasBehaviour">hasBehaviour</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasDisease"
title="http://research.ibm.com/ontologies/hspo/hasDisease">hasDisease</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasGender"
title="http://research.ibm.com/ontologies/hspo/hasGender">hasGender</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasIntervention"
title="http://research.ibm.com/ontologies/hspo/hasIntervention">hasIntervention</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasMaritalStatus"
title="http://research.ibm.com/ontologies/hspo/hasMaritalStatus">hasMaritalStatus</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasRaceOrEthnicity"
title="http://research.ibm.com/ontologies/hspo/hasRaceOrEthnicity">hasRaceOrEthnicity</a>
<sup class="type-op" title="object property">op</sup>, <a href="#hasSocialContext"
title="http://research.ibm.com/ontologies/hspo/hasSocialContext">hasSocialContext</a>
<sup class="type-op" title="object property">op</sup>, <a href="#lives" title="http://research.ibm.com/ontologies/hspo/lives">lives</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="Political">
<h3>Political<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Political</p>
<div class="comment">
<span class="markdown">The political and government context of an individual including political affiliations and distrust in government institutions.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="RaceAndEthnicity">
<h3>Race and Ethnicity<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/RaceAndEthnicity</p>
<div class="comment">
<span class="markdown">The race and/or ethnicity of a person</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasRaceOrEthnicity"
title="http://research.ibm.com/ontologies/hspo/hasRaceOrEthnicity">hasRaceOrEthnicity</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#african_race"
title="http://research.ibm.com/ontologies/hspo/african_race">African race</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#american_indian_or_alaska_native"
title="http://research.ibm.com/ontologies/hspo/american_indian_or_alaska_native">American Indian or Alaska native</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#asian_or_pacific_islander"
title="http://research.ibm.com/ontologies/hspo/asian_or_pacific_islander">Asian or Pacific islander</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#australian_aborigine"
title="http://research.ibm.com/ontologies/hspo/australian_aborigine">Australian aborigine</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#caucasian"
title="http://research.ibm.com/ontologies/hspo/caucasian">Caucasian</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#hispanic"
title="http://research.ibm.com/ontologies/hspo/hispanic">Hispanic</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#indian" title="http://research.ibm.com/ontologies/hspo/indian">Indian</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#race_not_stated"
title="http://research.ibm.com/ontologies/hspo/race_not_stated">Race not stated</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#race_unknown"
title="http://research.ibm.com/ontologies/hspo/race_unknown">Unknown racial group</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="Religion">
<h3>Religion<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Religion</p>
<div class="comment">
<span class="markdown">The religion of a person</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#followsReligion"
title="http://research.ibm.com/ontologies/hspo/followsReligion">followsReligion</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#agnosticism"
title="http://research.ibm.com/ontologies/hspo/agnosticism">Agnosticism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#atheism" title="http://research.ibm.com/ontologies/hspo/atheism">Atheism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#bahai" title="http://research.ibm.com/ontologies/hspo/bahai">Baha'i Faith</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#buddhism"
title="http://research.ibm.com/ontologies/hspo/buddhism">Buddhism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#mahayana"
title="http://research.ibm.com/ontologies/hspo/mahayana">Buddhism: Mahayana</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#buddhism_other"
title="http://research.ibm.com/ontologies/hspo/buddhism_other">Buddhism: Other</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#tantrayana"
title="http://research.ibm.com/ontologies/hspo/tantrayana">Buddhism: Tantrayana</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#theravada"
title="http://research.ibm.com/ontologies/hspo/theravada">Buddhism: Theravada</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#chinese_folk_religion"
title="http://research.ibm.com/ontologies/hspo/chinese_folk_religion">Chinese Folk Religion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#christian"
title="http://research.ibm.com/ontologies/hspo/christian">Christian</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#african_methodist_episcopal"
title="http://research.ibm.com/ontologies/hspo/african_methodist_episcopal">Christian: African Methodist Episcopal</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#african_methodist_episcopal_zion"
title="http://research.ibm.com/ontologies/hspo/african_methodist_episcopal_zion">Christian: African Methodist Episcopal Zion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#american_baptist_church"
title="http://research.ibm.com/ontologies/hspo/american_baptist_church">Christian: American Baptist Church</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#anglican"
title="http://research.ibm.com/ontologies/hspo/anglican">Christian: Anglican</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#assembly_of_god"
title="http://research.ibm.com/ontologies/hspo/assembly_of_god">Christian: Assembly of God</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#aptist_church"
title="http://research.ibm.com/ontologies/hspo/aptist_church">Christian: Baptist Church</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#christian_missionary_alliance"
title="http://research.ibm.com/ontologies/hspo/christian_missionary_alliance">Christian: Christian Missionary Alliance</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#christian_reformed"
title="http://research.ibm.com/ontologies/hspo/christian_reformed">Christian: Christian Reformed</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#christian_science"
title="http://research.ibm.com/ontologies/hspo/christian_science">Christian: Christian Science Church</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#church_of_christ"
title="http://research.ibm.com/ontologies/hspo/church_of_christ">Christian: Church of Christ</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#church_of_god"
title="http://research.ibm.com/ontologies/hspo/church_of_god">Christian: Church of God</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#church_of_god_in_christ"
title="http://research.ibm.com/ontologies/hspo/church_of_god_in_christ">Christian: Church of God in Christ</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#church_of_the_nazarene"
title="http://research.ibm.com/ontologies/hspo/church_of_the_nazarene">Christian: Church of the Nazarene</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#community_church"
title="http://research.ibm.com/ontologies/hspo/community_church">Christian: Community Church</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#congregational_church"
title="http://research.ibm.com/ontologies/hspo/congregational_church">Christian: Congregational</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#eastern_orthodox"
title="http://research.ibm.com/ontologies/hspo/eastern_orthodox">Christian: Eastern Orthodox</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#episcopalian"
title="http://research.ibm.com/ontologies/hspo/episcopalian">Christian: Episcopalian</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#evangelical_church"
title="http://research.ibm.com/ontologies/hspo/evangelical_church">Christian: Evangelical Church</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#free_will_baptist"
title="http://research.ibm.com/ontologies/hspo/free_will_baptist">Christian: Free Will Baptist</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#friends_church"
title="http://research.ibm.com/ontologies/hspo/friends_church">Christian: Friends Church or Quakers</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#greek_orthodox"
title="http://research.ibm.com/ontologies/hspo/greek_orthodox">Christian: Greek Orthodox</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#jehovahs_witness"
title="http://research.ibm.com/ontologies/hspo/jehovahs_witness">Christian: Jehovahs Witness</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#latter_day_saints_church"
title="http://research.ibm.com/ontologies/hspo/latter_day_saints_church">Christian: Latter-day Saints</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lutheran"
title="http://research.ibm.com/ontologies/hspo/lutheran">Christian: Lutheran</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#lutheran_missouri_synod"
title="http://research.ibm.com/ontologies/hspo/lutheran_missouri_synod">Christian: Lutheran Missouri Synod</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#mennonite"
title="http://research.ibm.com/ontologies/hspo/mennonite">Christian: Mennonite</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#methodist"
title="http://research.ibm.com/ontologies/hspo/methodist">Christian: Methodist</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#orthodox"
title="http://research.ibm.com/ontologies/hspo/orthodox">Christian: Orthodox</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#christian_other"
title="http://research.ibm.com/ontologies/hspo/christian_other">Christian: Other</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#other_pentecostal"
title="http://research.ibm.com/ontologies/hspo/other_pentecostal">Christian: Other Pentecostal</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#other_protestant"
title="http://research.ibm.com/ontologies/hspo/other_protestant">Christian: Other Protestant</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#pentecostal"
title="http://research.ibm.com/ontologies/hspo/pentecostal">Christian: Pentecostal</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#presbyterian"
title="http://research.ibm.com/ontologies/hspo/presbyterian">Christian: Presbyterian</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#protestant"
title="http://research.ibm.com/ontologies/hspo/protestant">Christian: Protestant</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#reformed_church"
title="http://research.ibm.com/ontologies/hspo/reformed_church">Christian: Reformed Church</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#rlds" title="http://research.ibm.com/ontologies/hspo/rlds">Christian: Reorganized Church of Jesus Christ of LDS</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#roman_catholic"
title="http://research.ibm.com/ontologies/hspo/roman_catholic">Christian: Roman Catholic</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#salvation_army"
title="http://research.ibm.com/ontologies/hspo/salvation_army">Christian: Salvation Army</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#seventh_day_adventist"
title="http://research.ibm.com/ontologies/hspo/seventh_day_adventist">Christian: Seventh Day Adventist</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#southern_baptist"
title="http://research.ibm.com/ontologies/hspo/southern_baptist">Christian: Southern Baptist Convention</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#unitarian"
title="http://research.ibm.com/ontologies/hspo/unitarian">Christian: Unitarian</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#unitarian_universalism"
title="http://research.ibm.com/ontologies/hspo/unitarian_universalism">Christian: Unitarian Universalism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#united_church_of_christ"
title="http://research.ibm.com/ontologies/hspo/united_church_of_christ">Christian: United Church of Christ</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#united_methodist"
title="http://research.ibm.com/ontologies/hspo/united_methodist">Christian: United Methodist</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#wesleyan"
title="http://research.ibm.com/ontologies/hspo/wesleyan">Christian: Wesleyan</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#confucianism"
title="http://research.ibm.com/ontologies/hspo/confucianism">Confucianism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#ethnic_religion"
title="http://research.ibm.com/ontologies/hspo/ethnic_religion">Ethnic Religion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#hinduism"
title="http://research.ibm.com/ontologies/hspo/hinduism">Hinduism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#hinduism_other"
title="http://research.ibm.com/ontologies/hspo/hinduism_other">Hinduism: Other</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#shaivism"
title="http://research.ibm.com/ontologies/hspo/shaivism">Hinduism: Shaivism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#vaishnavism"
title="http://research.ibm.com/ontologies/hspo/vaishnavism">Hinduism: Vaishnavism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#jainism" title="http://research.ibm.com/ontologies/hspo/jainism">Jainism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#judaism" title="http://research.ibm.com/ontologies/hspo/judaism">Judaism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#conservative_judaism"
title="http://research.ibm.com/ontologies/hspo/conservative_judaism">Judaism: Conservative Judaism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#jewish_renewal"
title="http://research.ibm.com/ontologies/hspo/jewish_renewal">Judaism: Jewish Renewal</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#orthodox_judaism"
title="http://research.ibm.com/ontologies/hspo/orthodox_judaism">Judaism: Orthodox Judaism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#judaism_other"
title="http://research.ibm.com/ontologies/hspo/judaism_other">Judaism: Other</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#reconstructionist_judaism"
title="http://research.ibm.com/ontologies/hspo/reconstructionist_judaism">Judaism: Reconstructionist Judaism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#reform_judaism"
title="http://research.ibm.com/ontologies/hspo/reform_judaism">Judaism: Reform Judaism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#muslim" title="http://research.ibm.com/ontologies/hspo/muslim">Muslim</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#muslim_other"
title="http://research.ibm.com/ontologies/hspo/muslim_other">Muslim: Other</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#shia_islam"
title="http://research.ibm.com/ontologies/hspo/shia_islam">Muslim: Shia Islam</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#sunni_islam"
title="http://research.ibm.com/ontologies/hspo/sunni_islam">Muslim: Sunni Islam</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#native_american"
title="http://research.ibm.com/ontologies/hspo/native_american">Native American</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#new_religion"
title="http://research.ibm.com/ontologies/hspo/new_religion">New Religion Movement</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#nonreligious"
title="http://research.ibm.com/ontologies/hspo/nonreligious">Non religious</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#other_religion"
title="http://research.ibm.com/ontologies/hspo/other_religion">Other religion</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#religion_unknown"
title="http://research.ibm.com/ontologies/hspo/religion_unknown">Religion is unknown</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#shinto" title="http://research.ibm.com/ontologies/hspo/shinto">Shinto or Shintoism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#sikhism" title="http://research.ibm.com/ontologies/hspo/sikhism">Sikhism</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#spiritualism"
title="http://research.ibm.com/ontologies/hspo/spiritualism">Spiritualism</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="SocialContext">
<h3>Social Context<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/SocialContext</p>
<div class="comment">
<span class="markdown">Social context of a person, e.g. problem, state, strength, barriers, etc.</span>
</div>
<dl class="description">
<dt>has sub-classes</dt>
<dd>
<a href="#BuiltEnvironment"
title="http://research.ibm.com/ontologies/hspo/BuiltEnvironment">Built Environment</a>
<sup class="type-c" title="class">c</sup>, <a href="#Educational"
title="http://research.ibm.com/ontologies/hspo/Educational">Educational</a>
<sup class="type-c" title="class">c</sup>, <a href="#Employment"
title="http://research.ibm.com/ontologies/hspo/Employment">Employment</a>
<sup class="type-c" title="class">c</sup>, <a href="#Financial"
title="http://research.ibm.com/ontologies/hspo/Financial">Financial</a>
<sup class="type-c" title="class">c</sup>, <a href="#Food" title="http://research.ibm.com/ontologies/hspo/Food">Food Security</a>
<sup class="type-c" title="class">c</sup>, <a href="#HealthAndWelfare"
title="http://research.ibm.com/ontologies/hspo/HealthAndWelfare">Health and Welfare System</a>
<sup class="type-c" title="class">c</sup>, <a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
<sup class="type-c" title="class">c</sup>, <a href="#InterpersonalSocialAndCommunityEnvironment"
title="http://research.ibm.com/ontologies/hspo/InterpersonalSocialAndCommunityEnvironment">Interpersonal, Social and Community Environment</a>
<sup class="type-c" title="class">c</sup>, <a href="#Judicial"
title="http://research.ibm.com/ontologies/hspo/Judicial">Judicial</a>
<sup class="type-c" title="class">c</sup>, <a href="#Political"
title="http://research.ibm.com/ontologies/hspo/Political">Political</a>
<sup class="type-c" title="class">c</sup>, <a href="#Transportation"
title="http://research.ibm.com/ontologies/hspo/Transportation">Transportation</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>is in domain of</dt>
<dd>
<a href="#positivity_indicator"
title="http://research.ibm.com/ontologies/hspo/positivity_indicator">Positivity indicator</a>
<sup class="type-dp" title="data property">dp</sup>
</dd>
<dt>is in range of</dt>
<dd>
<a href="#hasSocialContext"
title="http://research.ibm.com/ontologies/hspo/hasSocialContext">hasSocialContext</a>
<sup class="type-op" title="object property">op</sup>
</dd>
</dl>
</div>
<div class="entity" id="StageOfLife">
<h3>Stage of life<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/StageOfLife</p>
<div class="comment">
<span class="markdown">The stage of life of a person</span>
</div>
<dl class="description">
<dt>is in range of</dt>
<dd>
<a href="#hasStageOfLife"
title="http://research.ibm.com/ontologies/hspo/hasStageOfLife">hasStageOfLife</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has members</dt>
<dd>
<a href="#adult" title="http://research.ibm.com/ontologies/hspo/adult">Adult</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#child" title="http://research.ibm.com/ontologies/hspo/child">Child</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#infant" title="http://research.ibm.com/ontologies/hspo/infant">Infant</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#middle_age_adult"
title="http://research.ibm.com/ontologies/hspo/middle_age_adult">Middle age adult</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#senior_adult"
title="http://research.ibm.com/ontologies/hspo/senior_adult">Senior Adult</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#teen" title="http://research.ibm.com/ontologies/hspo/teen">Teenager</a>
<sup class="type-ni" title="named individual">ni</sup>, <a href="#toddler" title="http://research.ibm.com/ontologies/hspo/toddler">Toddler</a>
<sup class="type-ni" title="named individual">ni</sup>
</dd>
</dl>
</div>
<div class="entity" id="Transportation">
<h3>Transportation<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/Transportation</p>
<div class="comment">
<span class="markdown">The context in which an individual requires to travel between locations including commuting.</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="HousingProblemUnspecified">
<h3>Unspecified Housing Problem<sup class="type-c" title="class">c</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#classes">Class ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/HousingProblemUnspecified</p>
<div class="comment">
<span class="markdown">Housing Subategory: HousingProblem details not specified</span>
</div>
<dl class="description">
<dt>has super-classes</dt>
<dd>
<a href="#Housing" title="http://research.ibm.com/ontologies/hspo/Housing">Housing</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div><div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="objectproperties">
<h3 id="properties" class="list">Object Properties</h3>
<ul class="hlist">
<li>
<a href="#belongsToAgeGroup"
title="http://research.ibm.com/ontologies/hspo/belongsToAgeGroup">belongsToAgeGroup</a>
</li>
<li>
<a href="#followsReligion"
title="http://research.ibm.com/ontologies/hspo/followsReligion">followsReligion</a>
</li>
<li>
<a href="#hasAge" title="http://research.ibm.com/ontologies/hspo/hasAge">hasAge</a>
</li>
<li>
<a href="#hasAlignmentScore"
title="http://research.ibm.com/ontologies/hspo/hasAlignmentScore">hasAlignmentScore</a>
</li>
<li>
<a href="#hasBehaviour"
title="http://research.ibm.com/ontologies/hspo/hasBehaviour">hasBehaviour</a>
</li>
<li>
<a href="#hasConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/hasConfidenceScore">hasConfidenceScore</a>
</li>
<li>
<a href="#hasDisease"
title="http://research.ibm.com/ontologies/hspo/hasDisease">hasDisease</a>
</li>
<li>
<a href="#hasDuration"
title="http://research.ibm.com/ontologies/hspo/hasDuration">hasDuration</a>
</li>
<li>
<a href="#hasEvidence"
title="http://research.ibm.com/ontologies/hspo/hasEvidence">hasEvidence</a>
</li>
<li>
<a href="#hasEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceGraph">hasEvidenceGraph</a>
</li>
<li>
<a href="#hasEvidenceSource"
title="http://research.ibm.com/ontologies/hspo/hasEvidenceSource">hasEvidenceSource</a>
</li>
<li>
<a href="#hasGender"
title="http://research.ibm.com/ontologies/hspo/hasGender">hasGender</a>
</li>
<li>
<a href="#hasIntervention"
title="http://research.ibm.com/ontologies/hspo/hasIntervention">hasIntervention</a>
</li>
<li>
<a href="#hasInterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcome">hasInterventionOutcome</a>
</li>
<li>
<a href="#hasInterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeMetric">hasInterventionOutcomeMetric</a>
</li>
<li>
<a href="#hasInterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeResult">hasInterventionOutcomeResult</a>
</li>
<li>
<a href="#hasInterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeType">hasInterventionOutcomeType</a>
</li>
<li>
<a href="#hasInterventionProvider"
title="http://research.ibm.com/ontologies/hspo/hasInterventionProvider">hasInterventionProvider</a>
</li>
<li>
<a href="#hasInterventionStatus"
title="http://research.ibm.com/ontologies/hspo/hasInterventionStatus">hasInterventionStatus</a>
</li>
<li>
<a href="#hasInterventionType"
title="http://research.ibm.com/ontologies/hspo/hasInterventionType">hasInterventionType</a>
</li>
<li>
<a href="#hasMaritalStatus"
title="http://research.ibm.com/ontologies/hspo/hasMaritalStatus">hasMaritalStatus</a>
</li>
<li>
<a href="#hasProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/hasProbabilityScore">hasProbabilityScore</a>
</li>
<li>
<a href="#hasRaceOrEthnicity"
title="http://research.ibm.com/ontologies/hspo/hasRaceOrEthnicity">hasRaceOrEthnicity</a>
</li>
<li>
<a href="#hasSocialContext"
title="http://research.ibm.com/ontologies/hspo/hasSocialContext">hasSocialContext</a>
</li>
<li>
<a href="#hasStageOfLife"
title="http://research.ibm.com/ontologies/hspo/hasStageOfLife">hasStageOfLife</a>
</li>
<li>
<a href="#hasTrustScore"
title="http://research.ibm.com/ontologies/hspo/hasTrustScore">hasTrustScore</a>
</li>
<li>
<a href="#isPartOfEvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/isPartOfEvidenceGraph">isPartOfEvidenceGraph</a>
</li>
<li>
<a href="#lives" title="http://research.ibm.com/ontologies/hspo/lives">lives</a>
</li>
</ul>
<div class="entity" id="belongsToAgeGroup">
<h3>belongsToAgeGroup<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/belongsToAgeGroup</p>
<div class="comment">
<span class="markdown">The age group the person belongs to</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="followsReligion">
<h3>followsReligion<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/followsReligion</p>
<div class="comment">
<span class="markdown">The religon a person follows</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasAge">
<h3>hasAge<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasAge</p>
<div class="comment">
<span class="markdown">The age of a person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasAlignmentScore">
<h3>hasAlignmentScore<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasAlignmentScore</p>
<div class="comment">
<span class="markdown">The alignment proximity score</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#ConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/ConfidenceScore">Confidence Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#AlignmentScore"
title="http://research.ibm.com/ontologies/hspo/AlignmentScore">Alignment Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasBehaviour">
<h3>hasBehaviour<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasBehaviour</p>
<div class="comment">
<span class="markdown">A behaviour for a Person. E.g. diet, smoking, exercise, etc.</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Behaviour"
title="http://research.ibm.com/ontologies/hspo/Behaviour">Behaviour</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasConfidenceScore">
<h3>hasConfidenceScore<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasConfidenceScore</p>
<div class="comment">
<span class="markdown">Relates the evidence to a confidence score</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Evidence"
title="http://research.ibm.com/ontologies/hspo/Evidence">Evidence</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#ConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/ConfidenceScore">Confidence Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasDisease">
<h3>hasDisease<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasDisease</p>
<div class="comment">
<span class="markdown">The disease associated with a Person</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Disease" title="http://research.ibm.com/ontologies/hspo/Disease">Disease</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasDuration">
<h3>hasDuration<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasDuration</p>
<div class="comment">
<span class="markdown">The duration of an intervention</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Duration"
title="http://research.ibm.com/ontologies/hspo/Duration">Duration</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasEvidence">
<h3>hasEvidence<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasEvidence</p>
<div class="comment">
<span class="markdown">Relates a social problem, disease or intervention to an evidence, including provenance, confidence score and original knowledge</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Behaviour"
title="http://research.ibm.com/ontologies/hspo/Behaviour">Behaviour</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Disease" title="http://research.ibm.com/ontologies/hspo/Disease">Disease</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Evidence"
title="http://research.ibm.com/ontologies/hspo/Evidence">Evidence</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasEvidenceGraph">
<h3>hasEvidenceGraph<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasEvidenceGraph</p>
<div class="comment">
<span class="markdown">Relates the evidence to its Evidence Graph</span>
</div>
<div class="description">
<dl>
<dt>has super-properties</dt>
<dd>
<a href="http://www.w3.org/ns/prov#wasGeneratedBy"
target="_blank"
title="http://www.w3.org/ns/prov#wasGeneratedBy">was generated by</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has domain</dt>
<dd>
<a href="#Evidence"
title="http://research.ibm.com/ontologies/hspo/Evidence">Evidence</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#EvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/EvidenceGraph">Evidence Graph</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasEvidenceSource">
<h3>hasEvidenceSource<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasEvidenceSource</p>
<div class="comment">
<span class="markdown">The source of the evidence</span>
</div>
<div class="description">
<dl>
<dt>has super-properties</dt>
<dd>
<a href="http://www.w3.org/ns/prov#wasDerivedFrom"
target="_blank"
title="http://www.w3.org/ns/prov#wasDerivedFrom">was derived from</a>
<sup class="type-op" title="object property">op</sup>
</dd>
<dt>has domain</dt>
<dd>
<a href="#Evidence"
title="http://research.ibm.com/ontologies/hspo/Evidence">Evidence</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#EvidenceSource"
title="http://research.ibm.com/ontologies/hspo/EvidenceSource">Evidence Source</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasGender">
<h3>hasGender<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasGender</p>
<div class="comment">
<span class="markdown">The gender of a person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasIntervention">
<h3>hasIntervention<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasIntervention</p>
<div class="comment">
<span class="markdown">An intervention for a Person</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionOutcome">
<h3>hasInterventionOutcome<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionOutcome</p>
<div class="comment">
<span class="markdown">Relates an outcome to an intervention</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcome">Intervention Outcome</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionOutcomeMetric">
<h3>hasInterventionOutcomeMetric<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeMetric</p>
<div class="comment">
<span class="markdown">The metric to measure an outcome.</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#InterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcome">Intervention Outcome</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionOutcomeMetric"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeMetric">Intervention Outcome Metric</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionOutcomeResult">
<h3>hasInterventionOutcomeResult<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeResult</p>
<div class="comment">
<span class="markdown">The outcome result scale.</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#InterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcome">Intervention Outcome</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionOutcomeResult"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeResult">Intervention Outcome Result</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionOutcomeType">
<h3>hasInterventionOutcomeType<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionOutcomeType</p>
<div class="comment">
<span class="markdown">The type of Intervention outcome.</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#InterventionOutcome"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcome">Intervention Outcome</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionOutcomeType"
title="http://research.ibm.com/ontologies/hspo/InterventionOutcomeType">Intervention Outcome Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionProvider">
<h3>hasInterventionProvider<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionProvider</p>
<div class="comment">
<span class="markdown">Intervention provider of an intervention</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionProvider"
title="http://research.ibm.com/ontologies/hspo/InterventionProvider">Intervention Provider</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionStatus">
<h3>hasInterventionStatus<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionStatus</p>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasInterventionType">
<h3>hasInterventionType<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasInterventionType</p>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#InterventionType"
title="http://research.ibm.com/ontologies/hspo/InterventionType">Intervention Type</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasMaritalStatus">
<h3>hasMaritalStatus<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasMaritalStatus</p>
<div class="comment">
<span class="markdown">The marital status of a person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasProbabilityScore">
<h3>hasProbabilityScore<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasProbabilityScore</p>
<div class="comment">
<span class="markdown">The original probability score of the evidence</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#ConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/ConfidenceScore">Confidence Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#OriginalProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/OriginalProbabilityScore">Original Probability Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasRaceOrEthnicity">
<h3>hasRaceOrEthnicity<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasRaceOrEthnicity</p>
<div class="comment">
<span class="markdown">The race and/or ethnicity of a person</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasSocialContext">
<h3>hasSocialContext<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasSocialContext</p>
<div class="comment">
<span class="markdown">The social context of a person</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasStageOfLife">
<h3>hasStageOfLife<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasStageOfLife</p>
<div class="comment">
<span class="markdown">The stage of life of a person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="hasTrustScore">
<h3>hasTrustScore<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hasTrustScore</p>
<div class="comment">
<span class="markdown">The datasource trust score</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#ConfidenceScore"
title="http://research.ibm.com/ontologies/hspo/ConfidenceScore">Confidence Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#DatasourceTrustScore"
title="http://research.ibm.com/ontologies/hspo/DatasourceTrustScore">Datasource Trust Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="isPartOfEvidenceGraph">
<h3>isPartOfEvidenceGraph<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/isPartOfEvidenceGraph</p>
<div class="comment">
<span class="markdown">Part of relation used as an evidence to establish Person relation</span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#EvidenceGraph"
title="http://research.ibm.com/ontologies/hspo/EvidenceGraph">Evidence Graph</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Behaviour"
title="http://research.ibm.com/ontologies/hspo/Behaviour">Behaviour</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Disease" title="http://research.ibm.com/ontologies/hspo/Disease">Disease</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Location"
title="http://research.ibm.com/ontologies/hspo/Location">Location</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
<span class="logic">or</span>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
<div class="entity" id="lives">
<h3>lives<sup class="type-op" title="object property">op</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#objectproperties">Object Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives</p>
<div class="comment">
<span class="markdown">The location where the person lives, e.g. address, state, area, country, etc. </span>
</div>
<div class="description">
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="#Location"
title="http://research.ibm.com/ontologies/hspo/Location">Location</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div>
</div><div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="dataproperties">
<h3 id="dataproperties-headline" class="list">Data Properties</h3>
<ul class="hlist">
<li>
<a href="#age_in_years"
title="http://research.ibm.com/ontologies/hspo/age_in_years">Age in years</a>
</li>
<li>
<a href="#alignment_score_value"
title="http://research.ibm.com/ontologies/hspo/alignment_score_value">Alignment score value</a>
</li>
<li>
<a href="#source_ID"
title="http://research.ibm.com/ontologies/hspo/source_ID">Datasource ID</a>
</li>
<li>
<a href="#intervention_code"
title="http://research.ibm.com/ontologies/hspo/intervention_code">Intervention code</a>
</li>
<li>
<a href="#intervention_code_system"
title="http://research.ibm.com/ontologies/hspo/intervention_code_system">Intervention code system</a>
</li>
<li>
<a href="#intervention_name"
title="http://research.ibm.com/ontologies/hspo/intervention_name">Intervention name</a>
</li>
<li>
<a href="#number_in_household"
title="http://research.ibm.com/ontologies/hspo/number_in_household">Number in household</a>
</li>
<li>
<a href="#person_id"
title="http://research.ibm.com/ontologies/hspo/person_id">Person ID</a>
</li>
<li>
<a href="#positivity_indicator"
title="http://research.ibm.com/ontologies/hspo/positivity_indicator">Positivity indicator</a>
</li>
<li>
<a href="#probability_score_metric"
title="http://research.ibm.com/ontologies/hspo/probability_score_metric">Probability score metric</a>
</li>
<li>
<a href="#probability_score_value"
title="http://research.ibm.com/ontologies/hspo/probability_score_value">Probability score value</a>
</li>
<li>
<a href="#trust_score"
title="http://research.ibm.com/ontologies/hspo/trust_score">Trust score</a>
</li>
</ul>
<div class="entity" id="age_in_years">
<h3>Age in years<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/age_in_years</p>
<div class="comment">
<span class="markdown">Current age of a person in years</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Age" title="http://research.ibm.com/ontologies/hspo/Age">Age</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#int"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#int">int</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="alignment_score_value">
<h3>Alignment score value<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/alignment_score_value</p>
<div class="comment">
<span class="markdown">Alignment score between the Evidence and the Person Graphs</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#AlignmentScore"
title="http://research.ibm.com/ontologies/hspo/AlignmentScore">Alignment Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#double"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#double">double</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="source_ID">
<h3>Datasource ID<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/source_ID</p>
<div class="comment">
<span class="markdown">The ID (e.g. URI) of the Evidence Graph source</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#EvidenceSource"
title="http://research.ibm.com/ontologies/hspo/EvidenceSource">Evidence Source</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="intervention_code">
<h3>Intervention code<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/intervention_code</p>
<div class="comment">
<span class="markdown">The code of the intervention</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="intervention_code_system">
<h3>Intervention code system<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/intervention_code_system</p>
<div class="comment">
<span class="markdown">The intervention coding system. E.g. CPT, RxNorm, ICD, etc.</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="intervention_name">
<h3>Intervention name<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/intervention_name</p>
<div class="comment">
<span class="markdown">The name of the intervention, which may include a short textual description </span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Intervention"
title="http://research.ibm.com/ontologies/hspo/Intervention">Intervention</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="number_in_household">
<h3>Number in household<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/number_in_household</p>
<div class="comment">
<span class="markdown">Number in household</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#int"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#int">int</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="person_id">
<h3>Person ID<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/person_id</p>
<div class="comment">
<span class="markdown">The ID of the person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#Person" title="http://research.ibm.com/ontologies/hspo/Person">Person</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="positivity_indicator">
<h3>Positivity indicator<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/positivity_indicator</p>
<div class="comment">
<span class="markdown">Positivity of the social factor.</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#SocialContext"
title="http://research.ibm.com/ontologies/hspo/SocialContext">Social Context</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>{ "contradicting" , "negative" , "neutral" , "positive" }</dd>
</dl>
</div>
</div>
<div class="entity" id="probability_score_metric">
<h3>Probability score metric<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/probability_score_metric</p>
<div class="comment">
<span class="markdown">Probability score metric of the Evidence Graph for a Person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#OriginalProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/OriginalProbabilityScore">Original Probability Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="probability_score_value">
<h3>Probability score value<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/probability_score_value</p>
<div class="comment">
<span class="markdown">Probability score value of the Evidence Graph for a Person</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#OriginalProbabilityScore"
title="http://research.ibm.com/ontologies/hspo/OriginalProbabilityScore">Original Probability Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#double"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#double">double</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="trust_score">
<h3>Trust score<sup class="type-dp" title="data property">dp</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#dataproperties">Data Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/trust_score</p>
<div class="comment">
<span class="markdown">Datasource Trust Score for the Evidence Graph</span>
</div>
<div class="description">
<p>
<strong>has characteristics:
</strong> functional</p>
<dl>
<dt>has domain</dt>
<dd>
<a href="#DatasourceTrustScore"
title="http://research.ibm.com/ontologies/hspo/DatasourceTrustScore">Datasource Trust Score</a>
<sup class="type-c" title="class">c</sup>
</dd>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#double"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#double">double</a>
</dd>
</dl>
</div>
</div>
</div><div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="annotationproperties">
<h3 id="annotationproperties" class="list">Annotation Properties</h3>
<ul class="hlist">
<li>
<a href="#http://purl.org/dc/elements/1.1/abstract" title="http://purl.org/dc/elements/1.1/abstract">
<span>abstract</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2004/02/skos/core#broader" title="http://www.w3.org/2004/02/skos/core#broader">
<span>broader</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2002/07/owl#cardinality" title="http://www.w3.org/2002/07/owl#cardinality">
<span>cardinality</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/created" title="http://purl.org/dc/elements/1.1/created">
<span>created</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/terms/created" title="http://purl.org/dc/terms/created">
<span>created</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/creator" title="http://purl.org/dc/elements/1.1/creator">
<span>creator</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/description" title="http://purl.org/dc/elements/1.1/description">
<span>description</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2000/01/rdf-schema#displayName" title="http://www.w3.org/2000/01/rdf-schema#displayName">
<span>display name</span>
</a>
</li>
<li>
<a href="#http://www.geneontology.org/formats/oboInOwl#hasDbXref"
title="http://www.geneontology.org/formats/oboInOwl#hasDbXref">hasMapping</a>
</li>
<li>
<a href="#icd10Code" title="http://research.ibm.com/ontologies/hspo/icd10Code">
<span>icd10 code</span>
</a>
</li>
<li>
<a href="#icd9Code" title="http://research.ibm.com/ontologies/hspo/icd9Code">
<span>icd9 code</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/modified" title="http://purl.org/dc/elements/1.1/modified">
<span>modified</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/terms/modified" title="http://purl.org/dc/terms/modified">
<span>modified</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/2004/02/skos/core#narrower" title="http://www.w3.org/2004/02/skos/core#narrower">
<span>narrower</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/publisher" title="http://purl.org/dc/elements/1.1/publisher">
<span>publisher</span>
</a>
</li>
<li>
<a href="#http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"
title="http://www.w3.org/1999/02/22-rdf-syntax-ns#resource">
<span>resource</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/source" title="http://purl.org/dc/elements/1.1/source">
<span>source</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/elements/1.1/title" title="http://purl.org/dc/elements/1.1/title">
<span>title</span>
</a>
</li>
<li>
<a href="#http://purl.org/dc/terms/title" title="http://purl.org/dc/terms/title">
<span>title</span>
</a>
</li>
<li>
<a href="#umlsCui" title="http://research.ibm.com/ontologies/hspo/umlsCui">
<span>umls cui</span>
</a>
</li>
</ul>
<div class="entity" id="http://purl.org/dc/elements/1.1/abstract">
<h3>abstract<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/abstract</p>
</div>
<div class="entity" id="http://www.w3.org/2004/02/skos/core#broader">
<h3>broader<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://www.w3.org/2004/02/skos/core#broader</p>
</div>
<div class="entity" id="http://www.w3.org/2002/07/owl#cardinality">
<h3>cardinality<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://www.w3.org/2002/07/owl#cardinality</p>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/created">
<h3>created<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/created</p>
</div>
<div class="entity" id="http://purl.org/dc/terms/created">
<h3>created<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/terms/created</p>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/creator">
<h3>creator<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/creator</p>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/description">
<h3>description<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/description</p>
</div>
<div class="entity" id="http://www.w3.org/2000/01/rdf-schema#displayName">
<h3>display name<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://www.w3.org/2000/01/rdf-schema#displayName</p>
</div>
<div class="entity" id="http://www.geneontology.org/formats/oboInOwl#hasDbXref">
<h3>hasMapping<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://www.geneontology.org/formats/oboInOwl#hasDbXref</p>
</div>
<div class="entity" id="icd10Code">
<h3>icd10 code<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/icd10Code</p>
<div class="comment">
<span class="markdown">The ICD-10 code</span>
</div>
<div class="description">
<dl>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="icd9Code">
<h3>icd9 code<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/icd9Code</p>
<div class="comment">
<span class="markdown">The ICD-9 code</span>
</div>
<div class="description">
<dl>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/modified">
<h3>modified<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/modified</p>
</div>
<div class="entity" id="http://purl.org/dc/terms/modified">
<h3>modified<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/terms/modified</p>
</div>
<div class="entity" id="http://www.w3.org/2004/02/skos/core#narrower">
<h3>narrower<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://www.w3.org/2004/02/skos/core#narrower</p>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/publisher">
<h3>publisher<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/publisher</p>
</div>
<div class="entity" id="http://www.w3.org/1999/02/22-rdf-syntax-ns#resource">
<h3>resource<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://www.w3.org/1999/02/22-rdf-syntax-ns#resource</p>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/source">
<h3>source<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/source</p>
</div>
<div class="entity" id="http://purl.org/dc/elements/1.1/title">
<h3>title<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/elements/1.1/title</p>
</div>
<div class="entity" id="http://purl.org/dc/terms/title">
<h3>title<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://purl.org/dc/terms/title</p>
</div>
<div class="entity" id="umlsCui">
<h3>umls cui<sup class="type-ap" title="annotation property">ap</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#annotationproperties">Annotation Property ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/umlsCui</p>
<div class="comment">
<span class="markdown">The UMLS entity identifier (CUI)</span>
</div>
<div class="description">
<dl>
<dt>has range</dt>
<dd>
<a href="http://www.w3.org/2001/XMLSchema#string"
target="_blank"
title="http://www.w3.org/2001/XMLSchema#string">string</a>
</dd>
</dl>
</div>
</div>
</div><div xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="namedindividuals">
<h3 id="namedindividuals" class="list">Named Individuals</h3>
<ul class="hlist">
<li>
<a href="#ten_to_fourteen"
title="http://research.ibm.com/ontologies/hspo/ten_to_fourteen">10 to 14</a>
</li>
<li>
<a href="#fifteen_to_nineteen"
title="http://research.ibm.com/ontologies/hspo/fifteen_to_nineteen">15 to 19</a>
</li>
<li>
<a href="#twenty_to_twentyfour"
title="http://research.ibm.com/ontologies/hspo/twenty_to_twentyfour">20 to 24</a>
</li>
<li>
<a href="#twentyfive_to_twentynine"
title="http://research.ibm.com/ontologies/hspo/twentyfive_to_twentynine">25 to 29</a>
</li>
<li>
<a href="#thirty_to_thirtyfour"
title="http://research.ibm.com/ontologies/hspo/thirty_to_thirtyfour">30 to 34</a>
</li>
<li>
<a href="#thirtyfive_to_thirtynine"
title="http://research.ibm.com/ontologies/hspo/thirtyfive_to_thirtynine">35 to 39</a>
</li>
<li>
<a href="#forty_to_fortyfour"
title="http://research.ibm.com/ontologies/hspo/forty_to_fortyfour">40 to 44</a>
</li>
<li>
<a href="#fortyfive_to_fortynine"
title="http://research.ibm.com/ontologies/hspo/fortyfive_to_fortynine">45 to 49</a>
</li>
<li>
<a href="#five_to_nine"
title="http://research.ibm.com/ontologies/hspo/five_to_nine">5 to 9</a>
</li>
<li>
<a href="#fifty_to_fiftyfour"
title="http://research.ibm.com/ontologies/hspo/fifty_to_fiftyfour">50 to 54</a>
</li>
<li>
<a href="#fiftyfive_to_fiftynine"
title="http://research.ibm.com/ontologies/hspo/fiftyfive_to_fiftynine">55 to 59</a>
</li>
<li>
<a href="#sixty_to_sixtyfour"
title="http://research.ibm.com/ontologies/hspo/sixty_to_sixtyfour">60 to 64</a>
</li>
<li>
<a href="#sixtyfive_to_sixtynine"
title="http://research.ibm.com/ontologies/hspo/sixtyfive_to_sixtynine">65 to 69</a>
</li>
<li>
<a href="#seventy_to_seventyfour"
title="http://research.ibm.com/ontologies/hspo/seventy_to_seventyfour">70 to 74</a>
</li>
<li>
<a href="#seventyfive_to_seventynine"
title="http://research.ibm.com/ontologies/hspo/seventyfive_to_seventynine">75 to 79</a>
</li>
<li>
<a href="#eighty_to_eightyfour"
title="http://research.ibm.com/ontologies/hspo/eighty_to_eightyfour">80 to 84</a>
</li>
<li>
<a href="#eightyfive_and_over"
title="http://research.ibm.com/ontologies/hspo/eightyfive_and_over">85 and over</a>
</li>
<li>
<a href="#adult" title="http://research.ibm.com/ontologies/hspo/adult">Adult</a>
</li>
<li>
<a href="#african_race"
title="http://research.ibm.com/ontologies/hspo/african_race">African race</a>
</li>
<li>
<a href="#agnosticism"
title="http://research.ibm.com/ontologies/hspo/agnosticism">Agnosticism</a>
</li>
<li>
<a href="#american_indian_or_alaska_native"
title="http://research.ibm.com/ontologies/hspo/american_indian_or_alaska_native">American Indian or Alaska native</a>
</li>
<li>
<a href="#applied_intervention"
title="http://research.ibm.com/ontologies/hspo/applied_intervention">Applied intervention</a>
</li>
<li>
<a href="#asian_or_pacific_islander"
title="http://research.ibm.com/ontologies/hspo/asian_or_pacific_islander">Asian or Pacific islander</a>
</li>
<li>
<a href="#atheism" title="http://research.ibm.com/ontologies/hspo/atheism">Atheism</a>
</li>
<li>
<a href="#australian_aborigine"
title="http://research.ibm.com/ontologies/hspo/australian_aborigine">Australian aborigine</a>
</li>
<li>
<a href="#available_intervention"
title="http://research.ibm.com/ontologies/hspo/available_intervention">Available intervention</a>
</li>
<li>
<a href="#bachelor"
title="http://research.ibm.com/ontologies/hspo/bachelor">Bachelor</a>
</li>
<li>
<a href="#bahai" title="http://research.ibm.com/ontologies/hspo/bahai">Baha'i Faith</a>
</li>
<li>
<a href="#broken_engagement"
title="http://research.ibm.com/ontologies/hspo/broken_engagement">Broken engagement</a>
</li>
<li>
<a href="#broken_with_partner"
title="http://research.ibm.com/ontologies/hspo/broken_with_partner">Broken with partner</a>
</li>
<li>
<a href="#buddhism"
title="http://research.ibm.com/ontologies/hspo/buddhism">Buddhism</a>
</li>
<li>
<a href="#mahayana"
title="http://research.ibm.com/ontologies/hspo/mahayana">Buddhism: Mahayana</a>
</li>
<li>
<a href="#buddhism_other"
title="http://research.ibm.com/ontologies/hspo/buddhism_other">Buddhism: Other</a>
</li>
<li>
<a href="#tantrayana"
title="http://research.ibm.com/ontologies/hspo/tantrayana">Buddhism: Tantrayana</a>
</li>
<li>
<a href="#theravada"
title="http://research.ibm.com/ontologies/hspo/theravada">Buddhism: Theravada</a>
</li>
<li>
<a href="#caucasian"
title="http://research.ibm.com/ontologies/hspo/caucasian">Caucasian</a>
</li>
<li>
<a href="#child" title="http://research.ibm.com/ontologies/hspo/child">Child</a>
</li>
<li>
<a href="#child_lives_with_unrelated_adult"
title="http://research.ibm.com/ontologies/hspo/child_lives_with_unrelated_adult">Child lives with unrelated adult</a>
</li>
<li>
<a href="#chinese_folk_religion"
title="http://research.ibm.com/ontologies/hspo/chinese_folk_religion">Chinese Folk Religion</a>
</li>
<li>
<a href="#christian"
title="http://research.ibm.com/ontologies/hspo/christian">Christian</a>
</li>
<li>
<a href="#african_methodist_episcopal"
title="http://research.ibm.com/ontologies/hspo/african_methodist_episcopal">Christian: African Methodist Episcopal</a>
</li>
<li>
<a href="#african_methodist_episcopal_zion"
title="http://research.ibm.com/ontologies/hspo/african_methodist_episcopal_zion">Christian: African Methodist Episcopal Zion</a>
</li>
<li>
<a href="#american_baptist_church"
title="http://research.ibm.com/ontologies/hspo/american_baptist_church">Christian: American Baptist Church</a>
</li>
<li>
<a href="#anglican"
title="http://research.ibm.com/ontologies/hspo/anglican">Christian: Anglican</a>
</li>
<li>
<a href="#assembly_of_god"
title="http://research.ibm.com/ontologies/hspo/assembly_of_god">Christian: Assembly of God</a>
</li>
<li>
<a href="#aptist_church"
title="http://research.ibm.com/ontologies/hspo/aptist_church">Christian: Baptist Church</a>
</li>
<li>
<a href="#christian_missionary_alliance"
title="http://research.ibm.com/ontologies/hspo/christian_missionary_alliance">Christian: Christian Missionary Alliance</a>
</li>
<li>
<a href="#christian_reformed"
title="http://research.ibm.com/ontologies/hspo/christian_reformed">Christian: Christian Reformed</a>
</li>
<li>
<a href="#christian_science"
title="http://research.ibm.com/ontologies/hspo/christian_science">Christian: Christian Science Church</a>
</li>
<li>
<a href="#church_of_christ"
title="http://research.ibm.com/ontologies/hspo/church_of_christ">Christian: Church of Christ</a>
</li>
<li>
<a href="#church_of_god"
title="http://research.ibm.com/ontologies/hspo/church_of_god">Christian: Church of God</a>
</li>
<li>
<a href="#church_of_god_in_christ"
title="http://research.ibm.com/ontologies/hspo/church_of_god_in_christ">Christian: Church of God in Christ</a>
</li>
<li>
<a href="#church_of_the_nazarene"
title="http://research.ibm.com/ontologies/hspo/church_of_the_nazarene">Christian: Church of the Nazarene</a>
</li>
<li>
<a href="#community_church"
title="http://research.ibm.com/ontologies/hspo/community_church">Christian: Community Church</a>
</li>
<li>
<a href="#congregational_church"
title="http://research.ibm.com/ontologies/hspo/congregational_church">Christian: Congregational</a>
</li>
<li>
<a href="#eastern_orthodox"
title="http://research.ibm.com/ontologies/hspo/eastern_orthodox">Christian: Eastern Orthodox</a>
</li>
<li>
<a href="#episcopalian"
title="http://research.ibm.com/ontologies/hspo/episcopalian">Christian: Episcopalian</a>
</li>
<li>
<a href="#evangelical_church"
title="http://research.ibm.com/ontologies/hspo/evangelical_church">Christian: Evangelical Church</a>
</li>
<li>
<a href="#free_will_baptist"
title="http://research.ibm.com/ontologies/hspo/free_will_baptist">Christian: Free Will Baptist</a>
</li>
<li>
<a href="#friends_church"
title="http://research.ibm.com/ontologies/hspo/friends_church">Christian: Friends Church or Quakers</a>
</li>
<li>
<a href="#greek_orthodox"
title="http://research.ibm.com/ontologies/hspo/greek_orthodox">Christian: Greek Orthodox</a>
</li>
<li>
<a href="#jehovahs_witness"
title="http://research.ibm.com/ontologies/hspo/jehovahs_witness">Christian: Jehovahs Witness</a>
</li>
<li>
<a href="#latter_day_saints_church"
title="http://research.ibm.com/ontologies/hspo/latter_day_saints_church">Christian: Latter-day Saints</a>
</li>
<li>
<a href="#lutheran"
title="http://research.ibm.com/ontologies/hspo/lutheran">Christian: Lutheran</a>
</li>
<li>
<a href="#lutheran_missouri_synod"
title="http://research.ibm.com/ontologies/hspo/lutheran_missouri_synod">Christian: Lutheran Missouri Synod</a>
</li>
<li>
<a href="#mennonite"
title="http://research.ibm.com/ontologies/hspo/mennonite">Christian: Mennonite</a>
</li>
<li>
<a href="#methodist"
title="http://research.ibm.com/ontologies/hspo/methodist">Christian: Methodist</a>
</li>
<li>
<a href="#orthodox"
title="http://research.ibm.com/ontologies/hspo/orthodox">Christian: Orthodox</a>
</li>
<li>
<a href="#christian_other"
title="http://research.ibm.com/ontologies/hspo/christian_other">Christian: Other</a>
</li>
<li>
<a href="#other_pentecostal"
title="http://research.ibm.com/ontologies/hspo/other_pentecostal">Christian: Other Pentecostal</a>
</li>
<li>
<a href="#other_protestant"
title="http://research.ibm.com/ontologies/hspo/other_protestant">Christian: Other Protestant</a>
</li>
<li>
<a href="#pentecostal"
title="http://research.ibm.com/ontologies/hspo/pentecostal">Christian: Pentecostal</a>
</li>
<li>
<a href="#presbyterian"
title="http://research.ibm.com/ontologies/hspo/presbyterian">Christian: Presbyterian</a>
</li>
<li>
<a href="#protestant"
title="http://research.ibm.com/ontologies/hspo/protestant">Christian: Protestant</a>
</li>
<li>
<a href="#reformed_church"
title="http://research.ibm.com/ontologies/hspo/reformed_church">Christian: Reformed Church</a>
</li>
<li>
<a href="#rlds" title="http://research.ibm.com/ontologies/hspo/rlds">Christian: Reorganized Church of Jesus Christ of LDS</a>
</li>
<li>
<a href="#roman_catholic"
title="http://research.ibm.com/ontologies/hspo/roman_catholic">Christian: Roman Catholic</a>
</li>
<li>
<a href="#salvation_army"
title="http://research.ibm.com/ontologies/hspo/salvation_army">Christian: Salvation Army</a>
</li>
<li>
<a href="#seventh_day_adventist"
title="http://research.ibm.com/ontologies/hspo/seventh_day_adventist">Christian: Seventh Day Adventist</a>
</li>
<li>
<a href="#southern_baptist"
title="http://research.ibm.com/ontologies/hspo/southern_baptist">Christian: Southern Baptist Convention</a>
</li>
<li>
<a href="#unitarian"
title="http://research.ibm.com/ontologies/hspo/unitarian">Christian: Unitarian</a>
</li>
<li>
<a href="#unitarian_universalism"
title="http://research.ibm.com/ontologies/hspo/unitarian_universalism">Christian: Unitarian Universalism</a>
</li>
<li>
<a href="#united_church_of_christ"
title="http://research.ibm.com/ontologies/hspo/united_church_of_christ">Christian: United Church of Christ</a>
</li>
<li>
<a href="#united_methodist"
title="http://research.ibm.com/ontologies/hspo/united_methodist">Christian: United Methodist</a>
</li>
<li>
<a href="#wesleyan"
title="http://research.ibm.com/ontologies/hspo/wesleyan">Christian: Wesleyan</a>
</li>
<li>
<a href="#cohabitee_left_home"
title="http://research.ibm.com/ontologies/hspo/cohabitee_left_home">Cohabitee left home</a>
</li>
<li>
<a href="#cohabiting"
title="http://research.ibm.com/ontologies/hspo/cohabiting">Cohabiting</a>
</li>
<li>
<a href="#common_law_partnership"
title="http://research.ibm.com/ontologies/hspo/common_law_partnership">Common law partnership</a>
</li>
<li>
<a href="#confucianism"
title="http://research.ibm.com/ontologies/hspo/confucianism">Confucianism</a>
</li>
<li>
<a href="#divorced"
title="http://research.ibm.com/ontologies/hspo/divorced">Divorced</a>
</li>
<li>
<a href="#divorced_couple_sharing_house"
title="http://research.ibm.com/ontologies/hspo/divorced_couple_sharing_house">Divorced couple sharing house</a>
</li>
<li>
<a href="#domestic_partnership"
title="http://research.ibm.com/ontologies/hspo/domestic_partnership">Domestic partnership</a>
</li>
<li>
<a href="#elderly_relative_lives_with_family"
title="http://research.ibm.com/ontologies/hspo/elderly_relative_lives_with_family">Elderly relative lives with family</a>
</li>
<li>
<a href="#eloped" title="http://research.ibm.com/ontologies/hspo/eloped">Eloped</a>
</li>
<li>
<a href="#engaged_to_be_married"
title="http://research.ibm.com/ontologies/hspo/engaged_to_be_married">Engaged to be married</a>
</li>
<li>
<a href="#ethnic_religion"
title="http://research.ibm.com/ontologies/hspo/ethnic_religion">Ethnic Religion</a>
</li>
<li>
<a href="#feminine_gender"
title="http://research.ibm.com/ontologies/hspo/feminine_gender">Feminine gender</a>
</li>
<li>
<a href="#gender_unknown"
title="http://research.ibm.com/ontologies/hspo/gender_unknown">Gender unknown</a>
</li>
<li>
<a href="#gender_unspecified"
title="http://research.ibm.com/ontologies/hspo/gender_unspecified">Gender unspecified</a>
</li>
<li>
<a href="#hinduism"
title="http://research.ibm.com/ontologies/hspo/hinduism">Hinduism</a>
</li>
<li>
<a href="#hinduism_other"
title="http://research.ibm.com/ontologies/hspo/hinduism_other">Hinduism: Other</a>
</li>
<li>
<a href="#shaivism"
title="http://research.ibm.com/ontologies/hspo/shaivism">Hinduism: Shaivism</a>
</li>
<li>
<a href="#vaishnavism"
title="http://research.ibm.com/ontologies/hspo/vaishnavism">Hinduism: Vaishnavism</a>
</li>
<li>
<a href="#hispanic"
title="http://research.ibm.com/ontologies/hspo/hispanic">Hispanic</a>
</li>
<li>
<a href="#homosexual_marriage"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage">Homosexual marriage</a>
</li>
<li>
<a href="#homosexual_marriage_female"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage_female">Homosexual marriage, female</a>
</li>
<li>
<a href="#homosexual_marriage_male"
title="http://research.ibm.com/ontologies/hspo/homosexual_marriage_male">Homosexual marriage, male</a>
</li>
<li>
<a href="#husband_left_home"
title="http://research.ibm.com/ontologies/hspo/husband_left_home">Husband left home</a>
</li>
<li>
<a href="#indian" title="http://research.ibm.com/ontologies/hspo/indian">Indian</a>
</li>
<li>
<a href="#infant" title="http://research.ibm.com/ontologies/hspo/infant">Infant</a>
</li>
<li>
<a href="#medication_provisioning"
title="http://research.ibm.com/ontologies/hspo/medication_provisioning">Intervention by provisioning a medication</a>
</li>
<li>
<a href="#procedure_provisioning"
title="http://research.ibm.com/ontologies/hspo/procedure_provisioning">Intervention by provisioning a procedure</a>
</li>
<li>
<a href="#social_action_provisioning"
title="http://research.ibm.com/ontologies/hspo/social_action_provisioning">Intervention by provisioning a social action</a>
</li>
<li>
<a href="#jainism" title="http://research.ibm.com/ontologies/hspo/jainism">Jainism</a>
</li>
<li>
<a href="#judaism" title="http://research.ibm.com/ontologies/hspo/judaism">Judaism</a>
</li>
<li>
<a href="#conservative_judaism"
title="http://research.ibm.com/ontologies/hspo/conservative_judaism">Judaism: Conservative Judaism</a>
</li>
<li>
<a href="#jewish_renewal"
title="http://research.ibm.com/ontologies/hspo/jewish_renewal">Judaism: Jewish Renewal</a>
</li>
<li>
<a href="#orthodox_judaism"
title="http://research.ibm.com/ontologies/hspo/orthodox_judaism">Judaism: Orthodox Judaism</a>
</li>
<li>
<a href="#judaism_other"
title="http://research.ibm.com/ontologies/hspo/judaism_other">Judaism: Other</a>
</li>
<li>
<a href="#reconstructionist_judaism"
title="http://research.ibm.com/ontologies/hspo/reconstructionist_judaism">Judaism: Reconstructionist Judaism</a>
</li>
<li>
<a href="#reform_judaism"
title="http://research.ibm.com/ontologies/hspo/reform_judaism">Judaism: Reform Judaism</a>
</li>
<li>
<a href="#legally_separated_with_interlocutory_decree"
title="http://research.ibm.com/ontologies/hspo/legally_separated_with_interlocutory_decree">Legally separated with interlocutory decree</a>
</li>
<li>
<a href="#lives_alone"
title="http://research.ibm.com/ontologies/hspo/lives_alone">Lives alone</a>
</li>
<li>
<a href="#lives_alone_help_available"
title="http://research.ibm.com/ontologies/hspo/lives_alone_help_available">Lives alone, help available</a>
</li>
<li>
<a href="#lives_alone_needs_housekeeper"
title="http://research.ibm.com/ontologies/hspo/lives_alone_needs_housekeeper">Lives alone, needs housekeeper</a>
</li>
<li>
<a href="#lives_alone_no_help_available"
title="http://research.ibm.com/ontologies/hspo/lives_alone_no_help_available">Lives alone, no help available</a>
</li>
<li>
<a href="#lives_as_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_companion">Lives as companion</a>
</li>
<li>
<a href="#lives_as_paid_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_paid_companion">Lives as paid companion</a>
</li>
<li>
<a href="#lives_as_unpaid_companion"
title="http://research.ibm.com/ontologies/hspo/lives_as_unpaid_companion">Lives as unpaid companion</a>
</li>
<li>
<a href="#lives_in_a_commune"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_commune">Lives in a commune</a>
</li>
<li>
<a href="#lives_in_a_community"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_community">Lives in a community</a>
</li>
<li>
<a href="#lives_in_a_school_community"
title="http://research.ibm.com/ontologies/hspo/lives_in_a_school_community">Lives in a school community</a>
</li>
<li>
<a href="#lives_in_boarding_school"
title="http://research.ibm.com/ontologies/hspo/lives_in_boarding_school">Lives in boarding school</a>
</li>
<li>
<a href="#lives_with_children"
title="http://research.ibm.com/ontologies/hspo/lives_with_children">Lives with children</a>
</li>
<li>
<a href="#lives_with_companion"
title="http://research.ibm.com/ontologies/hspo/lives_with_companion">Lives with companion</a>
</li>
<li>
<a href="#lives_with_daughter"
title="http://research.ibm.com/ontologies/hspo/lives_with_daughter">Lives with daughter</a>
</li>
<li>
<a href="#lives_with_family"
title="http://research.ibm.com/ontologies/hspo/lives_with_family">Lives with family</a>
</li>
<li>
<a href="#lives_with_father"
title="http://research.ibm.com/ontologies/hspo/lives_with_father">Lives with father</a>
</li>
<li>
<a href="#lives_with_friends"
title="http://research.ibm.com/ontologies/hspo/lives_with_friends">Lives with friends</a>
</li>
<li>
<a href="#lives_with_grandfather"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandfather">Lives with grandfather</a>
</li>
<li>
<a href="#lives_with_grandmother"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandmother">Lives with grandmother</a>
</li>
<li>
<a href="#lives_with_grandparents"
title="http://research.ibm.com/ontologies/hspo/lives_with_grandparents">Lives with grandparents</a>
</li>
<li>
<a href="#lives_with_husband"
title="http://research.ibm.com/ontologies/hspo/lives_with_husband">Lives with husband</a>
</li>
<li>
<a href="#lives_with_lodger"
title="http://research.ibm.com/ontologies/hspo/lives_with_lodger">Lives with lodger</a>
</li>
<li>
<a href="#lives_with_mother"
title="http://research.ibm.com/ontologies/hspo/lives_with_mother">Lives with mother</a>
</li>
<li>
<a href="#lives_with_parents"
title="http://research.ibm.com/ontologies/hspo/lives_with_parents">Lives with parents</a>
</li>
<li>
<a href="#lives_with_partner"
title="http://research.ibm.com/ontologies/hspo/lives_with_partner">Lives with partner</a>
</li>
<li>
<a href="#lives_with_roommate"
title="http://research.ibm.com/ontologies/hspo/lives_with_roommate">Lives with roommate</a>
</li>
<li>
<a href="#lives_with_son"
title="http://research.ibm.com/ontologies/hspo/lives_with_son">Lives with son</a>
</li>
<li>
<a href="#lives_with_spouse"
title="http://research.ibm.com/ontologies/hspo/lives_with_spouse">Lives with spouse</a>
</li>
<li>
<a href="#lives_with_spouse_only"
title="http://research.ibm.com/ontologies/hspo/lives_with_spouse_only">Lives with spouse only</a>
</li>
<li>
<a href="#lives_with_wife"
title="http://research.ibm.com/ontologies/hspo/lives_with_wife">Lives with wife</a>
</li>
<li>
<a href="#living_temporarily_with_relatives"
title="http://research.ibm.com/ontologies/hspo/living_temporarily_with_relatives">Living temporarily with relatives</a>
</li>
<li>
<a href="#marital_state_unknown"
title="http://research.ibm.com/ontologies/hspo/marital_state_unknown">Marital state unknown</a>
</li>
<li>
<a href="#marriage_annulment"
title="http://research.ibm.com/ontologies/hspo/marriage_annulment">Marriage annulment</a>
</li>
<li>
<a href="#married" title="http://research.ibm.com/ontologies/hspo/married">Married</a>
</li>
<li>
<a href="#masculine_gender"
title="http://research.ibm.com/ontologies/hspo/masculine_gender">Masculine gender</a>
</li>
<li>
<a href="#middle_age_adult"
title="http://research.ibm.com/ontologies/hspo/middle_age_adult">Middle age adult</a>
</li>
<li>
<a href="#monogamous"
title="http://research.ibm.com/ontologies/hspo/monogamous">Monogamous</a>
</li>
<li>
<a href="#muslim" title="http://research.ibm.com/ontologies/hspo/muslim">Muslim</a>
</li>
<li>
<a href="#muslim_other"
title="http://research.ibm.com/ontologies/hspo/muslim_other">Muslim: Other</a>
</li>
<li>
<a href="#shia_islam"
title="http://research.ibm.com/ontologies/hspo/shia_islam">Muslim: Shia Islam</a>
</li>
<li>
<a href="#sunni_islam"
title="http://research.ibm.com/ontologies/hspo/sunni_islam">Muslim: Sunni Islam</a>
</li>
<li>
<a href="#native_american"
title="http://research.ibm.com/ontologies/hspo/native_american">Native American</a>
</li>
<li>
<a href="#new_religion"
title="http://research.ibm.com/ontologies/hspo/new_religion">New Religion Movement</a>
</li>
<li>
<a href="#newly_wed"
title="http://research.ibm.com/ontologies/hspo/newly_wed">Newly wed</a>
</li>
<li>
<a href="#nonreligious"
title="http://research.ibm.com/ontologies/hspo/nonreligious">Non religious</a>
</li>
<li>
<a href="#non_binary_gender"
title="http://research.ibm.com/ontologies/hspo/non_binary_gender">Non-binary gender</a>
</li>
<li>
<a href="#ongoing_intervention"
title="http://research.ibm.com/ontologies/hspo/ongoing_intervention">Ongoing intervention</a>
</li>
<li>
<a href="#other_religion"
title="http://research.ibm.com/ontologies/hspo/other_religion">Other religion</a>
</li>
<li>
<a href="#planned_intervention"
title="http://research.ibm.com/ontologies/hspo/planned_intervention">Planned intervention</a>
</li>
<li>
<a href="#polygamous"
title="http://research.ibm.com/ontologies/hspo/polygamous">Polygamous</a>
</li>
<li>
<a href="#purposely_unmarried_and_sexually_abstinent"
title="http://research.ibm.com/ontologies/hspo/purposely_unmarried_and_sexually_abstinent">Purposely unmarried and sexually abstinent</a>
</li>
<li>
<a href="#race_not_stated"
title="http://research.ibm.com/ontologies/hspo/race_not_stated">Race not stated</a>
</li>
<li>
<a href="#recommended_intervention"
title="http://research.ibm.com/ontologies/hspo/recommended_intervention">Recommended intervention</a>
</li>
<li>
<a href="#rejected_intervention"
title="http://research.ibm.com/ontologies/hspo/rejected_intervention">Rejected intervention</a>
</li>
<li>
<a href="#religion_unknown"
title="http://research.ibm.com/ontologies/hspo/religion_unknown">Religion is unknown</a>
</li>
<li>
<a href="#remarried"
title="http://research.ibm.com/ontologies/hspo/remarried">Remarried</a>
</li>
<li>
<a href="#senior_adult"
title="http://research.ibm.com/ontologies/hspo/senior_adult">Senior Adult</a>
</li>
<li>
<a href="#separated"
title="http://research.ibm.com/ontologies/hspo/separated">Separated</a>
</li>
<li>
<a href="#separated_from_cohabitee"
title="http://research.ibm.com/ontologies/hspo/separated_from_cohabitee">Separated from cohabitee</a>
</li>
<li>
<a href="#shinto" title="http://research.ibm.com/ontologies/hspo/shinto">Shinto or Shintoism</a>
</li>
<li>
<a href="#sikhism" title="http://research.ibm.com/ontologies/hspo/sikhism">Sikhism</a>
</li>
<li>
<a href="#single_person"
title="http://research.ibm.com/ontologies/hspo/single_person">Single person</a>
</li>
<li>
<a href="#single_never_married"
title="http://research.ibm.com/ontologies/hspo/single_never_married">Single, never married</a>
</li>
<li>
<a href="#spinster"
title="http://research.ibm.com/ontologies/hspo/spinster">Spinster</a>
</li>
<li>
<a href="#spiritualism"
title="http://research.ibm.com/ontologies/hspo/spiritualism">Spiritualism</a>
</li>
<li>
<a href="#spouse_left_home"
title="http://research.ibm.com/ontologies/hspo/spouse_left_home">Spouse left home</a>
</li>
<li>
<a href="#transgender_female_to_male"
title="http://research.ibm.com/ontologies/hspo/transgender_female_to_male">Surgically transgendered transsexual, female-to-male</a>
</li>
<li>
<a href="#transgender_male_to_female"
title="http://research.ibm.com/ontologies/hspo/transgender_male_to_female">Surgically transgendered transsexual, male-to-female</a>
</li>
<li>
<a href="#teen" title="http://research.ibm.com/ontologies/hspo/teen">Teenager</a>
</li>
<li>
<a href="#toddler" title="http://research.ibm.com/ontologies/hspo/toddler">Toddler</a>
</li>
<li>
<a href="#transgender"
title="http://research.ibm.com/ontologies/hspo/transgender">Transgender</a>
</li>
<li>
<a href="#trial_separation"
title="http://research.ibm.com/ontologies/hspo/trial_separation">Trial separation</a>
</li>
<li>
<a href="#under_five"
title="http://research.ibm.com/ontologies/hspo/under_five">Under 5</a>
</li>
<li>
<a href="#race_unknown"
title="http://research.ibm.com/ontologies/hspo/race_unknown">Unknown racial group</a>
</li>
<li>
<a href="#widow" title="http://research.ibm.com/ontologies/hspo/widow">Widow</a>
</li>
<li>
<a href="#widowed" title="http://research.ibm.com/ontologies/hspo/widowed">Widowed</a>
</li>
<li>
<a href="#widower" title="http://research.ibm.com/ontologies/hspo/widower">Widower</a>
</li>
<li>
<a href="#wife_left_home"
title="http://research.ibm.com/ontologies/hspo/wife_left_home">Wife left home</a>
</li>
</ul>
<div class="entity" id="ten_to_fourteen">
<h3>10 to 14<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/ten_to_fourteen</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="fifteen_to_nineteen">
<h3>15 to 19<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/fifteen_to_nineteen</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="twenty_to_twentyfour">
<h3>20 to 24<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/twenty_to_twentyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="twentyfive_to_twentynine">
<h3>25 to 29<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/twentyfive_to_twentynine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="thirty_to_thirtyfour">
<h3>30 to 34<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/thirty_to_thirtyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="thirtyfive_to_thirtynine">
<h3>35 to 39<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/thirtyfive_to_thirtynine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="forty_to_fortyfour">
<h3>40 to 44<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/forty_to_fortyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="fortyfive_to_fortynine">
<h3>45 to 49<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/fortyfive_to_fortynine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="five_to_nine">
<h3>5 to 9<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/five_to_nine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="fifty_to_fiftyfour">
<h3>50 to 54<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/fifty_to_fiftyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="fiftyfive_to_fiftynine">
<h3>55 to 59<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/fiftyfive_to_fiftynine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="sixty_to_sixtyfour">
<h3>60 to 64<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/sixty_to_sixtyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="sixtyfive_to_sixtynine">
<h3>65 to 69<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/sixtyfive_to_sixtynine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="seventy_to_seventyfour">
<h3>70 to 74<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/seventy_to_seventyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="seventyfive_to_seventynine">
<h3>75 to 79<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/seventyfive_to_seventynine</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="eighty_to_eightyfour">
<h3>80 to 84<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/eighty_to_eightyfour</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="eightyfive_and_over">
<h3>85 and over<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/eightyfive_and_over</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="adult">
<h3>Adult<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/adult</p>
<div class="comment">
<span class="markdown">20-39 years old</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="african_race">
<h3>African race<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/african_race</p>
<div class="comment">
<span class="markdown">African race (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="agnosticism">
<h3>Agnosticism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/agnosticism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="american_indian_or_alaska_native">
<h3>American Indian or Alaska native<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/american_indian_or_alaska_native</p>
<div class="comment">
<span class="markdown">American Indian or Alaska native (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="applied_intervention">
<h3>Applied intervention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/applied_intervention</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="asian_or_pacific_islander">
<h3>Asian or Pacific islander<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/asian_or_pacific_islander</p>
<div class="comment">
<span class="markdown">Asian or Pacific islander (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="atheism">
<h3>Atheism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/atheism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="australian_aborigine">
<h3>Australian aborigine<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/australian_aborigine</p>
<div class="comment">
<span class="markdown">Australian aborigine (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="available_intervention">
<h3>Available intervention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/available_intervention</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="bachelor">
<h3>Bachelor<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/bachelor</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="bahai">
<h3>Baha'i Faith<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/bahai</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="broken_engagement">
<h3>Broken engagement<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/broken_engagement</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="broken_with_partner">
<h3>Broken with partner<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/broken_with_partner</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="buddhism">
<h3>Buddhism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/buddhism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="mahayana">
<h3>Buddhism: Mahayana<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/mahayana</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="buddhism_other">
<h3>Buddhism: Other<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/buddhism_other</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="tantrayana">
<h3>Buddhism: Tantrayana<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/tantrayana</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="theravada">
<h3>Buddhism: Theravada<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/theravada</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="caucasian">
<h3>Caucasian<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/caucasian</p>
<div class="comment">
<span class="markdown">Caucasian (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="child">
<h3>Child<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/child</p>
<div class="comment">
<span class="markdown">5-12 years old</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="child_lives_with_unrelated_adult">
<h3>Child lives with unrelated adult<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/child_lives_with_unrelated_adult</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="chinese_folk_religion">
<h3>Chinese Folk Religion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/chinese_folk_religion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="christian">
<h3>Christian<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/christian</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="african_methodist_episcopal">
<h3>Christian: African Methodist Episcopal<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/african_methodist_episcopal</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="african_methodist_episcopal_zion">
<h3>Christian: African Methodist Episcopal Zion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/african_methodist_episcopal_zion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="american_baptist_church">
<h3>Christian: American Baptist Church<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/american_baptist_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="anglican">
<h3>Christian: Anglican<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/anglican</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="assembly_of_god">
<h3>Christian: Assembly of God<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/assembly_of_god</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="aptist_church">
<h3>Christian: Baptist Church<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/aptist_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="christian_missionary_alliance">
<h3>Christian: Christian Missionary Alliance<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/christian_missionary_alliance</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="christian_reformed">
<h3>Christian: Christian Reformed<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/christian_reformed</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="christian_science">
<h3>Christian: Christian Science Church<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/christian_science</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="church_of_christ">
<h3>Christian: Church of Christ<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/church_of_christ</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="church_of_god">
<h3>Christian: Church of God<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/church_of_god</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="church_of_god_in_christ">
<h3>Christian: Church of God in Christ<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/church_of_god_in_christ</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="church_of_the_nazarene">
<h3>Christian: Church of the Nazarene<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/church_of_the_nazarene</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="community_church">
<h3>Christian: Community Church<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/community_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="congregational_church">
<h3>Christian: Congregational<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/congregational_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="eastern_orthodox">
<h3>Christian: Eastern Orthodox<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/eastern_orthodox</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="episcopalian">
<h3>Christian: Episcopalian<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/episcopalian</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="evangelical_church">
<h3>Christian: Evangelical Church<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/evangelical_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="free_will_baptist">
<h3>Christian: Free Will Baptist<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/free_will_baptist</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="friends_church">
<h3>Christian: Friends Church or Quakers<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/friends_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="greek_orthodox">
<h3>Christian: Greek Orthodox<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/greek_orthodox</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="jehovahs_witness">
<h3>Christian: Jehovahs Witness<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/jehovahs_witness</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="latter_day_saints_church">
<h3>Christian: Latter-day Saints<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/latter_day_saints_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lutheran">
<h3>Christian: Lutheran<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lutheran</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lutheran_missouri_synod">
<h3>Christian: Lutheran Missouri Synod<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lutheran_missouri_synod</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="mennonite">
<h3>Christian: Mennonite<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/mennonite</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="methodist">
<h3>Christian: Methodist<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/methodist</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="orthodox">
<h3>Christian: Orthodox<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/orthodox</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="christian_other">
<h3>Christian: Other<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/christian_other</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="other_pentecostal">
<h3>Christian: Other Pentecostal<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/other_pentecostal</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="other_protestant">
<h3>Christian: Other Protestant<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/other_protestant</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="pentecostal">
<h3>Christian: Pentecostal<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/pentecostal</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="presbyterian">
<h3>Christian: Presbyterian<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/presbyterian</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="protestant">
<h3>Christian: Protestant<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/protestant</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="reformed_church">
<h3>Christian: Reformed Church<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/reformed_church</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="rlds">
<h3>Christian: Reorganized Church of Jesus Christ of LDS<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/rlds</p>
<div class="comment">
<span class="markdown">Christian: Reorganized Church of Jesus Christ of Latter Day Saints (RLDS)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="roman_catholic">
<h3>Christian: Roman Catholic<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/roman_catholic</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="salvation_army">
<h3>Christian: Salvation Army<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/salvation_army</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="seventh_day_adventist">
<h3>Christian: Seventh Day Adventist<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/seventh_day_adventist</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="southern_baptist">
<h3>Christian: Southern Baptist Convention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/southern_baptist</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="unitarian">
<h3>Christian: Unitarian<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/unitarian</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="unitarian_universalism">
<h3>Christian: Unitarian Universalism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/unitarian_universalism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="united_church_of_christ">
<h3>Christian: United Church of Christ<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/united_church_of_christ</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="united_methodist">
<h3>Christian: United Methodist<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/united_methodist</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="wesleyan">
<h3>Christian: Wesleyan<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/wesleyan</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="cohabitee_left_home">
<h3>Cohabitee left home<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/cohabitee_left_home</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="cohabiting">
<h3>Cohabiting<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/cohabiting</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="common_law_partnership">
<h3>Common law partnership<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/common_law_partnership</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="confucianism">
<h3>Confucianism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/confucianism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="divorced">
<h3>Divorced<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/divorced</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="divorced_couple_sharing_house">
<h3>Divorced couple sharing house<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/divorced_couple_sharing_house</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="domestic_partnership">
<h3>Domestic partnership<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/domestic_partnership</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="elderly_relative_lives_with_family">
<h3>Elderly relative lives with family<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/elderly_relative_lives_with_family</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="eloped">
<h3>Eloped<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/eloped</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="engaged_to_be_married">
<h3>Engaged to be married<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/engaged_to_be_married</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="ethnic_religion">
<h3>Ethnic Religion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/ethnic_religion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="feminine_gender">
<h3>Feminine gender<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/feminine_gender</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="gender_unknown">
<h3>Gender unknown<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/gender_unknown</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="gender_unspecified">
<h3>Gender unspecified<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/gender_unspecified</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="hinduism">
<h3>Hinduism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hinduism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="hinduism_other">
<h3>Hinduism: Other<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hinduism_other</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="shaivism">
<h3>Hinduism: Shaivism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/shaivism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="vaishnavism">
<h3>Hinduism: Vaishnavism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/vaishnavism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="hispanic">
<h3>Hispanic<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/hispanic</p>
<div class="comment">
<span class="markdown">Hispanic (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="homosexual_marriage">
<h3>Homosexual marriage<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/homosexual_marriage</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="homosexual_marriage_female">
<h3>Homosexual marriage, female<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/homosexual_marriage_female</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="homosexual_marriage_male">
<h3>Homosexual marriage, male<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/homosexual_marriage_male</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="husband_left_home">
<h3>Husband left home<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/husband_left_home</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="indian">
<h3>Indian<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/indian</p>
<div class="comment">
<span class="markdown">Indian (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="infant">
<h3>Infant<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/infant</p>
<div class="comment">
<span class="markdown">0-1 years old</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="medication_provisioning">
<h3>Intervention by provisioning a medication<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/medication_provisioning</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionByProvisioning"
title="http://research.ibm.com/ontologies/hspo/InterventionByProvisioning">Intervention by Provisioning</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="procedure_provisioning">
<h3>Intervention by provisioning a procedure<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/procedure_provisioning</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionByProvisioning"
title="http://research.ibm.com/ontologies/hspo/InterventionByProvisioning">Intervention by Provisioning</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="social_action_provisioning">
<h3>Intervention by provisioning a social action<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/social_action_provisioning</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionByProvisioning"
title="http://research.ibm.com/ontologies/hspo/InterventionByProvisioning">Intervention by Provisioning</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="jainism">
<h3>Jainism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/jainism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="judaism">
<h3>Judaism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/judaism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="conservative_judaism">
<h3>Judaism: Conservative Judaism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/conservative_judaism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="jewish_renewal">
<h3>Judaism: Jewish Renewal<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/jewish_renewal</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="orthodox_judaism">
<h3>Judaism: Orthodox Judaism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/orthodox_judaism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="judaism_other">
<h3>Judaism: Other<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/judaism_other</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="reconstructionist_judaism">
<h3>Judaism: Reconstructionist Judaism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/reconstructionist_judaism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="reform_judaism">
<h3>Judaism: Reform Judaism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/reform_judaism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="legally_separated_with_interlocutory_decree">
<h3>Legally separated with interlocutory decree<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/legally_separated_with_interlocutory_decree</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_alone">
<h3>Lives alone<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_alone</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_alone_help_available">
<h3>Lives alone, help available<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_alone_help_available</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_alone_needs_housekeeper">
<h3>Lives alone, needs housekeeper<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_alone_needs_housekeeper</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_alone_no_help_available">
<h3>Lives alone, no help available<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_alone_no_help_available</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_as_companion">
<h3>Lives as companion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_as_companion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_as_paid_companion">
<h3>Lives as paid companion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_as_paid_companion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_as_unpaid_companion">
<h3>Lives as unpaid companion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_as_unpaid_companion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_in_a_commune">
<h3>Lives in a commune<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_in_a_commune</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_in_a_community">
<h3>Lives in a community<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_in_a_community</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_in_a_school_community">
<h3>Lives in a school community<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_in_a_school_community</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_in_boarding_school">
<h3>Lives in boarding school<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_in_boarding_school</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_children">
<h3>Lives with children<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_children</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_companion">
<h3>Lives with companion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_companion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_daughter">
<h3>Lives with daughter<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_daughter</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_family">
<h3>Lives with family<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_family</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_father">
<h3>Lives with father<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_father</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_friends">
<h3>Lives with friends<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_friends</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_grandfather">
<h3>Lives with grandfather<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_grandfather</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_grandmother">
<h3>Lives with grandmother<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_grandmother</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_grandparents">
<h3>Lives with grandparents<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_grandparents</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_husband">
<h3>Lives with husband<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_husband</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_lodger">
<h3>Lives with lodger<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_lodger</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_mother">
<h3>Lives with mother<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_mother</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_parents">
<h3>Lives with parents<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_parents</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_partner">
<h3>Lives with partner<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_partner</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_roommate">
<h3>Lives with roommate<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_roommate</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_son">
<h3>Lives with son<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_son</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_spouse">
<h3>Lives with spouse<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_spouse</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_spouse_only">
<h3>Lives with spouse only<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_spouse_only</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="lives_with_wife">
<h3>Lives with wife<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/lives_with_wife</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="living_temporarily_with_relatives">
<h3>Living temporarily with relatives<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/living_temporarily_with_relatives</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Household"
title="http://research.ibm.com/ontologies/hspo/Household">Household Composition</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="marital_state_unknown">
<h3>Marital state unknown<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/marital_state_unknown</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="marriage_annulment">
<h3>Marriage annulment<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/marriage_annulment</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="married">
<h3>Married<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/married</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="masculine_gender">
<h3>Masculine gender<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/masculine_gender</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="middle_age_adult">
<h3>Middle age adult<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/middle_age_adult</p>
<div class="comment">
<span class="markdown">40-59 years old</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="monogamous">
<h3>Monogamous<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/monogamous</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="muslim">
<h3>Muslim<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/muslim</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="muslim_other">
<h3>Muslim: Other<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/muslim_other</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="shia_islam">
<h3>Muslim: Shia Islam<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/shia_islam</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="sunni_islam">
<h3>Muslim: Sunni Islam<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/sunni_islam</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="native_american">
<h3>Native American<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/native_american</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="new_religion">
<h3>New Religion Movement<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/new_religion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="newly_wed">
<h3>Newly wed<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/newly_wed</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="nonreligious">
<h3>Non religious<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/nonreligious</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="non_binary_gender">
<h3>Non-binary gender<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/non_binary_gender</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="ongoing_intervention">
<h3>Ongoing intervention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/ongoing_intervention</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="other_religion">
<h3>Other religion<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/other_religion</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="planned_intervention">
<h3>Planned intervention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/planned_intervention</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="polygamous">
<h3>Polygamous<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/polygamous</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="purposely_unmarried_and_sexually_abstinent">
<h3>Purposely unmarried and sexually abstinent<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/purposely_unmarried_and_sexually_abstinent</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="race_not_stated">
<h3>Race not stated<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/race_not_stated</p>
<div class="comment">
<span class="markdown">Race not stated (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="recommended_intervention">
<h3>Recommended intervention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/recommended_intervention</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="rejected_intervention">
<h3>Rejected intervention<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/rejected_intervention</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#InterventionStatus"
title="http://research.ibm.com/ontologies/hspo/InterventionStatus">Intervention Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="religion_unknown">
<h3>Religion is unknown<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/religion_unknown</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="remarried">
<h3>Remarried<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/remarried</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="senior_adult">
<h3>Senior Adult<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/senior_adult</p>
<div class="comment">
<span class="markdown">60+ years old adult</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="separated">
<h3>Separated<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/separated</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="separated_from_cohabitee">
<h3>Separated from cohabitee<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/separated_from_cohabitee</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="shinto">
<h3>Shinto or Shintoism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/shinto</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="sikhism">
<h3>Sikhism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/sikhism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="single_person">
<h3>Single person<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/single_person</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="single_never_married">
<h3>Single, never married<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/single_never_married</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="spinster">
<h3>Spinster<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/spinster</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="spiritualism">
<h3>Spiritualism<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/spiritualism</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Religion"
title="http://research.ibm.com/ontologies/hspo/Religion">Religion</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="spouse_left_home">
<h3>Spouse left home<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/spouse_left_home</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="transgender_female_to_male">
<h3>Surgically transgendered transsexual, female-to-male<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/transgender_female_to_male</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="transgender_male_to_female">
<h3>Surgically transgendered transsexual, male-to-female<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/transgender_male_to_female</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="teen">
<h3>Teenager<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/teen</p>
<div class="comment">
<span class="markdown">13-19 years old</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="toddler">
<h3>Toddler<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/toddler</p>
<div class="comment">
<span class="markdown">2-4 years old</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#StageOfLife"
title="http://research.ibm.com/ontologies/hspo/StageOfLife">Stage of life</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="transgender">
<h3>Transgender<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/transgender</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#Gender" title="http://research.ibm.com/ontologies/hspo/Gender">Gender</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="trial_separation">
<h3>Trial separation<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/trial_separation</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="under_five">
<h3>Under 5<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/under_five</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#AgeGroup" title="http://research.ibm.com/ontologies/hspo/AgeGroup">Age group</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="race_unknown">
<h3>Unknown racial group<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/race_unknown</p>
<div class="comment">
<span class="markdown">Unknown racial group (racial group)</span>
</div>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#RaceAndEthnicity"
title="http://research.ibm.com/ontologies/hspo/RaceAndEthnicity">Race and Ethnicity</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="widow">
<h3>Widow<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/widow</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="widowed">
<h3>Widowed<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/widowed</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="widower">
<h3>Widower<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/widower</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
<div class="entity" id="wife_left_home">
<h3>Wife left home<sup class="type-ni" title="named individual">ni</sup>
<span class="backlink"> back to <a href="#toc">ToC</a> or <a href="#namedindividuals">Named Individual ToC</a>
</span>
</h3>
<p>
<strong>IRI:</strong> http://research.ibm.com/ontologies/hspo/wife_left_home</p>
<dl class="description">
<dt>belongs to</dt>
<dd>
<a href="#MaritalStatus"
title="http://research.ibm.com/ontologies/hspo/MaritalStatus">Marital Status</a>
<sup class="type-c" title="class">c</sup>
</dd>
</dl>
</div>
</div><div id="legend">
<h2>Legend <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
<div class="entity">
<sup class="type-c" title="Classes">c</sup>: Classes <br/>
<sup class="type-op" title="Object Properties">op</sup>: Object Properties <br/>
<sup class="type-dp" title="Data Properties">dp</sup>: Data Properties <br/>
<sup class="type-ni" title="Named Individuals">ni</sup>: Named Individuals
</div>
</div>
</div>
<!--REFERENCES SECTION-->
<div id="references">
<h2 id="ref" class="list">References <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
<span class="markdown">
Add your references here. It is recommended to have them as a list.</span>
</div>
<div id="acknowledgments">
<h2 id="ack" class="list">Acknowledgments <span class="backlink"> back to <a href="#toc">ToC</a></span></h2>
<p>
The authors would like to thank <a href="http://www.essepuntato.it/">Silvio Peroni</a> for developing <a href="http://www.essepuntato.it/lode">LODE</a>, a Live OWL Documentation Environment, which is used for representing the Cross Referencing Section of this document and <a href="https://w3id.org/people/dgarijo">Daniel Garijo</a> for developing <a href="https://github.com/dgarijo/Widoco">Widoco</a>, the program used to create the template used in this documentation.</p>
</div>
</div>
</body>
</html> | 397,618 | 43.701405 | 694 | html |
null | hspo-ontology-main/docs/ontology-specification/resources/extra.css | body {
text-align: justify;
}
h1 {
line-height: 110%;
}
.hlist {
border: 1px solid navy;
padding:5px;
background-color: #F4FFFF;
}
.hlist li {
display: inline;
display: inline-table;
list-style-type: none;
padding-right: 20px;
}
.entity {
border: 1px solid navy;
margin:5px 0px 5px 0px;
padding: 5px;
}
.type-c {
cursor:help;
color:orange;
}
.type-op {
cursor:help;
color:navy;
}
.type-dp {
cursor:help;
color:green;
}
.type-ap {
cursor:help;
color:maroon;
}
.type-ni {
cursor:help;
color:brown;
}
.logic {
color:purple;
font-weight:bold;
}
h3 {
margin-top: 3px;
padding-bottom: 5px;
border-bottom: 1px solid navy;
}
h2 {
margin-top:40px;
}
.dotted {
border-bottom: 1px dotted gray;
}
dt {
margin-top:5px;
}
.description {
border-top: 1px dashed gray;
border-bottom: 1px dashed gray;
background-color: rgb(242, 243, 244);
margin-top:5px;
padding-bottom:5px;
}
.description dl {
background-color: rgb(242, 243, 244);
}
.description ul {
padding-left: 12px;
margin-top: 0px;
}
.backlink {
font-size:10pt;
text-align:right;
float:right;
color:black;
padding: 2px;
border: 1px dotted navy;
background-color: #F4FFFF;
}
.imageblock {
text-align: center;
}
.imageblock img {
border:1px solid gray;
}
.endnote {
margin-top: 40px;
border-top: 1px solid gray;
padding-top: 10px;
text-align: center;
color:gray;
font-size:70%;
}
.literal {
color:green;
font-style:italic;
} | 1,620 | 12.072581 | 41 | css |
null | hspo-ontology-main/docs/ontology-specification/resources/owl.css | .RFC2119 {
text-transform: lowercase;
font-style: italic;
}
.nonterminal {
font-weight: bold;
font-family: sans-serif;
font-size: 95%;
}
#abstract br {
/* doesn't work right SOMETIMES
margin-bottom: 1em; */
}
.name {
font-family: monospace;
}
.buttonpanel {
margin-top: 1ex;
margin-bottom: 1ex;
padding-left: 1ex;
padding-right: 1ex;
padding-top: 1ex;
padding-bottom: 0.6ex;
border: 1px dotted black;
}
.grammar {
margin-top: 1ex;
margin-bottom: 1ex;
padding-left: 1ex;
padding-right: 1ex;
padding-top: 1ex;
padding-bottom: 0.6ex;
border: 1px dashed #2f6fab;
font-family: monospace;
}
.image {
text-align: center;
}
.centered {
text-align: center;
padding-top: 4ex;
padding-bottom: 4ex;
}
.centered table {
margin: 0 auto;
text-align: left;
}
.caption {
font-weight: bold;
}
.indent {
margin-left: 20px;
}
.atrisknote {
padding: 5px;
margin-top: 10px;
margin-bottom: 10px;
border: solid 2px blue;
background-color: #FFA;
}
.atrisknotehead {
font-style: italic;
}
/* Stying the examples. */
.anexample:before {
content: "Example:";
font-family: sans-serif;
font-size: 1.6ex;
font-weight: bold;
}
.anexample {
margin-top: 1ex;
margin-bottom: 1ex;
padding-left: 1ex;
padding-right: 1ex;
padding-top: 1ex;
padding-bottom: 0.6ex;
border: 1px dashed #2f6fab;
background-color: #f9f9f9;
}
.anexample table {
background-color: #f9f9f9;
}
/* Styling the parts in the functional-style syntax. */
div.fss {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
font-family: monospace;
}
table.fss {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
width: 100%;
}
table.fss caption.fss {
font-size: 1.5ex;
font-weight: bold;
text-align: left;
padding-left: 10px;
}
table.fss td:first-child {
font-family: monospace;
padding-left: 20px;
padding-right: 20px;
width: 60%;
}
table{
background-color: #f4ffff;
border: 1px solid navy;
margin: 20px;
vertical-align: middle;
}
table td {
padding: 5px 15px;
text-align: left;
}
/* Styling the parts in the RDF syntax. */
div.rdf{
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
font-family: monospace;
}
table.rdf {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
width: 100%;
}
table.rdf caption.rdf {
font-size: 1.5ex;
font-weight: bold;
text-align: left;
padding-left: 10px;
}
table.rdf td:first-child {
font-family: monospace;
padding-left: 20px;
padding-right: 20px;
width: 60%;
}
/* Styling the XML syntax. */
div.xmlsyn {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
font-family: monospace;
}
div.axioms {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
}
/* Other styles. */
table.complexity td {
text-align: center;
}
table.allname td {
font-family: monospace;
}
table.canonicalparsing {
margin-left: 20px;
border-style: none;
}
table.canonicalparsing td {
vertical-align: top;
padding: 2px 2px 2px 2px;
}
table.canonicalparsing td.two {
padding-left: 30px;
}
/* The following are classes for templates used in the editing process. */
.review {
padding: 5px;
border: solid 1px black;
margin-left: 10%;
margin-top: 10px;
margin-bottom: 10px;
background-color: #FFA;
font-size: smaller;
}
.reviewauthor {
font-size: smaller;
font-style: italic;
}
.ednote {
padding: 5px;
border: solid 1px black;
margin-top: 10px;
margin-bottom: 10px;
}
.ednotehead {
font-weight: bold;
}
/* override mediawiki's beautiful DL styling... */
dl {
background: white;
width: 100%;
border: none;
margin-top: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
}
div {
margin-top: 0;
margin-bottom: 0;
}
#fulltitle {
font-size: 140%;
font-weight: bold;
}
.xml {
color: red
}
.rdbms{
color: red
}
/* just copying from wiki, so it stays through TR. Currently
affects Primer, at least */
pre {
background-color:#F9F9F9;
border:1px dashed #2F6FAB;
color:black;
line-height:1.1em;
padding:1em;
} | 4,389 | 16.701613 | 74 | css |
null | hspo-ontology-main/docs/ontology-specification/resources/primer.css | /* define a class "noprint" for sections which don't get printed */
.noprint { display: none; }
/* our syntax menu for switching */
div.syntaxmenu {
border: 1px dotted black;
padding:0.5em;
margin: 1em;
}
.container {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px;
}
@media print {
div.syntaxmenu { display:none; }
}
/* use tab-like headers for syntax examples */
div.exampleheader {
font-size: 90%;
float: left;
background: #F9F9F9;
color: #2F6FAB;
border: 1px dashed #2F6FAB;
border-bottom: 0px;
padding-top: 2px;
}
div.exampleheader span.exampleheader {
background: #F9F9F9;
padding-top: 0px;
padding-right: 10px;
padding-left: 10px;
padding-bottom: 3px;
padding-top: 0px;
}
/* Also copy MediaWiki style here, so it will not look different when exported */
div.fssyntax pre, div.rdfxml pre, div.owlxml pre, div.turtle pre, div.manchester pre {
background-color: #F9F9F9;
border: 1px dashed #2F6FAB;
color: black;
line-height: 1.1em;
padding: 1em;
clear: both;
margin-left: 0em;
}
/* Expansion to add the status*/
.status {
position: fixed;
left: 0em;
top: 0em;
text-align: right;
vertical-align: middle;
/* Square version of the inside span. Slightly larger */
width: 26em;
height: 26em;
z-index: -1;
opacity: 0.8;
/** From http://stackoverflow.com/questions/1080792/how-to-draw-vertical-text-with-css-cross-browser */
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
/* also accepts left, right, top, bottom coordinates; not
* required, but a good idea for styling */
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
/* Should be unset in IE9+ I think. */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
/* The actual status box */
.status div {
display: block;
background: rgb(0, 90, 156);
color: white;
width: 24em;
padding-top: 0.3em;
padding-left: 0em;
padding-right: 5em;
padding-bottom: 0.3em;
/* Enable for debugging
border: red thin solid;
*/
}
/* And text inside, don't confuse fonts as it breaks em above */
.status div span {
font-family: "Tauri";
font-size: larger;
} | 2,491 | 23.194175 | 107 | css |
null | hspo-ontology-main/docs/ontology-specification/resources/rec.css | /* Style for a "Recommendation" */
/*
Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved.
The following software licensing rules apply:
http://www.w3.org/Consortium/Legal/copyright-software */
/* $Id: base.css,v 1.25 2006/04/18 08:42:53 bbos Exp $ */
body {
padding: 2em 1em 2em 70px;
margin: 0;
font-family: sans-serif;
color: black;
background: white;
background-position: top left;
background-attachment: fixed;
background-repeat: no-repeat;
counter-reset:section;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a:active { color: #C00; background: transparent }
a:link img, a:visited img { border-style: none } /* no border on img links */
a img { color: white; } /* trick to hide the border in Netscape 4 */
@media all { /* hide the next rule from Netscape 4 */
a img { color: inherit; } /* undo the color change above */
}
th, td { /* ns 4 */
font-family: sans-serif;
}
h1, h2, h3, h4, h5, h6 { text-align: left }
h2.list{counter-reset:subsection }
h2.list:before{counter-increment:section;content: counter(section) ". ";}
h3.list:before{counter-increment:subsection;content: counter(section) "." counter(subsection) ". ";
}
h3.list{margin-top: 20px;
border-bottom: 0px; }
/* background should be transparent, but WebTV has a bug */
h1, h2, h3 { color: #005A9C; background: white }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
@media screen { /* hide from IE3 */
a[href]:hover { background: #ffa }
}
pre { margin-left: 2em }
/*
p {
margin-top: 0.6em;
margin-bottom: 0.6em;
}
*/
dt, dd { margin-top: 0; margin-bottom: 0 } /* opera 3.50 */
dt { font-weight: bold }
pre, code { font-family: monospace } /* navigator 4 requires this */
ul.toc, ol.toc {
list-style: disc; /* Mac NS has problem with 'none' */
list-style: none;
}
@media aural {
h1, h2, h3 { stress: 20; richness: 90 }
.hide { speak: none }
p.copyright { volume: x-soft; speech-rate: x-fast }
dt { pause-before: 20% }
pre { speak-punctuation: code }
}
| 2,459 | 26.640449 | 99 | css |
null | hspo-ontology-main/docs/ontology-specification/webvowl/index.html | <!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta name="author" content="Vincent Link, Steffen Lohmann, Eduard Marbach, Stefan Negru, Vitalis Wiens" />
<meta name="keywords" content="webvowl, vowl, visual notation, web ontology language, owl, rdf, ontology visualization, ontologies, semantic web" />
<meta name="description" content="WebVOWL - Web-based Visualization of Ontologies" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" type="text/css" href="css/webvowl.css" />
<link rel="stylesheet" type="text/css" href="css/webvowl.app.css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<title>WebVOWL</title>
</head>
<body>
<main>
<section id="canvasArea">
<div id="browserCheck" class="hidden">
WebVOWL does not work properly in Internet Explorer and Microsoft Edge.
Please use another browser, such as
<a href="http://www.mozilla.org/firefox/">Mozilla Firefox</a>
or
<a href="https://www.google.com/chrome/">Google Chrome</a>,
to run WebVOWL.
<label id="killWarning">Hide warning</label>
</div>
<div id="logo" class="noselect">
<h2>WebVOWL
<br> <span>1.1.7</span>
</h2>
</div>
<div id="loading-info" class="hidden">
<div id="loading-progress" style="border-radius: 10px;">
<div class="hidden">Loading ontology...</div>
<div id="layoutLoadingProgressBarContainer" style="padding-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
<h4 id="currentLoadingStep" style="margin: 0;font-style: italic; padding-bottom:0 ; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
Layout optimization</h4>
<div id="progressBarContext">
<div id="progressBarValue" class="busyProgressBar"></div>
</div>
</div>
<div id="loadingInfo_msgBox" style="padding-bottom: 0;padding-top:0">
<div id="show-loadingInfo-button" class="accordion-trigger noselect">Details</div>
<div id="loadingInfo-container">
<ul id="bulletPoint_container"></ul>
</div>
</div>
<div>
<span id="loadingIndicator_closeButton" class="">Close Warning</span>
</div>
</div>
</div>
<div id="additionalInformationContainer">
<div id="reloadCachedOntology" class="hidden" title="">
<svg viewBox="38 -12.5 18 18" class="reloadCachedOntologyIcon btn_shadowed" id="reloadSvgIcon">
<g>
<text id="svgStringText" dx="5px" dy="-1px" style="font-size:9px;">Reload ontology</text>
<path style="fill : #444; stroke-width:0;" d="m 42.277542,5.1367119 c -5.405,0 -10.444,1.577 -14.699,4.282 l -5.75,-5.75 0,16.1100001 16.11,0 -6.395,-6.395 c 3.18,-1.787 6.834,-2.82 10.734,-2.82 12.171,0 22.073,9.902 22.073,22.074 0,2.899 -0.577,5.664 -1.599,8.202 l 4.738,2.762 c 1.47,-3.363 2.288,-7.068 2.288,-10.964 0,-15.164 -12.337,-27.5010001 -27.5,-27.5010001 m 11.5,46.7460001 c -3.179,1.786 -6.826,2.827 -10.726,2.827 -12.171,0 -22.073,-9.902 -22.073,-22.073 0,-2.739 0.524,-5.35 1.439,-7.771 l -4.731,-2.851 c -1.375,3.271 -2.136,6.858 -2.136,10.622 0,15.164 12.336,27.5 27.5,27.5 5.406,0 10.434,-1.584 14.691,-4.289 l 5.758,5.759 0,-16.112 -16.111,0 6.389,6.388 z" transform="matrix(0.20,0,0,0.20,75,-10)">
</path>
</g>
</svg>
<span id="reloadCachedOntologyString" class="noselect" style="font-style: italic;font-size: 10px">Loaded cached ontology</span>
</div>
<div id="FPS_Statistics" class="hidden debugOption">FPS: 0<br>Nodes: 0<br>Links: 0</div>
<span class="hidden debugOption" id="modeOfOperationString">mode of operation</span>
</div>
<div id="graph"></div>
<div id="dragDropContainer" class="hidden">
<div id="drag_dropOverlay"></div>
<div id="drag_msg">
<svg id="drag_svg" style="position: absolute; left:25%;top:25%;width:50%; height:50%">
<g id="drag_icon_group">
<path id="drag_icon" style="fill : #444; stroke-width:0;" d="m 9.0000002,-8.9899999 -18.0000001,0 c -1.1000001,0 -1.9999991,0.9 -1.9999991,2 l 0,3.99 1.9999991,0 0,-4.01 18.0000001,0 0,14.0299996 -18.0000001,0 0,-4.02 -1.9999991,0 0,4.01 c 0,1.1 0.899999,1.98 1.9999991,1.98 l 18.0000001,0 c 1.1000008,0 2.0000008,-0.88 2.0000008,-1.98 l 0,-13.9999996 c 0,-1.11 -0.9,-2 -2.0000008,-2 z M -1,3.9999997 3.0000001,-3.3898305e-7 -1,-3.9999999 l 0,2.9999996 -9.999999,0 0,1.99999996 9.999999,0 0,3.00000004 z" transform="matrix(5.0,0,0,5.0,0,0)">
</path>
<path id="drag_icon_drop" class="hidden" style="fill : #444; stroke-width:0;" d="m 8.9900008,8.9999991 0,-18.0000001 c 0,-1.1 -0.9,-1.999999 -2,-1.999999 l -3.99,0 0,1.999999 4.01,0 0,18.0000001 -14.0299996,0 0,-18.0000001 4.02,0 0,-1.999999 -4.01,0 c -1.1,0 -1.98,0.899999 -1.98,1.999999 l 0,18.0000001 c 0,1.1000009 0.88,2.0000009 1.98,2.0000009 l 13.9999996,0 c 1.11,0 2,-0.9 2,-2.0000009 z M -3.9999988,-1.0000011 1.2389831e-6,2.999999 4.0000008,-1.0000011 l -2.9999996,0 0,-9.9999989 -1.99999996,0 0,9.9999989 -3.00000004,0 z" transform="matrix(5.0,0,0,5.0,0,0)">
</path>
</g>
</svg>
<span id="drag_msg_text" style="font-size:14px">Drag ontology file here.</span>
</div>
</div>
<div class="noselect">
<span id="leftSideBarCollapseButton" class="btn_shadowed hidden"> > </span>
</div>
<div class="noselect"><span id="sidebarExpandButton" class="btn_shadowed"> > </span></div>
<div id="containerForLeftSideBar">
<div id="leftSideBar">
<div id="leftSideBarContent" class="hidden">
<h2 id="leftHeader">Default Element</h2>
<h3 class=" selectedDefaultElement accordion-trigger noselect accordion-trigger-active" id="defaultClass" title="owl:Class">Class: owl:Class
</h3>
<div id="classContainer" class="accordion-container ">
</div>
<h3 class="selectedDefaultElement accordion-trigger noselect accordion-trigger-active" title="owl:objectProperty" id="defaultProperty">Property: owl:objectProperty
</h3>
<div id="propertyContainer" class="accordion-container ">
</div>
<h3 class="selectedDefaultElement accordion-trigger noselect accordion-trigger-active" title="rdfs:Literal" id="defaultDatatype">Datatype: rdfs:Literal
</h3>
<div id="datatypeContainer" class="accordion-container ">
</div>
</div>
</div>
</div>
<div id="menuContainer">
<!--Ontology Menu-->
<ul id="m_select" class="toolTipMenu noselect">
<li><a href="#foaf" id="foaf">Friend of a Friend (FOAF) vocabulary</a></li>
<li><a href="#goodrelations" id="goodrelations">GoodRelations Vocabulary for E-Commerce</a></li>
<li><a href="#muto" id="muto">Modular and Unified Tagging Ontology (MUTO)</a></li>
<li><a href="#ontovibe" id="ontovibe">Ontology Visualization Benchmark (OntoViBe)</a></li>
<li><a href="#personasonto" id="personasonto">Personas Ontology (PersonasOnto)</a></li>
<li><a href="#sioc" id="sioc">SIOC (Semantically-Interlinked Online Communities) Core Ontology</a></li>
<li class="option" id="converter-option">
<form class="converter-form" id="iri-converter-form">
<label for="iri-converter-input">Custom Ontology:</label>
<input type="text" id="iri-converter-input" placeholder="Enter ontology IRI">
<button type="submit" id="iri-converter-button" disabled>Visualize</button>
</form>
<div class="converter-form">
<input class="hidden" type="file" id="file-converter-input" autocomplete="off">
<label class="truncate" id="file-converter-label" for="file-converter-input">Select ontology
file</label>
<button type="submit" id="file-converter-button" disabled>
Upload
</button>
</div>
<div id="emptyContainer">
<a href="#opts=editorMode=true;#new_ontology1" id="empty" style="pointer-events:none; padding-left:0">Create new ontology</a>
</div>
<div>
<!--<button class="debugOption" type="submit" id="direct-text-input">-->
<!--Direct input-->
<!--</button>-->
</div>
</li>
</ul>
<!--Export Menu-->
<ul id="m_export" class="toolTipMenu noselect">
<li><a href="#" download id="exportJson">Export as JSON</a></li>
<li><a href="#" download id="exportSvg">Export as SVG</a></li>
<li><a href="#" download id="exportTex">Export as TeX <label style="font-size: 10px">(alpha)</label></a>
</li>
<li><a href="#" download id="exportTurtle">Export as TTL <label style="font-size: 10px">(alpha)</label></a>
</li>
<li class="option" id="emptyLiHover">
<div>
<form class="converter-form" id="url-copy-form">
<label for="exportedUrl">Export as URL:</label>
<input type="text" id="exportedUrl" placeholder="#">
<button id="copyBt" title="Copy to clipboard">Copy</button>
</form>
</div>
</li>
</ul>
<!--Filter Menu-->
<ul id="m_filter" class="toolTipMenu noselect">
<li class="toggleOption" id="datatypeFilteringOption"></li>
<li class="toggleOption" id="objectPropertyFilteringOption"></li>
<li class="toggleOption" id="subclassFilteringOption"></li>
<li class="toggleOption" id="disjointFilteringOption"></li>
<li class="toggleOption" id="setOperatorFilteringOption"></li>
<li class="slideOption" id="nodeDegreeFilteringOption"></li>
</ul>
<!--Options Menu -->
<ul id="m_config" class="toolTipMenu noselect">
<li class="toggleOption" id="zoomSliderOption"></li>
<li class="slideOption" id="classSliderOption"></li>
<li class="slideOption" id="datatypeSliderOption"></li>
<li class="toggleOption" id="dynamicLabelWidth"></li>
<li class="slideOption" id="maxLabelWidthSliderOption"></li>
<li class="toggleOption" id="nodeScalingOption"></li>
<li class="toggleOption" id="compactNotationOption"></li>
<li class="toggleOption" id="colorExternalsOption"></li>
</ul>
<!--Modes Menu -->
<ul id="m_modes" class="toolTipMenu noselect">
<li class="toggleOption" id="editMode"></li>
<li class="toggleOption" id="pickAndPinOption"></li>
</ul>
<!--Debug Menu -->
<ul id="m_debug" class="toolTipMenu noselect">
<li class=" toggleOption" id="useAccuracyHelper"></li>
<li class=" toggleOption" id="showDraggerObject"></li>
<li class=" toggleOption" id="showFPS_Statistics"></li>
<li class=" toggleOption" id="showModeOfOperation"></li>
</ul>
<!--About Menu-->
<ul id="m_about" class="toolTipMenu">
<li><a href="license.txt" target="_blank">MIT License © 2014-2019</a></li>
<li id="credits" class="option">WebVOWL Developers:<br />
Vincent Link, Steffen Lohmann, Eduard Marbach, Stefan Negru, Vitalis Wiens
</li>
<li id="credits" class="option">WIDOCO integration:<br /> Daniel Garijo, Jacobus Geluk
</li>
<li><a href="http://vowl.visualdataweb.org/webvowl.html#releases" target="_blank">Version: <%= version
%><br />(release history)</a></li>
<li><a href="http://purl.org/vowl/" target="_blank">VOWL Specification »</a></li>
</ul>
<ul id="m_search" class="toolTipMenu"></ul>
</div>
<div class="noselect" id="swipeBarContainer">
<ul id="menuElementContainer">
<li id="c_search" class="inner-addon left-addon">
<i class="searchIcon">
<svg viewBox="0 0 24 24" height="100%" width="100%" style="pointer-events: none; display: block;">
<g>
<path id="magnifyingGlass" style="fill : #666; stroke-width:0;" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z">
</path>
</g>
</svg>
</i>
<input class="searchInputText" type="text" id="search-input-text" placeholder="Search">
</li>
<li id="c_locate">
<a style="padding: 0 8px 5px 8px;" draggable="false" title="Nothing to locate, enter search term." href="#" id="locateSearchResult">⌖
</a>
</li>
<!--
<li id="c_select">
<a draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i> Ontology</a>
</li>-->
<li id="c_export"><a draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i> Export</a></li>
<li id="c_filter"><a draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="M3 4l9 16 9-16H3zm3.38 2h11.25L12 16 6.38 6z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i>Filter</a></li>
<li id="c_config"><a draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="m 21.163138,13.127428 0,-2.356764 -2.546629,-0.424622 C 18.439272,9.5807939 18.137791,8.8661419 17.733863,8.218291 L 19.2356,6.116978 17.569296,4.450673 15.466841,5.951269 C 14.818953,5.548483 14.104338,5.24586 13.33909,5.067482 l -0.424622,-2.545488 -2.356764,0 -0.424622,2.545488 C 9.3689769,5.24586 8.6531829,5.548519 8.0053319,5.951269 l -2.102455,-1.500596 -1.666304,1.666305 1.501737,2.101313 c -0.403928,0.6467469 -0.705409,1.3625029 -0.882646,2.127751 l -2.546629,0.424622 0,2.356764 2.546629,0.424622 c 0.177237,0.765248 0.478718,1.4799 0.882646,2.127751 l -1.501737,2.102455 1.666304,1.666304 2.103596,-1.501737 c 0.646747,0.403928 1.362504,0.705409 2.1266091,0.882646 l 0.424622,2.546629 2.356764,0 0.424622,-2.546629 c 0.764106,-0.177237 1.4799,-0.478718 2.127751,-0.882646 l 2.102455,1.501737 1.666304,-1.666304 -1.501737,-2.102455 c 0.403928,-0.647888 0.705409,-1.363645 0.882646,-2.127751 l 2.546629,-0.424622 z m -9.427053,3.535144 c -2.6030431,0 -4.7135241,-2.110517 -4.7135241,-4.713527 0,-2.6030071 2.110518,-4.713525 4.7135241,-4.713525 2.60301,0 4.713527,2.1105179 4.713527,4.713525 0,2.60301 -2.110481,4.713527 -4.713527,4.713527 z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i>Options</a>
</li>
<li id="c_modes"><a draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i>Modes</a></li>
<li id="c_reset"><a draggable="false" id="reset-button" href="#" type="reset">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="m 12,5 0,-4 5,5 -5,5 0,-4 c -3.31,0 -6,2.69 -6,6 0,3.31 2.69,6 6,6 3.31,0 6,-2.69 6,-6 l 2,0 c 0,4.42 -3.58,8 -8,8 C 7.58,21 4,17.42 4,13 4,8.58 7.58,5 12,5 Z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i>Reset</a></li>
<li id="c_pause"><a draggable="false" id="pause-button" href="#" style="padding: 9px 8px 12px 8px;">Pause</a>
</li>
<li id="c_debug" class="debugOption"><a id="debugMenuHref" draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="M 20,8 17.19,8 C 16.74,7.22 16.12,6.55 15.37,6.04 L 17,4.41 15.59,3 13.42,5.17 C 12.96,5.06 12.49,5 12,5 11.51,5 11.04,5.06 10.59,5.17 L 8.41,3 7,4.41 8.62,6.04 C 7.88,6.55 7.26,7.22 6.81,8 L 4,8 4,10 6.09,10 C 6.04,10.33 6,10.66 6,11 l 0,1 -2,0 0,2 2,0 0,1 c 0,0.34 0.04,0.67 0.09,1 L 4,16 l 0,2 2.81,0 c 1.04,1.79 2.97,3 5.19,3 2.22,0 4.15,-1.21 5.19,-3 l 2.81,0 0,-2 -2.09,0 C 17.96,15.67 18,15.34 18,15 l 0,-1 2,0 0,-2 -2,0 0,-1 c 0,-0.34 -0.04,-0.67 -0.09,-1 L 20,10 Z m -4,4 0,3 c 0,0.22 -0.03,0.47 -0.07,0.7 L 15.83,16.35 15.46,17 C 14.74,18.24 13.42,19 12,19 10.58,19 9.26,18.23 8.54,17 L 8.17,16.36 8.07,15.71 C 8.03,15.47 8,15.22 8,15 L 8,11 C 8,10.78 8.03,10.53 8.07,10.3 L 8.17,9.65 8.54,9 C 8.84,8.48 9.26,8.03 9.75,7.69 L 10.32,7.3 11.06,7.12 C 11.37,7.04 11.69,7 12,7 c 0.32,0 0.63,0.04 0.95,0.12 l 0.68,0.16 0.61,0.42 c 0.5,0.34 0.91,0.78 1.21,1.31 l 0.38,0.65 0.1,0.65 C 15.97,10.53 16,10.78 16,11 Z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i>
Debug</a></li>
<li id="c_about"><a draggable="false" href="#">
<i>
<svg viewBox="0 0 24 24" class="menuElementSvgElement">
<g>
<path style="fill : #fff; stroke-width:0;" d="m 10.08,10.86 c 0.05,-0.33 0.16,-0.62 0.3,-0.87 0.14,-0.25 0.34,-0.46 0.59,-0.62 0.24,-0.15 0.54,-0.22 0.91,-0.23 0.23,0.01 0.44,0.05 0.63,0.13 0.2,0.09 0.38,0.21 0.52,0.36 0.14,0.15 0.25,0.33 0.34,0.53 0.09,0.2 0.13,0.42 0.14,0.64 l 1.79,0 C 15.28,10.33 15.19,9.9 15.02,9.51 14.85,9.12 14.62,8.78 14.32,8.5 14.02,8.22 13.66,8 13.24,7.84 12.82,7.68 12.36,7.61 11.85,7.61 11.2,7.61 10.63,7.72 10.15,7.95 9.67,8.18 9.27,8.48 8.95,8.87 8.63,9.26 8.39,9.71 8.24,10.23 8.09,10.75 8,11.29 8,11.87 l 0,0.27 c 0,0.58 0.08,1.12 0.23,1.64 0.15,0.52 0.39,0.97 0.71,1.35 0.32,0.38 0.72,0.69 1.2,0.91 0.48,0.22 1.05,0.34 1.7,0.34 0.47,0 0.91,-0.08 1.32,-0.23 0.41,-0.15 0.77,-0.36 1.08,-0.63 0.31,-0.27 0.56,-0.58 0.74,-0.94 0.18,-0.36 0.29,-0.74 0.3,-1.15 l -1.79,0 c -0.01,0.21 -0.06,0.4 -0.15,0.58 -0.09,0.18 -0.21,0.33 -0.36,0.46 -0.15,0.13 -0.32,0.23 -0.52,0.3 -0.19,0.07 -0.39,0.09 -0.6,0.1 C 11.5,14.86 11.2,14.79 10.97,14.64 10.72,14.48 10.52,14.27 10.38,14.02 10.24,13.77 10.13,13.47 10.08,13.14 10.03,12.81 10,12.47 10,12.14 l 0,-0.27 c 0,-0.35 0.03,-0.68 0.08,-1.01 z M 12,2 C 6.48,2 2,6.48 2,12 2,17.52 6.48,22 12,22 17.52,22 22,17.52 22,12 22,6.48 17.52,2 12,2 Z m 0,18 C 7.59,20 4,16.41 4,12 4,7.59 7.59,4 12,4 c 4.41,0 8,3.59 8,8 0,4.41 -3.59,8 -8,8 z" transform="matrix(0.75,0,0,0.75,3.5,2.5)">
</path>
</g>
</svg>
</i>
About</a></li>
</ul>
</div>
<div class="noselect" id="scrollRightButton"></div>
<div class="noselect" id="scrollLeftButton"></div>
<div id="zoomSlider" class="btn_shadowed">
<p class="noselect" id="centerGraphButton">⌖</p>
<p class="noselect" id="zoomInButton">+</p>
<p class="noselect" id="zoomSliderParagraph"></p>
<p class="noselect" id="zoomOutButton">-</p>
</div>
</section>
<aside id="detailsArea" style="background-color: #18202A;">
<section id="generalDetailsEdit" class="hidden">
<h1 id="editHeader" style="font-size: 1.1em;">Editing Options</h1>
<h3 class="accordion-trigger noselect accordion-trigger-active">Ontology</h3>
<div>
<!--begin of ontology metaData -->
<div class="textLineEditWithLabel">
<form class="converter-form-Editor " id="titleEditForm">
<label class="EditLabelForInput" id="titleEditor-label" for="titleEditor" title="Ontology title as dc:title">Title:</label>
<input class="modifiedInputStyle" type="text" id="titleEditor" autocomplete="off" value="">
</form>
</div>
<div class="textLineEditWithLabel">
<form class="converter-form-Editor " id="iriEditForm">
<label class="EditLabelForInput" id="iriEditor-label" for="iriEditor">IRI:</label>
<input type="text" id="iriEditor" autocomplete="off" value="">
</form>
</div>
<div class="textLineEditWithLabel">
<form class="converter-form-Editor " id="versionEditForm">
<label class="EditLabelForInput" id="versionEditor-label" for="versionEditor" title="Ontology version number as owl:versionInfo">Version:</label>
<input type="text" id="versionEditor" value="" autocomplete="off">
</form>
</div>
<div class="textLineEditWithLabel">
<form class="converter-form-Editor " id="authorsEditForm">
<label class="EditLabelForInput" id="authorsEditor-label" for="authorsEditor" title="Ontology authors as dc:creator">Authors:</label>
<input type="text" id="authorsEditor" value="" autocomplete="off">
</form>
</div>
<h4 class="subAccordion accordion-trigger noselect">Prefix</h4>
<div class="subAccordionDescription" id="containerForPrefixURL">
<div id="prefixURL_Description">
<span class="boxed ">Prefix</span>
<span class="boxed">IRI</span>
</div>
<div id="prefixURL_Container"></div>
<div align="center" id="containerForAddPrefixButton">
<button id="addPrefixButton">Add Prefix</button>
</div>
</div>
</div>
<!--end of ontology metaData -->
<h3 class="accordion-trigger noselect">Description</h3>
<div>
<textarea rows="4" cols="25" title="Ontology description as dc:description" class="descriptionTextClass" id="descriptionEditor"></textarea>
</div>
<h3 class="accordion-trigger noselect accordion-trigger-active">Selected Element</h3>
<div>
<div id="selectedElementProperties" class="hidden">
<div class="textLineEditWithLabel">
<form class="converter-form-Editor " id="element_iriEditForm">
<label class="EditLabelForInput" id="element_iriEditor-label" for="element_iriEditor">IRI:</label>
<input type="text" id="element_iriEditor" autocomplete="off" value="">
</form>
</div>
<div class="textLineEditWithLabel">
<form class="converter-form-Editor " id="element_labelEditForm">
<label class="EditLabelForInput" id="element_labelEditor-label" for="element_labelEditor">Label:</label>
<input type="text" id="element_labelEditor" autocomplete="off" value="">
</form>
</div>
<div class="textLineEditWithLabel">
<form class="converter-form-Editor" id="typeEditForm">
<label class="EditLabelForInput" id="typeEditor-label" for="typeEditor">Type:</label>
<select id="typeEditor" class="dropdownMenuClass"></select>
</form>
<form class="converter-form-Editor" id="typeEditForm_datatype">
<label class="EditLabelForInput" id="typeEditor_datatype-label" for="typeEditor_datatype">Datatype:</label>
<select id="typeEditor_datatype" class="dropdownMenuClass"></select>
</form>
</div>
<div class="textLineEditWithLabel" id="property_characteristics_Container"> Characteristics:
<div id="property_characteristics_Selection" style="padding-top:2px;"></div>
</div>
</div>
<div id="selectedElementPropertiesEmptyHint">
Select an element in the visualization.
</div>
</div>
</section>
<section id="generalDetails" class="hidden">
<h1 id="title"></h1>
<span><a id="about" href=""></a></span>
<h5>Version: <span id="version"></span></h5>
<h5>Author(s): <span id="authors"></span></h5>
<h5>
<label>Language: <select id="language" name="language" size="1"></select></label>
</h5>
<h3 class="accordion-trigger noselect accordion-trigger-active">Description</h3>
<div class="accordion-container scrollable">
<p id="description"></p>
</div>
<h3 class="accordion-trigger noselect">Metadata</h3>
<div id="ontology-metadata" class="accordion-container"></div>
<h3 class="accordion-trigger noselect">Statistics</h3>
<div class="accordion-container">
<p class="statisticDetails">Classes: <span id="classCount"></span></p>
<p class="statisticDetails">Object prop.: <span id="objectPropertyCount"></span></p>
<p class="statisticDetails">Datatype prop.: <span id="datatypePropertyCount"></span></p>
<div class="small-whitespace-separator"></div>
<p class="statisticDetails">Individuals: <span id="individualCount"></span></p>
<div class="small-whitespace-separator"></div>
<p class="statisticDetails">Nodes: <span id="nodeCount"></span></p>
<p class="statisticDetails">Edges: <span id="edgeCount"></span></p>
</div>
<h3 class="accordion-trigger noselect" id="selection-details-trigger">Selection Details</h3>
<div class="accordion-container" id="selection-details">
<div id="classSelectionInformation" class="hidden">
<p class="propDetails">Name: <span id="name"></span></p>
<p class="propDetails">Type: <span id="typeNode"></span></p>
<p class="propDetails">Equiv.: <span id="classEquivUri"></span></p>
<p class="propDetails">Disjoint: <span id="disjointNodes"></span></p>
<p class="propDetails">Charac.: <span id="classAttributes"></span></p>
<p class="propDetails">Individuals: <span id="individuals"></span></p>
<p class="propDetails">Description: <span id="nodeDescription"></span></p>
<p class="propDetails">Comment: <span id="nodeComment"></span></p>
</div>
<div id="propertySelectionInformation" class="hidden">
<p class="propDetails">Name: <span id="propname"></span></p>
<p class="propDetails">Type: <span id="typeProp"></span></p>
<p id="inverse" class="propDetails">Inverse: <span></span></p>
<p class="propDetails">Domain: <span id="domain"></span></p>
<p class="propDetails">Range: <span id="range"></span></p>
<p class="propDetails">Subprop.: <span id="subproperties"></span></p>
<p class="propDetails">Superprop.: <span id="superproperties"></span></p>
<p class="propDetails">Equiv.: <span id="propEquivUri"></span></p>
<p id="infoCardinality" class="propDetails">Cardinality: <span></span></p>
<p id="minCardinality" class="propDetails">Min. cardinality: <span></span></p>
<p id="maxCardinality" class="propDetails">Max. cardinality: <span></span></p>
<p class="propDetails">Charac.: <span id="propAttributes"></span></p>
<p class="propDetails">Description: <span id="propDescription"></span></p>
<p class="propDetails">Comment: <span id="propComment"></span></p>
</div>
<div id="noSelectionInformation">
<p><span>Select an element in the visualization.</span></p>
</div>
</div>
</section>
</aside>
<div id="blockGraphInteractions" class="hidden"></div>
<div id="WarningErrorMessagesContainer" class="">
<div id="WarningErrorMessages" class="">
</div>
</div>
<div id="DirectInputContent" class="hidden">
<div id="direct-text-input-container">
<textarea rows="4" cols="25" title="Direct Text input as JSON(experimental)" class="directTextInputStyle" id="directInputTextArea"></textarea>
<div id="di_controls">
<ul>
<li>
<button id="directUploadBtn">Upload</button>
</li>
<li>
<button id="close_directUploadBtn">Close</button>
</li>
<li id="Error_onLoad" class="hidden">Some text if ERROR</li>
</ul>
</div>
</div>
</div>
</main>
<script src="js/d3.min.js"></script>
<script src="js/webvowl.js"></script>
<script src="js/webvowl.app.js"></script>
<script>
window.onload = webvowl.app().initialize;
</script>
</body>
</html>
| 35,533 | 67.998058 | 1,383 | html |
null | hspo-ontology-main/docs/ontology-specification/webvowl/css/webvowl.app.css | @import url(http://fonts.googleapis.com/css?family=Open+Sans);/*----------------------------------------------
WebVOWL page
----------------------------------------------*/
html {
-ms-content-zooming: none;
}
#loading-progress {
width: 50%;
margin: 10px 0;
}
#drag_dropOverlay{
width: 100%;
height:100%;
position:absolute;
top:0;
opacity: 0.5;
background-color: #3071a9;
pointer-events: none;
}
#dragDropContainer{
width: 100%;
height:100%;
position:absolute;
top:0;
pointer-events: none;
}
#drag_icon_group{
}
#drag_msg{
width: 50%;
background-color: #fefefe;
height: 50%;
border: black 2px solid;
border-radius: 20px;
left: 25%;
position: absolute;
top: 25%;
vertical-align: middle;
line-height: 10px;
text-align: center;
pointer-events: none;
padding: 10px;
font-size: 1.5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#layoutLoadingProgressBarContainer {
height: 50px;
text-align: left;
line-height: 1.5;
}
#FPS_Statistics {
/*position : absolute;*/
/*top : 10px;*/
/*right: 50px;*/
padding-left: 60px;
padding-top: 60px;
}
#reloadCachedOntology {
/*position : absolute;*/
/*top : 10px;*/
/*right: 50px;*/
}
#additionalInformationContainer {
position: absolute;
top: 10px;
right: 50px;
}
#modeOfOperationString {
/*position: absolute;*/
/*right: 50px;*/
/*top : 60px;*/
padding-left: 34px;
}
#direct-text-input {
border: 1px solid #34495e;
width: 100%;
margin-top: 5px;
cursor: pointer;
}
#directUploadBtn, #close_directUploadBtn {
border: 1px solid #34495e;
width: 100%;
margin-top: 5px;
cursor: pointer
}
#di_controls {
}
#di_controls > ul {
list-style: none;
margin: 0;
padding: 5px 0 0 5px;
}
#progressBarContext {
border-radius: 10px;
background-color: #bdc3c7;
height: 25px;
border: solid 1px black;
margin: auto;
}
#progressBarValue {
border-radius: 9px;
width: 0%;
background-color: #2980b9;
height: 25px;
line-height: 1.5;
text-align: center;
}
/** adding searching Styles **/
.dbEntry {
background-color: #ffffff;
color: #2980b9;
padding: 10px;
font-size: 14px;
border: none;
cursor: pointer;
}
.debugOption {
}
.dbEntrySelected {
background-color: #bdc3c7;
color: #2980b9;
padding: 10px;
font-size: 14px;
border: none;
cursor: pointer;
}
.dbEntry:hover, .dbEntry:focus {
background-color: #bdc3c7;
}
.searchMenuEntry {
background-color: #ffffff;
bottom: 0;
font-size: 14px;
min-width: 50px;
margin: 0;
padding: 0;
z-index: 99;
border-radius: 4px 4px 0 0;
border: 1px solid rgba(0, 0, 0, 0.15);
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-sizing: border-box;
border-bottom: none;
display: none;
position: absolute;
list-style: none;
}
.searchInputText {
background-color: #ffffff;
color: black;
border: black;
text-decoration: none;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
/*height: 20px;*/
margin: 0;
}
img, iframe {
border: none;
}
.hidden {
display: none !important;
}
.clear {
clear: both;
}
a {
color: #69c;
text-decoration: none;
}
a:hover {
color: #3498db;
}
#optionsArea a {
color: #2980b9;
}
#optionsArea a.highlighted {
background-color: #d90;
}
.toolTipMenu li.highlighted {
background-color: #feb;
}
#browserCheck {
/* checking for IE where WebVOWL is not working */
background-color: #f00;
padding: 5px 0;
position: absolute;
text-align: center;
width: 100%;
}
#browserCheck a {
color: #fff;
}
#browserCheck a:hover {
text-decoration: underline;
}
/*----------------------------------------------
SideBar Animation Class;
----------------------------------------------- */
@-webkit-keyframes sbExpandAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
@-moz-keyframes sbExpandAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
@-o-keyframes sbExpandAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
@keyframes sbExpandAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
/*Collapse Animation*/
@-webkit-keyframes sbCollapseAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
@-moz-keyframes sbCollapseAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
@-o-keyframes sbCollapseAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
@keyframes sbCollapseAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
/*----------------------------------------------
SideBar Animation Class;
----------------------------------------------- */
@-webkit-keyframes l_sbExpandAnimation {
0% {
width: 0px;
}
100% {
width: 200px;
}
}
@-moz-keyframes l_sbExpandAnimation {
0% {
width: 0px;
}
100% {
width: 200px;
}
}
@-o-keyframes l_sbExpandAnimation {
0% {
width: 0px;
}
100% {
width: 200px;
}
}
@keyframes l_sbExpandAnimation {
0% {
width: 0px;
}
100% {
width: 200px;
}
}
/*Collapse Animation*/
@-webkit-keyframes l_sbCollapseAnimation {
0% {
width: 200px;
}
100% {
width: 0px;
}
}
@-moz-keyframes l_sbCollapseAnimation {
0% {
width: 200px;
}
100% {
width: 0px;
}
}
@-o-keyframes l_sbCollapseAnimation {
0% {
width: 200px;
}
100% {
width: 0px;
}
}
@keyframes l_sbCollapseAnimation {
0% {
width: 200px;
}
100% {
width: 0px;
}
}
/*----------------- WARNING ANIMATIONS-------------*/
/*----------------------------------------------
SideBar Animation Class;
----------------------------------------------- */
@-webkit-keyframes warn_ExpandAnimation {
0% {
top: -500px;
}
100% {
top: 0;
}
}
@-moz-keyframes warn_ExpandAnimation {
0% {
top: -500px;
}
100% {
top: 0;
}
}
@-o-keyframes warn_ExpandAnimation {
0% {
top: -500px;
}
100% {
top: 0;
}
}
@keyframes warn_ExpandAnimation {
0% {
top: -500px;
}
100% {
top: 0;
}
}
/*Collapse Animation*/
@-webkit-keyframes warn_CollapseAnimation {
0% {
top: 0;
}
100% {
top: -400px;
}
}
@-moz-keyframes warn_CollapseAnimation {
0% {
top: 0;
}
100% {
top: -400px;
}
}
@-o-keyframes warn_CollapseAnimation {
0% {
top: 0;
}
100% {
top: -400px;
}
}
@keyframes warn_CollapseAnimation {
0% {
top: 0;
}
100% {
top: -400px;
}
}
@keyframes msg_CollapseAnimation {
0% {
top: 0;
}
100% {
top: -400px;
}
}
/*// add expand and collaps width for the warn module*/
@-webkit-keyframes warn_ExpandLeftBarAnimation {
0% {
left: 0;
}
100% {
left: 100px;
}
}
@-moz-keyframes warn_ExpandLeftBarAnimation {
0% {
left: 0;
}
100% {
left: 100px;
}
}
@-o-keyframes warn_ExpandLeftBarAnimation {
0% {
left: 0;
}
100% {
left: 100px;
}
}
@keyframes warn_ExpandLeftBarAnimation {
0% {
left: 0;
}
100% {
left: 100px;
}
}
/*Collapse Animation*/
@-webkit-keyframes warn_CollapseLeftBarAnimation {
0% {
left: 100px;
}
100% {
left: 0;
}
}
@-moz-keyframes warn_CollapseLeftBarAnimation {
0% {
left: 100px;
}
100% {
left: 0;
}
}
@-o-keyframes warn_CollapseLeftBarAnimation {
0% {
left: 100px;
}
100% {
left: 0;
}
}
@keyframes warn_CollapseLeftBarAnimation {
0% {
left: 100px;
}
100% {
left: 0;
}
}
/*// same for the right side expansion*/
/*// add expand and collaps width for the warn module*/
@-webkit-keyframes warn_ExpandRightBarAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
@-moz-keyframes warn_ExpandRightBarAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
@-o-keyframes warn_ExpandRightBarAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
@keyframes warn_ExpandRightBarAnimation {
0% {
width: 100%;
}
100% {
width: 78%;
}
}
/*Collapse Animation*/
@-webkit-keyframes warn_CollapseRightBarAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
@-moz-keyframes warn_CollapseRightBarAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
@-o-keyframes warn_CollapseRightBarAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
@keyframes warn_CollapseRightBarAnimation {
0% {
width: 78%;
}
100% {
width: 100%;
}
}
/*----------------------------------------------
LAYOUT
----------------------------------------------*/
body {
background: rgb(24, 32, 42);
height: 100%;
font-size: 14px;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
line-height: 1;
margin: 0;
overflow: hidden;
padding: 0;
position: fixed;
width: 100%;
}
main {
height: 100%;
margin: 0;
padding: 0;
position: relative;
width: 100%;
}
#canvasArea {
position: relative;
margin: 0;
padding: 0;
width: 78%;
}
#canvasArea #graph {
box-sizing: border-box;
margin: 0 0 2px 0;
background-color: #ecf0f1;
overflow: hidden;
padding: 0;
width: 100%;
}
#canvasArea svg {
box-sizing: border-box;
margin: 0;
overflow: hidden;
padding: 0;
}
#logo {
position: fixed;
/*padding: 10px;*/
pointer-events: none;
/*border: solid 1px red;*/
}
#logo h2 {
color: #3498db;
margin: 0;
line-height: 0.7;
text-align: center;
font-size: 24px;
}
#logo h2 span {
color: #34495E;
/*font-size: min(2vmin, 24px);*/
font-size: 16px;
}
@media screen and (max-device-height: 800px) {
#logo h2 {
font-size: calc(8px + 1.0vmin);
}
#logo h2 span {
font-size: calc(3px + 1.0vmin);
}
}
@media screen and (max-height: 800px) {
#logo h2 {
font-size: calc(8px + 1.0vmin);
}
#logo h2 span {
font-size: calc(3px + 1.0vmin);
}
}
@media screen and (max-device-width: 1200px) {
#logo h2 {
font-size: calc(8px + 1.0vmin);
}
#logo h2 span {
font-size: calc(3px + 1.0vmin);
}
}
@media screen and (max-width: 1200px) {
#logo h2 {
font-size: calc(8px + 1.0vmin);
}
#logo h2 span {
font-size: calc(3px + 1.0vmin);
}
}
.checkboxContainer input, .checkboxContainer label {
vertical-align: middle;
}
.selected-ontology {
background-color: #eee;
}
#credits {
border-top: solid 1px #bdc3c7;
font-size: 0.9em;
}
.slideOption {
position: relative;
padding: 8px 5px;
outline: none;
}
.slideOption .value {
float: right;
outline: none;
}
.slideOption input[type="range"] {
box-sizing: border-box;
margin: 0;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 3px;
height: 12px;
width: 100%;
box-shadow: none;
left: 0;
position: relative;
transition: all 0.5s ease;
background-color: #eee;
}
/*TRACK*/
.slideOption input[type=range]::-webkit-slider-runnable-track {
-webkit-appearance: none;
background-color: #3071a9;
height: 3px;
}
.slideOption input[type=range]::-moz-range-track {
-webkit-appearance: none;
background-color: #3071a9;
height: 3px;
}
.slideOption input[type="range"]:hover {
outline: none;
}
/*THUMB*/
.slideOption input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: white;
border-radius: 3px;
border: solid 1px black;
transition: all 0.5s ease;
height: 10px;
width: 30px;
outline: none;
margin-top: -3px;
}
.slideOption input[type="range"]::-moz-range-thumb {
-webkit-appearance: none;
background-color: white;
border-radius: 3px;
border: solid 1px black;
transition: all 0.5s ease;
height: 10px;
width: 30px;
outline: none;
}
.slideOption input[type="range"]::-moz-range-thumb:hover {
background-color: #d90;
outline: none;
}
.slideOption input[type="range"]::-webkit-slider-thumb:hover {
background-color: #d90;
/*color: #d90;*/
outline: none;
}
/*focus : remove border*/
.slideOption input[type="range"]:focus {
outline: none;
}
.slideOption input[type="range"]:active {
outline: none;
}
.slideOption input[type="range"]::-moz-range-thumb:focus {
outline: none;
}
.slideOption input[type="range"]::-moz-range-thumb:active {
outline: none;
}
.slideOption input[type="range"]::-webkit-slider-thumb:focus {
outline: none;
}
.slideOption input[type="range"]::-webkit-slider-thumb:active {
outline: none;
}
.slideOption input[type="range"]:disabled {
box-sizing: border-box;
margin: 0;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 3px;
height: 12px;
width: 100%;
box-shadow: none;
left: 0;
position: relative;
transition: all 0.5s ease;
background-color: #787878;
}
/*TRACK*/
.slideOption input[type=range]:disabled::-webkit-slider-runnable-track {
-webkit-appearance: none;
background-color: #373737;
height: 3px;
}
.slideOption input[type=range]:disabled::-moz-range-track {
-webkit-appearance: none;
background-color: #373737;
height: 3px;
}
.slideOption input[type="range"]:disabled {
outline: none;
}
/*THUMB*/
.slideOption input[type="range"]:disabled::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: #363636;
border-radius: 3px;
border: solid 1px #aaaaaa;
transition: all 0.5s ease;
height: 10px;
width: 30px;
outline: none;
margin-top: -3px;
}
.slideOption input[type="range"]:disabled::-moz-range-thumb {
-webkit-appearance: none;
background-color: #aaaaaa;
border-radius: 3px;
border: solid 1px black;
transition: all 0.5s ease;
height: 10px;
width: 30px;
outline: none;
}
.slideOption input[type="range"]:disabled::-moz-range-thumb {
background-color: #aaaaaa;
outline: none;
}
.slideOption input[type="range"]:disabled::-webkit-slider-thumb {
background-color: #aaaaaa;
/*color: #d90;*/
outline: none;
}
.slideOption input[type="range"]:disabled:hover::-moz-range-thumb {
background-color: #404040;
outline: none;
}
.slideOption input[type="range"]:disabled:hover::-webkit-slider-thumb {
background-color: #404040;
/*color: #d90;*/
outline: none;
}
#detailsArea {
top: 0;
right: 0;
bottom: 0;
color: #bdc3c7;
height: 100%;
width: 22%;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
border-left: 1px solid #34495E;
}
#detailsArea h1 {
border-bottom: solid 1px #34495e;
color: #ecf0f1;
display: block;
font-weight: 100;
font-size: 1.5em;
margin: 0;
padding: 10px 0;
text-align: center;
}
#generalDetails {
width: auto;
box-sizing: border-box;
height: 100%;
}
#generalDetails span #about {
border-bottom: solid 1px #34495e;
display: block;
padding: 10px;
text-align: center;
word-wrap: break-word;
color: #69c;
}
#generalDetails h4 {
background: rgb(27, 37, 46);
color: #ecf0f1;
display: block;
font-size: 1.1em;
font-weight: 100;
margin: 0;
padding: 10px 0;
text-align: center;
}
#detailsArea #generalDetails h5 {
border-bottom: solid 1px #34495e;
font-size: 0.9em;
font-weight: 100;
margin: 0;
padding: 5px;
text-align: center;
}
#description {
text-align: justify;
}
.accordion-container p {
font-size: 0.9em;
line-height: 1.3;
margin: 5px 10px;
}
.statisticDetails span {
font-weight: 100;
font-style: italic;
margin: 10px 0;
padding: 10px;
}
.statisticDetails div {
font-weight: 100;
font-style: italic;
margin: 10px 0;
padding: 0 10px;
display: inline;
}
#selection-details .propDetails a {
color: #69c;
}
#selection-details .propDetails > span {
font-weight: 100;
font-style: italic;
padding: 0 10px;
}
#selection-details #classEquivUri span, #selection-details #disjointNodes span {
padding: 0;
}
#selection-details .propDetails div {
font-weight: 100;
font-style: italic;
margin: 10px 0;
padding: 0 10px;
display: inline;
}
#selection-details .propDetails div span {
padding: 0;
}
/* give subclass property the same background color as the canvas */
.subclass {
fill: #ecf0f1;
}
.accordion-trigger {
background: #24323e;
cursor: pointer;
padding: .5em;
}
.accordion-trigger.accordion-trigger-active:before {
padding-right: 4px;
content: "\25BC"
}
.accordion-trigger:not(.accordion-trigger-active):before {
padding-right: 4px;
content: "\25BA"
}
.accordion-container.scrollable {
max-height: 40%;
overflow: auto;
}
.small-whitespace-separator {
height: 3px;
}
#language {
background: transparent;
border: 1px solid #34495E;
color: #ecf0f1;
}
#language option {
background-color: #24323e;
}
.converter-form:not(:first-child) {
margin-top: 5px;
}
.converter-form label {
display: inline-block;
line-height: normal;
}
.converter-form input {
box-sizing: border-box;
height: 20px;
width: 74%;
border: 1px solid #34495E;
}
.converter-form button {
cursor: pointer;
float: right;
height: 20px;
padding: 0;
width: 25%;
border: 1px solid #34495E;
background-color: #ecf0f1;
}
#file-converter-label {
border: 1px solid #34495E;
box-sizing: border-box;
cursor: pointer;
height: 20px;
width: 74%;
}
#killWarning {
cursor: pointer;
color: #ffffff;
font-weight: bold;
}
/*#copyBt{*/
/*box-sizing: border-box;*/
/*color: #000000;*/
/*float:right;*/
/*position:absolute;*/
/*right:2px;*/
/*padding: 2px 7px 3px 7px;*/
/*border: 1px solid #000000;*/
/*background-color: #ecf0f1;*/
/*cursor: pointer;*/
/*}*/
#copyBt {
box-sizing: border-box;
height: 20px;
width: 31%;
border: 1px solid #34495E;
}
#sidebarExpandButton {
height: 24px;
width: 24px;
/*background-color: white;*/
/*box-shadow: 0px 1px 1px grey;*/
box-sizing: border-box;
top: 10px;
color: #000000;
float: right;
position: absolute;
right: 0;
border: 1px solid #000000;
text-align: center;
font-size: 1.5em;
cursor: pointer;
}
.dropdownMenuClass {
height: 20px;
/*width: 69%;*/
float: right;
border: 1px solid #34495E;
background-color: #34495E;
color: white;
/*border-bottom: 1px solid #d90;*/
text-align: left;
width: auto;
}
#typeEditForm_datatype {
padding-top: 5px;
}
#typeEditor {
width: 165px;
}
#typeEditor_datatype {
width: 165px;
}
#leftSideBarCollapseButton {
box-sizing: border-box;
top: 50px;
/*padding:5px;*/
color: #000000;
position: absolute;
left: 200px;
border: 1px solid #000000;
/*background-color: #ecf0f1;*/
cursor: pointer;
width: 24px;
height: 24px;
font-size: 1.5em;
text-align: center;
}
#leftSideBarCollapseButton:hover {
background-color: #d90;
}
#sidebarExpandButton:hover {
background-color: #d90;
}
.spanForCharSelection {
padding-left: 25px;
}
.nodeEditSpan {
color: #000;
background-color: #fff;
text-align: center;
/*overflow: auto;*/
border: none;
padding-top: 6px;
}
.nodeEditSpan:focus {
outline: none;
border: none;
}
.foreignelements {
/*width: 80px;*/
/*height: 3px;*/
border: none;
}
.foreignelements:focus {
outline: none;
border: none;
}
#leftSideBarContent {
color: #000000;
float: left;
position: absolute;
left: 0;
/*border: 1px solid #000000;*/
background-color: rgb(24, 32, 42);
width: 100%;
height: 100%;
}
#leftSideBarContent > h3 {
color: #ecf0f1;
display: block;
font-size: 1.1em;
font-weight: 100;
margin: 0 0 5px 0;
padding: 10px 0;
text-align: left;
}
#generalDetailsEdit {
/*color: #ecf0f1;*/
color: #ecf0f1;
}
#generalDetailsEdit > div {
padding: 5px;
}
#generalDetailsEdit > h3 {
color: #ecf0f1;
display: block;
font-size: 1.1em;
font-weight: 100;
margin: 0 0 5px 0;
padding: 10px 0;
text-align: left;
}
.subAccordion {
color: #ecf0f1;
display: block;
font-size: 0.8em;
font-weight: 100;
margin: 0;
padding: 5px;
text-align: left;
}
.subAccordionDescription {
padding: 0 5px;
}
.boxed {
padding: 0 5px;
}
.separatorLineRight {
border-right: 1px solid #f00;
}
.editPrefixButton:hover {
color: #ff972d;
cursor: pointer;
}
.editPrefixIcon:hover {
stroke: #ff972d;
stroke-width: 1px;
cursor: pointer;
}
.editPrefixIcon {
stroke: #fffff;
stroke-width: 1px;
cursor: pointer;
}
.deletePrefixButton:hover {
color: #ff972d;
cursor: pointer;
}
.deletePrefixButton {
color: #ff0000;
cursor: pointer;
}
.invisiblePrefixButton {
cursor: default;
color: rgb(24, 32, 42);
}
#containerForAddPrefixButton {
width: 100%;
margin-top: 5px;
}
.roundedButton {
border: 1px solid #000000;
border-radius: 20px;
padding: 0 5px;
background: #fff;
cursor: pointer;
color: black;
outline: none;
}
.roundedButton:hover {
background: #318638;
cursor: pointer;
color: #fff;
outline: none;
}
#prefixURL_Description {
padding: 5px 0 0 0;
}
.prefixIRIElements {
display: inline-block;
padding: 3px;
border-bottom: 1px solid #34495E;
width: 100%
}
.prefixInput {
width: 30px;
display: inline-block;
margin-right: 5px;
}
.prefixURL {
width: 100px;
display: inline-block;
paddig-left: 5px;
}
.selectedDefaultElement {
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
max-width: 200px;
}
#editHeader {
color: #ecf0f1;
background-color: #394f5a;
display: block;
font-size: 1.1em;
font-weight: 100;
text-align: center;
}
#leftHeader {
color: #ecf0f1;
background-color: #394f5a;
display: block;
font-size: 1.1em;
font-weight: 100;
text-align: center;
padding: 10px 0;
margin: 0;
}
.containerForDefaultSelection {
color: #ecf0f1;
display: block;
font-size: 1.1em;
font-weight: 100;
margin: 0;
padding: 10px 20px;
text-align: left;
}
.defaultSelected {
color: #a15d05;
background-color: #283943;
}
.containerForDefaultSelection:hover {
color: #f19505;
background-color: #394f5a;
display: block;
cursor: pointer;
}
#containerForLeftSideBar {
top: 50px;
float: left;
position: absolute;
background-color: #1b252e;
left: 0;
width: 200px;
height: 200px;
overflow-y: auto;
overflow-x: hidden;
}
#leftSideBar {
width: 100%;
background-color: rgb(24, 32, 42);
}
#loading-info {
box-sizing: border-box;
position: absolute;
text-align: center;
width: 100%;
height: 80%;
top: 0;
}
#loading-info > div {
display: inline-block;
color: #ffffff;
background-color: #18202A;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
#loading-info > * > * {
padding: 5px;
}
#loading-info {
pointer-events: none;
}
#loading-progress {
pointer-events: auto;
min-width: 220px;
border-radius: 10px;
}
#show-loadingInfo-button {
font-size: 12px;
color: #fff;
cursor: pointer;
text-align: center;
}
#loadingIndicator_closeButton:hover {
color: #ff972d;
cursor: pointer;
}
#loadingIndicator_closeButton {
color: #ffe30f;
cursor: pointer;
padding-bottom: 5px;
float: right;
}
.busyProgressBar {
background-color: #000;
height: 25px;
position: relative;
animation: busy 2s linear infinite;
}
@-webkit-keyframes busy {
0% {
left: 0%;
}
50% {
left: 80%;
}
100% {
left: 0%;
}
}
#bulletPoint_container {
padding-left: 15px;
margin-top: 0px;
margin-bottom: 0px;
}
#bulletPoint_container > div {
margin-left: -15px;
}
#loadingInfo-container {
box-sizing: border-box;
text-align: left;
line-height: 1.2;
padding-top: 5px;
overflow: auto;
/*white-space: nowrap;*/
/*min-width: 250px;*/
height: 120px;
min-height: 40px;
background-color: #3c3c3c;
}
#error-description-button {
margin: 5px 0 0 0;
font-size: 12px;
color: #69c;
cursor: pointer;
text-align: center;
}
#error-description-container {
box-sizing: border-box;
text-align: left;
}
#error-description-container pre {
background-color: #34495E;
padding: 2px;
margin: 0;
white-space: pre-wrap;
max-height: calc(100vh - 125px);
max-width: 75vw;
overflow: auto;
}
.spin {
display: inline-block;
-webkit-animation: spin 2s infinite linear;
animation: spin 2s infinite linear;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.truncate {
max-width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.color-mode-switch {
float: right;
width: 90px;
cursor: pointer;
height: 20px;
padding: 0;
border: 0;
color: #555;
background-color: #ECEEEF;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 0 3px rgba(0, 0, 0, 0.1);
}
.color-mode-switch:focus {
outline-width: 0;
}
.color-mode-switch.active {
color: #FFF;
background-color: #32CD32;
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 0 3px rgba(0, 0, 0, 0.1);
}
/* adding button pulse animation*/
.filterMenuButtonHighlight {
background-color: #d90;
}
@-webkit-keyframes buttonAnimation {
0% {
background-color: unset;
}
100% {
background-color: #d90;
}
}
@-moz-keyframes buttonAnimation {
0% {
background-color: unset;
}
100% {
background-color: #d90;
}
}
@-o-keyframes buttonAnimation {
0% {
background-color: unset;
}
100% {
background-color: #d90;
}
}
@keyframes buttonAnimation {
0% {
background-color: unset;
}
100% {
background-color: #d90;
}
}
.buttonPulse {
-webkit-animation-name: buttonAnimation;
-moz-animation-name: buttonAnimation;
-o-animation-name: buttonAnimation;
animation-name: buttonAnimation;
-webkit-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-animation-iteration-count: 3;
-moz-animation-iteration-count: 3;
-o-animation-iteration-count: 3;
animation-iteration-count: 3;
-webkit-animation-timing-function: linear;
-moz-animation-timing-function: linear;
-o-animation-timing-function: linear;
animation-timing-function: linear;
}
/*swipe bar definition*/
/*Overwriting individual menu widths*/
#m_about {
max-width: 200px;
width: 200px;
position: absolute;
}
#m_modes {
max-width: 160px;
width: 160px;
position: absolute;
}
#m_filter {
max-width: 170px;
width: 170px;
position: absolute;
}
#m_gravity {
max-width: 180px;
width: 180px;
position: absolute;
}
#m_export {
max-width: 160px;
width: 160px;
position: absolute;
}
#exportedUrl {
width: 100px;
}
#m_select {
max-width: 300px;
width: 300px;
position: absolute;
}
#m_config {
max-width: 240px;
width: 240px;
position: absolute;
}
#m_search {
max-width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/***************** REWRITING MENU ELEMENT CONTAINERS ***********************/
/*Container which holds the swipeBar*/
#swipeBarContainer {
position: fixed;
width: 77.8%;
height: 40px;
margin: 0;
padding: 0;
bottom: 0;
}
/*Scroll-able container for the menu entries */
#menuElementContainer {
margin: 0;
padding: 0;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
text-align: right;
list-style-type: none;
}
/*Style for the individual menu entries*/
#menuElementContainer > li {
display: inline-block;
box-sizing: border-box;
text-align: left;
position: relative;
height: 40px;
font-size: 14px;
color: #ffffff;
padding: 12px 0 0;
margin-left: -4px;
}
/*Font-color Style for menu entries */
#menuElementContainer > li > a {
color: #fff;
padding: 9px 12px 12px 30px;
}
.menuElementSvgElement {
height: 20px;
width: 20px;
display: block;
position: absolute;
top: 10px;
left: 8px;
}
.btn_shadowed {
background-color: #fefefe;
box-shadow: 1px 1px 1px gray;
}
.reloadCachedOntologyIcon {
height: 20px;
width: 108px;
display: block;
position: absolute;
top: 20px;
left: 3px;
/*background: #ecf0f1;;*/
border: solid 1px black;
border-radius: 10px;
cursor: pointer;
}
.reloadCachedOntologyIcon:disabled {
background: #f4f4f4;
cursor: auto;
border: solid 1px darkgray;
}
.reloadCachedOntologyIcon:hover {
background: #d90;
cursor: pointer;
}
.disabledReloadElement {
cursor: auto;
background: #F4F4F4;
pointer-events: auto;
border: solid 1px darkgray;
color: #bbbbbb;
}
.disabledReloadElement:hover {
cursor: auto;
background: #EEEEEE;
pointer-events: auto;
}
#menuElementContainer > li > input {
color: #000;
/*padding : 0 0.3em 0 1.5em;*/
padding: 0.1em .3em 0.1em 1.5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 120px;
}
/*Hovered behavior for the menu entries*/
#menuElementContainer > li > a:hover {
box-sizing: border-box;
background: #1B252E;
/*background : #d90;*/
color: #bdc3c7;
}
#empty:hover {
box-sizing: border-box;
background: #e1e1e1;
/*background : #d90;*/
color: #2980b9;
}
#empty.disabled {
pointer-events: none;
cursor: default;
color: #979797;
}
.disabled {
pointer-events: none;
cursor: default;
color: #979797;
}
/*ToolTip Menu Definition*/
.toolTipMenu {
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-sizing: border-box;
background-color: #ffffff;
border: 1px solid rgba(0, 0, 0, 0.15);
border-bottom: none;
border-radius: 4px 4px 0 0;
bottom: 0;
display: none;
font-size: 14px;
list-style: none;
/*max-width: 300px;*/
margin: 0;
padding: 0;
white-space: normal;
position: absolute;
z-index: 99;
}
.toolTipMenu > li:first-of-type {
border: none;
}
.toolTipMenu a {
color: #2980b9;
}
.toolTipMenu > li {
border-top: solid 1px #bdc3c7;
}
.toolTipMenu li {
color: #2980b9;
display: block;
}
/*MenuElement hovering enables the toolTip of the corresponding menu*/
#menuElementContainer > li:hover .toolTipMenu {
display: block;
}
#menuElementContainer li > ul.toolTipMenu li a:hover {
background: #e1e1e1;
}
/****************************************************************************/
/*ScrollButton behavior*/
#scrollLeftButton {
height: 30px;
width: 30px;
padding: 5px 0 5px 10px;
color: #fff;
cursor: pointer;
position: absolute;
margin-top: -2px;
font-size: 2em;
background-color: #24323e;
left: 0;
}
#scrollLeftButton:focus {
outline: none;
}
#scrollLeftButton:before {
content: "<";
}
/*Right Scroll Button*/
#scrollRightButton {
height: 30px;
width: 30px;
padding: 5px 0 5px 10px;
color: #fff;
cursor: pointer;
position: absolute;
margin-top: -2px;
font-size: 2em;
background-color: #24323e;
right: 0;
}
#scrollRightButton:focus {
outline: none;
}
#scrollRightButton:hover {
color: #bdc3c7;
}
#scrollLeftButton:hover {
color: #bdc3c7;
}
#scrollRightButton:before {
content: ">";
}
#centerGraphButton, #zoomInButton, #zoomOutButton {
border: 1px solid #000000;
text-align: center;
margin: -1px 0 0 0;
font-size: 1.5em;
padding: 0;
height: 28px;
}
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none;
/* Non-prefixed version, currently
supported by Chrome and Opera */
}
#zoomOutButton {
line-height: 22px;
}
#centerGraphButton {
line-height: 25px;
}
#zoomInButton {
line-height: 25px;
}
#zoomSlider > p:hover {
background-color: #d90;
}
#zoomSliderParagraph {
color: #000000;
padding-top: 5px;
margin: -1px 0 0 0;
border: 1px solid #000000;
/*background-color: #ecf0f1;*/
/*width: 28px;*/
height: 150px;
}
p#zoomSliderParagraph:hover {
background-color: #fff;
}
/*todo put this in a proper position*/
#zoomSlider {
width: 28px;
margin-top: -2px;
padding: 0;
font-size: 1.5em;
cursor: pointer;
position: absolute;
right: 20px;
bottom: 20px;
color: #000;
/*background-color: #ecf0f1;*/
box-sizing: border-box;
}
/****************************************************************************/
/*Definition for the Icons before*/
#menuElementContainer > li > a::before {
font-size: 1em;
margin: 0;
padding: 0 6px 0 0;
}
#menuElementContainer a.highlighted {
background-color: #d90;
}
/*#search-input-text.searchInputText {*/
/*!*padding: 0 0.2em;*!*/
/*color: black;*/
/*}*/
.inner-addon {
position: relative;
}
.searchIcon {
position: absolute;
/*padding: 0.15em 0;*/
width: 17px;
height: 17px;
pointer-events: none;
}
.gearIcon {
position: absolute;
width: 17px;
height: 17px;
pointer-events: none;
left: -5px;
}
/*#search-input-text::before {*/
/*!*padding: 0 0.2em;*!*/
/*!*color: black;*!*/
/*font-size: 1.4em; !* todo : test this *!*/
/*!*content: "\2315";*!*/
/*content: "⚲";*/
/*color: white;*/
/*padding: 0;*/
/*-webkit-transform: rotate(-45deg);*/
/*!*content: "\2315" or "\1F50D"*!;*/
/*display: inline-block;*/
/*position: relative;*/
/*top: 2px;*/
/*left:-5px;*/
/*}*/
li#c_search {
padding: 0 5px;
margin-left: 5px;
height: 20px;
}
/*Menu icons before the links selection */
/*#c_select > a::before { content: "\2263"; }*/
/*#c_export > a::before { content: "\21E4"; }*/
/*#c_gravity > a::before { content: "\2299"; }*/
/*#c_filter > a::before { content: "\25BD"; }*/
/*#c_modes > a::before { content: "\2606"; }*/
/*#c_reset > a::before { content: "\21BB"; }*/
/*#c_about > a::before { content: "\00A9"; }*/
li#c_locate {
padding: 0;
}
#c_locate > a {
font-size: 2em;
padding: 0;
}
a#pause-button {
padding: 12px 12px;
}
/*Pause Button has a different behavior*/
a#pause-button.paused::before {
content: "\25BA";
}
a#pause-button.paused:hover {
background-color: #d90;
color: #fff;
}
a#pause-button:not(.paused)::before {
content: "II";
}
.toolTipMenu li:hover {
background-color: #e1e1e1;
}
#emptyLiHover {
background-color: #FFFFFF;
}
#emptyLiHover:hover {
background-color: #FFFFFF;
}
.toggleOption li:hover {
background-color: #e1e1e1;
}
.toggleOption {
padding: 8px 5px;
}
#converter-option:hover {
background-color: #ffffff;
}
.toolTipMenu li a:only-child, .option {
display: block;
float: none;
padding: 8px 5px;
}
.customLocate {
padding: 0;
background-color: #32CD32;
}
a#locateSearchResult {
padding-bottom: 0;
padding-top: 50px;
position: relative;
top: 5px;
}
/*#sliderRange{*/
/*padding: 0;*/
/*margin: 7px 0 0 0;*/
/*width:100%;*/
/*height:5px;*/
/*-webkit-appearance: none;*/
/*outline: none;*/
/*}*/
#zoomSliderElement {
color: #000;
position: relative;
padding-top: 0;
width: 155px;
height: 24px;
background-color: transparent;
-webkit-transform-origin-x: 73px;
-webkit-transform-origin-y: 73px;
-webkit-transform: rotate(-90deg);
-moz-transform-origin: 73px 73px;
transform: rotate(-90deg);
transform-origin: 73px 73px;
-webkit-appearance: none;
outline: none;
margin: 4px 0;
}
/* ------------------ Zoom Slider styles --------------------------*/
#zoomSliderElement::-webkit-scrollbar {
height: 0;
}
#zoomSliderElement:hover {
cursor: crosshair;
}
/*TRACK*/
#zoomSliderElement::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #3071a9;
}
#zoomSliderElement::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #3071a9;
}
/*Thumb*/
#zoomSliderElement::-webkit-slider-thumb {
-webkit-appearance: none;
border: 1px solid #000000;
height: 10px;
width: 30px;
margin-right: 50px;
border-radius: 3px;
background: #fff;
cursor: pointer;
outline: none;
margin-top: -3px;
}
#zoomSliderElement::-ms-thumb {
-webkit-appearance: none;
border: 1px solid #000000;
height: 10px;
width: 30px;
margin-right: 50px;
border-radius: 3px;
background: #fff;
cursor: pointer;
outline: none;
margin-top: -3px;
}
#zoomSliderElement::-ms-thumb:hover {
-webkit-appearance: none;
border: 1px solid #000000;
height: 10px;
width: 30px;
margin-right: 50px;
border-radius: 3px;
background: #d90;
cursor: pointer;
outline: none;
margin-top: -3px;
}
#zoomSliderElement::-webkit-slider-thumb:hover {
-webkit-appearance: none;
border: 1px solid #000000;
height: 10px;
width: 30px;
margin-right: 50px;
border-radius: 3px;
background: #d90;
cursor: pointer;
outline: none;
margin-top: -3px;
}
#zoomSliderElement::-moz-range-thumb {
border: 1px solid #000000;
height: 10px;
width: 30px;
border-radius: 3px;
/*background: #ffffff;*/
cursor: pointer;
outline: none;
}
#zoomSliderElement::-moz-range-thumb:hover {
border: 1px solid #000000;
height: 10px;
width: 30px;
border-radius: 3px;
background: #d90;
cursor: pointer;
outline: none;
}
#zoomSliderElement::-moz-focus-outer {
border: 0;
}
#locateSearchResult:focus {
outline: none;
}
a#locateSearchResult.highlighted:hover {
background-color: #d90;
color: red;
}
a#locateSearchResult {
outline: none;
padding-bottom: 0;
padding-top: 0;
position: relative;
top: 5px;
}
/*Editor hints*/
#editorHint {
padding: 5px 5px;
position: absolute;
text-align: center;
width: 100%;
pointer-events: none;
}
#editorHint label {
pointer-events: auto;
float: right;
padding: 5px 5px;
color: #ffdd00;
}
#editorHint label:hover {
text-decoration: underline;
cursor: pointer;
}
#editorHint > div {
pointer-events: auto;
text-align: left;
display: inline-block;
color: #ffffff;
font-size: 0.8em;
background-color: #18202A;
padding: 5px 5px;
border-radius: 5px;
}
#WarningErrorMessagesContainer {
position: absolute;
text-align: center;
top: 0;
pointer-events: none;
}
/*Editor hints*/
#WarningErrorMessages {
position: relative;
/*text-align: center;*/
width: 50%;
pointer-events: auto;
margin: 10px 0;
padding-right: 12px;
overflow-y: auto;
overflow-x: hidden;
}
#WarningErrorMessages label {
pointer-events: auto;
float: right;
padding: 5px 5px;
color: #ffdd00;
}
#WarningErrorMessages span {
pointer-events: auto;
float: right;
padding: 5px 5px;
}
#WarningErrorMessages label:hover {
text-decoration: underline;
cursor: pointer;
}
#WarningErrorMessages > div {
pointer-events: auto;
text-align: left;
display: inline-block;
color: #ffffff;
font-size: 0.8em;
background-color: #18202A;
padding: 5px 5px;
border-radius: 10px;
border: solid 1px #ecf0f1;
width: 70%;
}
#WarningErrorMessagesContent > ul {
-webkit-padding-start: 20px;
padding: 0 16px;
}
#WarningErrorMessagesContent > ul > li {
padding: 5px;
}
.converter-form-Editor {
/*display: inline-block;*/
}
.textLineEditWithLabel {
display: inline-block;
width: 100%;
border-bottom: 1px solid #34495E;
padding: 2px 0;
}
.converter-form-Editor label {
/*//display: inline-block;*/
line-height: normal;
}
.descriptionTextClass {
background-color: #34495E;
color: white;
}
.prefixIRIElements input {
border: 1px solid #34495E;
background-color: #34495E;
color: white;
}
.prefixIRIElements input:disabled {
background-color: rgb(24, 32, 42);
border: 1px solid rgb(24, 32, 42);
color: white;
}
.converter-form-Editor input {
/*box-sizing: border-box;*/
/*height: 18px;*/
/*width: 69%;*/
float: right;
border: 1px solid #34495E;
background-color: #34495E;
color: white;
/*border-bottom: 1px solid #d90;*/
/*text-align: center;*/
/*display: inline-block;*/
}
.converter-form-Editor input:disabled {
background-color: #545350;
border: 1px solid #34495E;
color: #939798;
}
.disabledLabelForSlider {
color: #808080;
}
| 42,678 | 16.223164 | 110 | css |
null | hspo-ontology-main/docs/ontology-specification/webvowl/css/webvowl.css | /*-----------------------------------------------------------------
VOWL graphical elements (part of spec) - mixed CSS and SVG styles
-----------------------------------------------------------------*/
/*-------- Text --------*/
.text {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
.subtext {
font-size: 9px;
}
.text.instance-count {
fill: #666;
}
.external + text .instance-count {
fill: #aaa;
}
.cardinality {
font-size: 10px;
}
.text, .embedded {
pointer-events: none;
}
/*------- Colors ------*/
.class, .object, .disjoint, .objectproperty, .disjointwith, .equivalentproperty, .transitiveproperty, .functionalproperty, .inversefunctionalproperty, .symmetricproperty, .allvaluesfromproperty, .somevaluesfromproperty {
fill: #acf;
}
.label .datatype, .datatypeproperty {
fill: #9c6;
}
.rdf, .rdfproperty {
fill: #c9c;
}
.literal, .node .datatype {
fill: #fc3;
}
.deprecated, .deprecatedproperty {
fill: #ccc;
}
.external, .externalproperty {
/*fill: #36c;*/
}
path, .nofill {
fill: none;
}
marker path {
fill: #000;
}
.class, path, line, .fineline {
stroke: #000;
}
.white, .subclass, .subclassproperty, .external + text {
fill: #fff;
}
.class.hovered, .property.hovered, .cardinality.hovered, .cardinality.focused, .filled.hovered, .filled.focused, .values-from.filled.hovered {
fill: #f00 !important;
cursor: pointer;
}
.hoveredForEditing {
fill: #f00 !important;
cursor: pointer;
}
.feature {
fill: #f00;
cursor: pointer;
}
@-webkit-keyframes pulseAnimation {
0% {
-webkit-transform: scale(1.5);
stroke-width: 3.33;
}
50% {
stroke-width: 4;
}
100% {
-webkit-transform: scale(1.0);
stroke-width: 5;
}
}
@-moz-keyframes pulseAnimation {
0% {
-webkit-transform: scale(1.5);
stroke-width: 3.33;
}
50% {
stroke-width: 4;
}
100% {
-webkit-transform: scale(1.0);
stroke-width: 5;
}
}
@-o-keyframes pulseAnimation {
0% {
-webkit-transform: scale(1.5);
stroke-width: 3.33;
}
50% {
stroke-width: 4;
}
100% {
-webkit-transform: scale(1.0);
stroke-width: 5;
}
}
@keyframes pulseAnimation {
0% {
-webkit-transform: scale(1.5);
stroke-width: 3.33;
}
50% {
stroke-width: 4;
}
100% {
-webkit-transform: scale(1.0);
stroke-width: 5;
}
}
.searchResultA {
fill: none;
stroke-width: 5;
stroke: #f00;
-webkit-animation-name: pulseAnimation;
-moz-animation-name: pulseAnimation;
-o-animation-name: pulseAnimation;
animation-name: pulseAnimation;
-webkit-animation-duration: 0.8s;
-moz-animation-duration: 0.8s;
-o-animation-duration: 0.8s;
animation-duration: 0.8s;
-webkit-transform: translateZ(0);
-o-transform: translateZ(0);
-webkit-animation-iteration-count: 3;
-moz-animation-iteration-count: 3;
-o-animation-iteration-count: 3;
animation-iteration-count: 3;
-webkit-animation-timing-function: linear;
-moz-animation-timing-function: linear;
-o-animation-timing-function: linear;
animation-timing-function: linear;
}
/* a class for not animated search results (hovered over node)*/
.searchResultB {
fill: none;
stroke-width: 5;
stroke: #f00;
}
.hovered-MathSymbol {
fill: none;
stroke: #f00 !important;
}
.focused, path.hovered {
stroke: #f00 !important;
}
.indirect-highlighting, .feature:hover {
fill: #f90;
cursor: pointer;
}
.feature_hover {
fill: #f90;
cursor: pointer;
}
.values-from {
stroke: #69c;
}
.symbol, .values-from.filled {
fill: #69c;
}
/*------- Strokes ------*/
.class, path, line {
stroke-width: 2;
}
.fineline {
stroke-width: 1;
}
.dashed, .anonymous {
stroke-dasharray: 8;
}
.dotted {
stroke-dasharray: 3;
}
rect.focused, circle.focused {
stroke-width: 4px;
}
.nostroke {
stroke: none;
}
/*-----------------------------------------------------------------
Additional elements for the WebVOWL demo (NOT part of spec)
-----------------------------------------------------------------*/
.addDataPropertyElement {
fill: #9c6 !important;
cursor: pointer;
stroke-width: 2;
stroke: black;
}
.addDataPropertyElement:hover {
fill: #f90 !important;
cursor: pointer;
stroke-width: 2;
stroke: black;
}
.superHiddenElement {
fill: rgba(255, 153, 0, 0.4);
cursor: pointer;
stroke-width: 0;
stroke: black;
/*opacity:0;*/
}
.superOpacityElement {
opacity: 0;
}
.deleteParentElement:hover {
fill: #f90;
cursor: pointer;
stroke-width: 2;
stroke: black;
}
.deleteParentElement {
fill: #f00;
cursor: pointer;
stroke-width: 2;
stroke: black;
}
.classNodeDragPath {
stroke: black;
stroke-width: 2px;
}
.classDraggerNodeHovered {
fill: #f90;
stroke: black;
stroke-width: 2px;
cursor: pointer;
}
.classDraggerNode {
fill: #acf;
stroke: black;
stroke-width: 2px;
}
marker path {
/* Safari and Chrome workaround for inheriting the style of its link.
Use any value that is larger than the length of the marker path. */
stroke-dasharray: 100;
}
| 5,341 | 16.986532 | 220 | css |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/1_data_selection.py | import pandas as pd
import os
from utils_ import read_csv
def data_selection(input_path, filename, columns_to_remove, output_path):
d = read_csv(input_path + filename)
d.columns= d.columns.str.lower()
d.drop(columns_to_remove, axis=1, inplace=True)
d.to_csv(output_path + filename.lower(), index=False)
del d
if __name__ == '__main__':
input_path = 'data/initial_data/'
output_path = 'data/selected_data/'
if not os.path.exists(output_path):
os.makedirs(output_path)
# PATIENTS file
data_selection(input_path,
"PATIENTS.csv",
["row_id", "dod_hosp", "dod_ssn"],
output_path)
# ADMISSIONS file
data_selection(input_path,
"ADMISSIONS.csv",
["row_id", "admission_type", "admission_location", "discharge_location",
"insurance", "language", "has_chartevents_data"],
output_path)
# ICUSTAYS file
data_selection(input_path,
"ICUSTAYS.csv",
["row_id", "first_careunit", "last_careunit", "first_wardid", "last_wardid"],
output_path)
# CHARTEVENTS file
data_selection(input_path,
"CHARTEVENTS.csv",
["row_id", "storetime", "cgid"],
output_path)
# DATETIMEEVENTS file
data_selection(input_path,
"DATETIMEEVENTS.csv",
["row_id", "storetime", "cgid"],
output_path)
# INPUTEVENTS_CV file
data_selection(input_path,
"INPUTEVENTS_CV.csv",
["row_id", "rate", "rateuom","storetime", "cgid", "orderid",
"linkorderid", "originalamount", "originalamountuom", "originalroute",
"originalrate", "originalrateuom", "originalsite"],
output_path)
# INPUTEVENTS_MV file
data_selection(input_path,
"INPUTEVENTS_MV.csv",
["row_id", "rate", "rateuom","storetime", "cgid", "orderid",
"linkorderid", "ordercategoryname", "secondaryordercategoryname",
"ordercomponenttypedescription", "ordercategorydescription", "totalamount",
"totalamountuom", "isopenbag", "continueinnextdept", "cancelreason",
"comments_editedby", "comments_canceledby", "comments_date",
"originalamount", "originalrate"],
output_path)
# OUTPUTEVENTS file
data_selection(input_path,
"OUTPUTEVENTS.csv",
["row_id", "cgid"],
output_path)
# PROCEDUREEVENTS_MV file
data_selection(input_path,
"PROCEDUREEVENTS_MV.csv",
["row_id", "location", "locationcategory",
"storetime", "cgid", "orderid", "linkorderid", "ordercategoryname",
"secondaryordercategoryname", "ordercategorydescription", "isopenbag",
"continueinnextdept", "cancelreason", "comments_editedby",
"comments_canceledby", "comments_date"],
output_path)
# CPTEVENTS file
data_selection(input_path,
"CPTEVENTS.csv",
["row_id", "costcenter", "ticket_id_seq", "description"],
output_path)
# DIAGNOSES_ICD file
data_selection(input_path,
"DIAGNOSES_ICD.csv",
["row_id"],
output_path)
# PRESCRIPTIONS file
data_selection(input_path,
"PRESCRIPTIONS.csv",
["row_id", "icustay_id", "drug_type", "drug_name_poe",
"drug_name_generic", "prod_strength", "dose_val_rx",
"dose_unit_rx", "form_val_disp", "form_unit_disp",
"route"],
output_path)
# PROCEDURES_ICD file
data_selection(input_path,
"PROCEDURES_ICD.csv",
["row_id", "seq_num"],
output_path)
# NOTEEVENTS file
data_selection(input_path,
"NOTEEVENTS.csv",
["row_id", "chartdate", "charttime", "storetime", "cgid", "iserror"],
output_path) | 4,434 | 36.905983 | 97 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/2_1_data_wrangling.py | import pandas as pd
import os
from utils_ import read_csv, save_json
def check_nan(arg):
if pd.isna(arg):
return ''
else:
return arg
if __name__ == '__main__':
input_path = 'data/selected_data/'
output_path = 'data/processed_data/'
if not os.path.exists(output_path):
os.makedirs(output_path)
patients = read_csv(input_path + "patients.csv")
unified_data = {}
for index, row in patients.iterrows():
if row['subject_id'] in unified_data.keys():
print('Check')
else:
unified_data[str(row['subject_id'])] = {'gender': row['gender'],
'date_of_birth': row['dob'],
'date_of_death': row['dod'],
'death_overall': str(row['expire_flag']),
'admissions': {'admission_id': [],
'admission_time': [],
'discharged_time': [],
'death': [],
'religion': [],
'marital_status': [],
'ethnicity': [],
'diagnosis': []}}
admissions = read_csv(input_path + "admissions.csv")
for index, row in admissions.iterrows():
unified_data[str(row['subject_id'])]['admissions']['admission_id'].append(check_nan(str(row['hadm_id'])))
unified_data[str(row['subject_id'])]['admissions']['admission_time'].append(check_nan(row['admittime']))
unified_data[str(row['subject_id'])]['admissions']['discharged_time'].append(check_nan(row['dischtime']))
unified_data[str(row['subject_id'])]['admissions']['death'].append(str(check_nan(row['hospital_expire_flag'])))
unified_data[str(row['subject_id'])]['admissions']['religion'].append(check_nan(row['religion']))
unified_data[str(row['subject_id'])]['admissions']['marital_status'].append(check_nan(row['marital_status']))
unified_data[str(row['subject_id'])]['admissions']['ethnicity'].append(check_nan(row['ethnicity']))
unified_data[str(row['subject_id'])]['admissions']['diagnosis'].append(check_nan(row['diagnosis']))
icustays = read_csv(input_path + "icustays.csv")
# Update/Initialize the dictionary with new lists to respect 1-1 mapping between the IDs of ICU stay and admissions.
for k in unified_data.keys():
unified_data[k]['icu_stay'] = {'icu_stay_id': [0]*len(unified_data[k]['admissions']['admission_id']),
'length_of_stay': [0.0]*len(unified_data[k]['admissions']['admission_id']),
'dbsource': ['']*len(unified_data[k]['admissions']['admission_id'])}
for index, row in icustays.iterrows():
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['icu_stay']['icu_stay_id'][ind] = str(check_nan(row['icustay_id']))
unified_data[str(row['subject_id'])]['icu_stay']['length_of_stay'][ind] = str(check_nan(row['los']))
unified_data[str(row['subject_id'])]['icu_stay']['dbsource'][ind] = check_nan(row['dbsource'])
cptevents = read_csv(input_path + "cptevents.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and CPT events.
for k in unified_data.keys():
unified_data[k]['cpt_events'] = {'cpt_code': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'cpt_number': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'cpt_suffix': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'section_header': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'subsection_header': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in cptevents.iterrows():
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['cpt_events']['cpt_code'][ind].append(str(check_nan(row['cpt_cd'])))
unified_data[str(row['subject_id'])]['cpt_events']['cpt_number'][ind].append(str(check_nan(row['cpt_number'])))
unified_data[str(row['subject_id'])]['cpt_events']['cpt_suffix'][ind].append(str(check_nan(row['cpt_suffix'])))
unified_data[str(row['subject_id'])]['cpt_events']['section_header'][ind].append(check_nan(row['sectionheader']))
unified_data[str(row['subject_id'])]['cpt_events']['subsection_header'][ind].append(check_nan(row['subsectionheader']))
diagnoses = read_csv(input_path + "diagnoses_icd.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and diagnoses.
for k in unified_data.keys():
unified_data[k]['diagnoses'] = {'icd9_code': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in diagnoses.iterrows():
if str(check_nan(row['icd9_code'])) == '':
continue
else:
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['diagnoses']['icd9_code'][ind].append(check_nan(row['icd9_code']))
prescriptions = read_csv(input_path + "prescriptions.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and prescriptions.
for k in unified_data.keys():
unified_data[k]['prescriptions'] = {'drug': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'formulary_drug_cd': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'gsn': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'ndc': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in prescriptions.iterrows():
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['prescriptions']['drug'][ind].append(check_nan(row['drug']))
unified_data[str(row['subject_id'])]['prescriptions']['formulary_drug_cd'][ind].append(check_nan(row['formulary_drug_cd']))
unified_data[str(row['subject_id'])]['prescriptions']['gsn'][ind].append(str(check_nan(row['gsn'])))
unified_data[str(row['subject_id'])]['prescriptions']['ndc'][ind].append(str(check_nan(row['ndc'])))
procedures = read_csv(input_path + "procedures_icd.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and procedures.
for k in unified_data.keys():
unified_data[k]['procedures'] = {'icd9_code': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in procedures.iterrows():
if str(check_nan(row['icd9_code'])) == '':
continue
else:
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['procedures']['icd9_code'][ind].append(str(check_nan(row['icd9_code'])))
# Update the dictionary with the age of the patient
for k in unified_data.keys():
tmp_age = []
for a_t in unified_data[k]['admissions']['admission_time']:
tmp_age.append(str((int(a_t.split('-')[0]) - int(unified_data[k]['date_of_birth'].split('-')[0]))))
unified_data[k]['admissions']['age'] = tmp_age
# Unify, if possible, the age, the religion, marital_status and ethnicity information
for k in unified_data.keys():
# Age
age_unified = unified_data[k]['admissions']['age'][0]
for a in unified_data[k]['admissions']['age']:
if a != age_unified:
age_unified = ''
break
unified_data[k]['age_unified'] = age_unified
# Religion
rel_unified = unified_data[k]['admissions']['religion'][0]
for r in unified_data[k]['admissions']['religion']:
if r != rel_unified:
rel_unified = ''
break
unified_data[k]['religion_unified'] = rel_unified
# Marital status
mar_status_unified = unified_data[k]['admissions']['marital_status'][0]
for m_s in unified_data[k]['admissions']['marital_status']:
if m_s != mar_status_unified:
mar_status_unified = ''
break
unified_data[k]['marital_status_unified'] = mar_status_unified
# Ethnicity
ethnicity_unified = unified_data[k]['admissions']['ethnicity'][0]
for eth in unified_data[k]['admissions']['ethnicity']:
if eth != ethnicity_unified:
ethnicity_unified = ''
break
unified_data[k]['ethnicity_unified'] = ethnicity_unified
save_json(unified_data, output_path + '1_data_after_data_wrangling.json')
| 9,756 | 58.493902 | 137 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/2_2_data_wrangling_grouped_icd9.py | import pandas as pd
import os
from utils_ import read_csv, save_json
def check_nan(arg):
if pd.isna(arg):
return ''
else:
return arg
def group_icd9_code(code):
if code == '':
return ''
elif code[0] == 'E':
return code[:4]
else:
return code[:3]
if __name__ == '__main__':
input_path = 'data/selected_data/'
output_path = 'data/processed_data/'
if not os.path.exists(output_path):
os.makedirs(output_path)
patients = read_csv(input_path + "patients.csv")
unified_data = {}
for index, row in patients.iterrows():
if row['subject_id'] in unified_data.keys():
print('Check')
else:
unified_data[str(row['subject_id'])] = {'gender': row['gender'],
'date_of_birth': row['dob'],
'date_of_death': row['dod'],
'death_overall': str(row['expire_flag']),
'admissions': {'admission_id': [],
'admission_time': [],
'discharged_time': [],
'death': [],
'religion': [],
'marital_status': [],
'ethnicity': [],
'diagnosis': []}}
admissions = read_csv(input_path + "admissions.csv")
for index, row in admissions.iterrows():
unified_data[str(row['subject_id'])]['admissions']['admission_id'].append(check_nan(str(row['hadm_id'])))
unified_data[str(row['subject_id'])]['admissions']['admission_time'].append(check_nan(row['admittime']))
unified_data[str(row['subject_id'])]['admissions']['discharged_time'].append(check_nan(row['dischtime']))
unified_data[str(row['subject_id'])]['admissions']['death'].append(str(check_nan(row['hospital_expire_flag'])))
unified_data[str(row['subject_id'])]['admissions']['religion'].append(check_nan(row['religion']))
unified_data[str(row['subject_id'])]['admissions']['marital_status'].append(check_nan(row['marital_status']))
unified_data[str(row['subject_id'])]['admissions']['ethnicity'].append(check_nan(row['ethnicity']))
unified_data[str(row['subject_id'])]['admissions']['diagnosis'].append(check_nan(row['diagnosis']))
icustays = read_csv(input_path + "icustays.csv")
# Update/Initialize the dictionary with new lists to respect 1-1 mapping between the IDs of ICU stay and admissions.
for k in unified_data.keys():
unified_data[k]['icu_stay'] = {'icu_stay_id': [0]*len(unified_data[k]['admissions']['admission_id']),
'length_of_stay': [0.0]*len(unified_data[k]['admissions']['admission_id']),
'dbsource': ['']*len(unified_data[k]['admissions']['admission_id'])}
for index, row in icustays.iterrows():
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['icu_stay']['icu_stay_id'][ind] = str(check_nan(row['icustay_id']))
unified_data[str(row['subject_id'])]['icu_stay']['length_of_stay'][ind] = str(check_nan(row['los']))
unified_data[str(row['subject_id'])]['icu_stay']['dbsource'][ind] = check_nan(row['dbsource'])
cptevents = read_csv(input_path + "cptevents.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and CPT events.
for k in unified_data.keys():
unified_data[k]['cpt_events'] = {'cpt_code': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'cpt_number': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'cpt_suffix': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'section_header': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'subsection_header': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in cptevents.iterrows():
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['cpt_events']['cpt_code'][ind].append(str(check_nan(row['cpt_cd'])))
unified_data[str(row['subject_id'])]['cpt_events']['cpt_number'][ind].append(str(check_nan(row['cpt_number'])))
unified_data[str(row['subject_id'])]['cpt_events']['cpt_suffix'][ind].append(str(check_nan(row['cpt_suffix'])))
unified_data[str(row['subject_id'])]['cpt_events']['section_header'][ind].append(check_nan(row['sectionheader']))
unified_data[str(row['subject_id'])]['cpt_events']['subsection_header'][ind].append(check_nan(row['subsectionheader']))
diagnoses = read_csv(input_path + "diagnoses_icd.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and diagnoses.
for k in unified_data.keys():
unified_data[k]['diagnoses'] = {'icd9_code': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in diagnoses.iterrows():
if str(check_nan(row['icd9_code'])) == '':
continue
else:
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['diagnoses']['icd9_code'][ind].append(group_icd9_code(check_nan(row['icd9_code'])))
prescriptions = read_csv(input_path + "prescriptions.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and prescriptions.
for k in unified_data.keys():
unified_data[k]['prescriptions'] = {'drug': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'formulary_drug_cd': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'gsn': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))],
'ndc': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in prescriptions.iterrows():
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['prescriptions']['drug'][ind].append(check_nan(row['drug']))
unified_data[str(row['subject_id'])]['prescriptions']['formulary_drug_cd'][ind].append(check_nan(row['formulary_drug_cd']))
unified_data[str(row['subject_id'])]['prescriptions']['gsn'][ind].append(str(check_nan(row['gsn'])))
unified_data[str(row['subject_id'])]['prescriptions']['ndc'][ind].append(str(check_nan(row['ndc'])))
procedures = read_csv(input_path + "procedures_icd.csv")
# Update/Initialize the dictionary with new lists to respect the mapping between the admission IDs and procedures.
for k in unified_data.keys():
unified_data[k]['procedures'] = {'icd9_code': [[] for _ in range(len(unified_data[k]['admissions']['admission_id']))]}
for index, row in procedures.iterrows():
if str(check_nan(row['icd9_code'])) == '':
continue
else:
ind = unified_data[str(row['subject_id'])]['admissions']['admission_id'].index(str(row['hadm_id']))
unified_data[str(row['subject_id'])]['procedures']['icd9_code'][ind].append(group_icd9_code(str(check_nan(row['icd9_code']))))
# Update the dictionary with the age of the patient
for k in unified_data.keys():
tmp_age = []
for a_t in unified_data[k]['admissions']['admission_time']:
tmp_age.append(str((int(a_t.split('-')[0]) - int(unified_data[k]['date_of_birth'].split('-')[0]))))
unified_data[k]['admissions']['age'] = tmp_age
# Unify, if possible, the age, the religion, marital_status and ethnicity information
for k in unified_data.keys():
# Age
age_unified = unified_data[k]['admissions']['age'][0]
for a in unified_data[k]['admissions']['age']:
if a != age_unified:
age_unified = ''
break
unified_data[k]['age_unified'] = age_unified
# Religion
rel_unified = unified_data[k]['admissions']['religion'][0]
for r in unified_data[k]['admissions']['religion']:
if r != rel_unified:
rel_unified = ''
break
unified_data[k]['religion_unified'] = rel_unified
# Marital status
mar_status_unified = unified_data[k]['admissions']['marital_status'][0]
for m_s in unified_data[k]['admissions']['marital_status']:
if m_s != mar_status_unified:
mar_status_unified = ''
break
unified_data[k]['marital_status_unified'] = mar_status_unified
# Ethnicity
ethnicity_unified = unified_data[k]['admissions']['ethnicity'][0]
for eth in unified_data[k]['admissions']['ethnicity']:
if eth != ethnicity_unified:
ethnicity_unified = ''
break
unified_data[k]['ethnicity_unified'] = ethnicity_unified
save_json(unified_data, output_path + '1_data_after_data_wrangling_grouped_icd9.json')
| 9,952 | 56.531792 | 138 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/3_1_data_mapping_dictionaries.py | from utils_ import read_csv, read_json, save_json, convert_to_str
import pandas as pd
def find_black_list(data, codes, key_name):
black_list = []
for k in data.keys():
for l_ in data[k][key_name]['icd9_code']:
for it in l_:
if it not in codes:
if it not in black_list:
black_list.append(it)
return black_list
def find_black_list_second_level(old_black_list, codes):
black_list = []
for c in old_black_list:
if c not in codes:
black_list.append(c)
return black_list
def mapping_to_dictionary(data, codes, descriptions, key_name):
for k in data.keys():
data[k][key_name]['textual_description'] = []
for l_ in data[k][key_name]['icd9_code']:
tmp_l = []
for it in l_:
ind = codes.index(it)
tmp_l.append(descriptions[ind])
data[k][key_name]['textual_description'].append(tmp_l)
def mapping_to_dictionary_two_levels(data, codes1, descriptions1, key_name, codes2, descriptions2):
for k in data.keys():
data[k][key_name]['textual_description'] = []
for l_ in data[k][key_name]['icd9_code']:
tmp_l = []
for it in l_:
try:
ind = codes1.index(it)
tmp_l.append(descriptions1[ind])
except:
ind = codes2.index(it)
tmp_l.append(descriptions2[ind])
data[k][key_name]['textual_description'].append(tmp_l)
def get_codes_descr(dict_):
codes = []
descr = []
for l in dict_:
for d in l:
if d['code'] == None or '-' in d['code'] or d['code'] in codes:
continue
else:
codes.append(d['code'].replace('.', ''))
descr.append(d['descr'].lower())
return codes, descr
if __name__ == '__main__':
output_path = 'data/processed_data/'
data = read_json('data/processed_data/1_data_after_data_wrangling.json')
## Mapping diagnoses
d_icd_diagnoses = read_csv('data/dictionaries/D_ICD_DIAGNOSES.csv')
icd_codes_diagnoses = convert_to_str(d_icd_diagnoses['icd9_code'.upper()].tolist())
black_list_icd_diagnoses = find_black_list(data, icd_codes_diagnoses, 'diagnoses')
black_list_textual_description_diagnoses = read_json('data/dictionaries/black_list_textual_description_diagnoses.json')
for code, textual_discr in zip(black_list_icd_diagnoses, black_list_textual_description_diagnoses):
tmp_df = pd.DataFrame({'ROW_ID': ['0'],
'ICD9_CODE': [code],
'SHORT_TITLE': [''],
'LONG_TITLE': [textual_discr]})
d_icd_diagnoses = pd.concat([d_icd_diagnoses, tmp_df], ignore_index = True, axis = 0)
# Save the updated dictionary
d_icd_diagnoses.to_csv('data/dictionaries/D_ICD_DIAGNOSES_updated.csv', index=False)
icd_codes_diagnoses = convert_to_str(d_icd_diagnoses['icd9_code'.upper()].tolist())
long_title_diagnoses = d_icd_diagnoses['long_title'.upper()].tolist()
mapping_to_dictionary(data, icd_codes_diagnoses, long_title_diagnoses, 'diagnoses')
d_icd_procedures = read_csv('data/dictionaries/D_ICD_PROCEDURES.csv')
icd_codes_procedures = convert_to_str(d_icd_procedures['icd9_code'.upper()].tolist())
black_list_icd_procedures = find_black_list(data, icd_codes_procedures, 'procedures')
codes_proc = read_json('data/dictionaries/codes_proc_updated.json')
codes, descr = get_codes_descr(codes_proc)
new_black_list_icd_procedures = find_black_list_second_level(black_list_icd_procedures, codes)
long_title_procedures = d_icd_procedures['long_title'.upper()].tolist()
mapping_to_dictionary_two_levels(data, icd_codes_procedures, long_title_procedures, 'procedures', codes, descr)
save_json(data, output_path + '2_data_after_dictionary_mappings.json') | 4,057 | 39.58 | 123 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/3_2_data_mapping_dictionaries_grouped_icd9.py | from utils_ import read_csv, read_json, save_json, convert_to_str
import pandas as pd
def find_black_list(data, codes, key_name):
black_list = []
for k in data.keys():
for l_ in data[k][key_name]['icd9_code']:
for it in l_:
if it not in codes:
if it not in black_list:
black_list.append(it)
return black_list
def find_black_list_second_level(old_black_list, codes):
black_list = []
for c in old_black_list:
if c not in codes:
black_list.append(c)
return black_list
def mapping_to_dictionary(data, codes, descriptions, key_name):
for k in data.keys():
data[k][key_name]['textual_description'] = []
for l_ in data[k][key_name]['icd9_code']:
tmp_l = []
for it in l_:
ind = codes.index(it)
tmp_l.append(descriptions[ind])
data[k][key_name]['textual_description'].append(tmp_l)
def mapping_to_dictionary_two_levels(data, codes1, descriptions1, key_name, codes2, descriptions2):
for k in data.keys():
data[k][key_name]['textual_description'] = []
for l_ in data[k][key_name]['icd9_code']:
tmp_l = []
for it in l_:
try:
ind = codes1.index(it)
tmp_l.append(descriptions1[ind])
except:
ind = codes2.index(it)
tmp_l.append(descriptions2[ind])
data[k][key_name]['textual_description'].append(tmp_l)
def get_codes_descr(dict_):
codes = []
descr = []
for l in dict_:
for d in l:
if d['code'] == None or '-' in d['code'] or d['code'] in codes:
continue
else:
codes.append(d['code'].replace('.', ''))
descr.append(d['descr'].lower())
return codes, descr
if __name__ == '__main__':
output_path = 'data/processed_data/'
data = read_json('data/processed_data/1_data_after_data_wrangling_grouped_icd9.json')
## Mapping diagnoses
d_icd_diagnoses = read_csv('data/dictionaries/D_ICD_DIAGNOSES_updated.csv')
icd_codes_diagnoses = convert_to_str(d_icd_diagnoses['icd9_code'.upper()].tolist())
black_list_icd_diagnoses = find_black_list(data, icd_codes_diagnoses, 'diagnoses')
codes_diag = read_json('data/dictionaries/codes_diag_updated.json')
codes_diagnoses, descr_diagnoses = get_codes_descr(codes_diag)
new_black_list_icd_diagnoses = find_black_list_second_level(black_list_icd_diagnoses, codes_diagnoses)
long_title_diagnoses = d_icd_diagnoses['long_title'.upper()].tolist()
mapping_to_dictionary_two_levels(data, icd_codes_diagnoses,
long_title_diagnoses, 'diagnoses',
codes_diagnoses, descr_diagnoses)
# Mapping procedures
d_icd_procedures = read_csv('data/dictionaries/D_ICD_PROCEDURES.csv')
icd_codes_procedures = convert_to_str(d_icd_procedures['icd9_code'.upper()].tolist())
black_list_icd_procedures = find_black_list(data, icd_codes_procedures, 'procedures')
codes_proc = read_json('data/dictionaries/codes_proc_updated.json')
codes_procedures, descr_procedures = get_codes_descr(codes_proc)
new_black_list_icd_procedures = find_black_list_second_level(black_list_icd_procedures, codes_procedures)
long_title_procedures = d_icd_procedures['long_title'.upper()].tolist()
mapping_to_dictionary_two_levels(data, icd_codes_procedures,
long_title_procedures, 'procedures',
codes_procedures, descr_procedures)
save_json(data, output_path + '2_data_after_dictionary_mappings_grouped_icd9.json') | 3,862 | 38.824742 | 109 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/4_data_sampling.py | import argparse
from datetime import date
from utils_ import read_json, save_json
def add_record(sampled_data, data, k, ind, label):
if k not in list(sampled_data.keys()):
sampled_data[k] = {'1': {'readmission': label,
'gender': data[k]['gender'],
'religion': data[k]['admissions']['religion'][ind],
'marital_status': data[k]['admissions']['marital_status'][ind],
'ethnicity': data[k]['admissions']['ethnicity'][ind],
'age': data[k]['admissions']['age'][ind],
'diagnosis': data[k]['admissions']['diagnosis'][ind],
'cpt_events': {'cpt_code': data[k]['cpt_events']['cpt_code'][ind],
'cpt_number': data[k]['cpt_events']['cpt_number'][ind],
'cpt_suffix': data[k]['cpt_events']['cpt_suffix'][ind],
'section_header': data[k]['cpt_events']['section_header'][ind],
'subsection_header': data[k]['cpt_events']['subsection_header'][ind]},
'diagnoses': {'icd9_code': data[k]['diagnoses']['icd9_code'][ind],
'textual_description': data[k]['diagnoses']['textual_description'][ind]},
'prescriptions': {'drug': data[k]['prescriptions']['drug'][ind],
'formulary_drug_cd': data[k]['prescriptions']['formulary_drug_cd'][ind],
'gsn': data[k]['prescriptions']['gsn'][ind],
'ndc': data[k]['prescriptions']['ndc'][ind]},
'procedures': {'icd9_code': data[k]['procedures']['icd9_code'][ind],
'textual_description': data[k]['procedures']['textual_description'][ind]}}}
else:
sampled_data[k][str(len(list((sampled_data[k].keys())))+1)] = {'readmission': label,
'gender': data[k]['gender'],
'religion': data[k]['admissions']['religion'][ind],
'marital_status': data[k]['admissions']['marital_status'][ind],
'ethnicity': data[k]['admissions']['ethnicity'][ind],
'age': data[k]['admissions']['age'][ind],
'diagnosis': data[k]['admissions']['diagnosis'][ind],
'cpt_events': {'cpt_code': data[k]['cpt_events']['cpt_code'][ind],
'cpt_number': data[k]['cpt_events']['cpt_number'][ind],
'cpt_suffix': data[k]['cpt_events']['cpt_suffix'][ind],
'section_header': data[k]['cpt_events']['section_header'][ind],
'subsection_header': data[k]['cpt_events']['subsection_header'][ind]},
'diagnoses': {'icd9_code': data[k]['diagnoses']['icd9_code'][ind],
'textual_description': data[k]['diagnoses']['textual_description'][ind]},
'prescriptions': {'drug': data[k]['prescriptions']['drug'][ind],
'formulary_drug_cd': data[k]['prescriptions']['formulary_drug_cd'][ind],
'gsn': data[k]['prescriptions']['gsn'][ind],
'ndc': data[k]['prescriptions']['ndc'][ind]},
'procedures': {'icd9_code': data[k]['procedures']['icd9_code'][ind],
'textual_description': data[k]['procedures']['textual_description'][ind]}}
# Return the new key that was generated as: subject_id + '_' + new_key
return k + '_' + list(sampled_data[k].keys())[-1]
def sample_data(data, threshold):
mapped_keys = {}
sampled_data = {}
for k in data.keys():
for i, d in enumerate(data[k]['admissions']['death']):
if d == '1':
continue
else:
# End of list
if i+1 == len(data[k]['admissions']['death']):
if data[k]['death_overall'] == '0':
# The patient is still alive and didn't readmit to the hospital.
new_key = add_record(sampled_data, data, k, i, '0')
old_key = k + '_' + data[k]['admissions']['admission_id'][i]
mapped_keys[old_key] = new_key
else:
cur_discharged_time = data[k]['admissions']['discharged_time'][i]
date_of_death = data[k]['date_of_death']
d0 = date(int(cur_discharged_time.split(' ')[0].split('-')[0]), int(cur_discharged_time.split(' ')[0].split('-')[1]), int(cur_discharged_time.split(' ')[0].split('-')[2]))
d1 = date(int(date_of_death.split(' ')[0].split('-')[0]), int(date_of_death.split(' ')[0].split('-')[1]), int(date_of_death.split(' ')[0].split('-')[2]))
delta = d1 - d0
if delta.days > threshold:
new_key = add_record(sampled_data, data, k, i, '0')
old_key = k + '_' + data[k]['admissions']['admission_id'][i]
mapped_keys[old_key] = new_key
else:
# The patient died outside of the hospital within the given threshold, so readmission is not possible.
continue
else:
cur_discharged_time = data[k]['admissions']['discharged_time'][i]
next_admission_time = data[k]['admissions']['admission_time'][i+1]
d0 = date(int(cur_discharged_time.split(' ')[0].split('-')[0]), int(cur_discharged_time.split(' ')[0].split('-')[1]), int(cur_discharged_time.split(' ')[0].split('-')[2]))
d1 = date(int(next_admission_time.split(' ')[0].split('-')[0]), int(next_admission_time.split(' ')[0].split('-')[1]), int(next_admission_time.split(' ')[0].split('-')[2]))
delta = d1 - d0
if delta.days <= threshold:
new_key = add_record(sampled_data, data, k, i, '1')
old_key = k + '_' + data[k]['admissions']['admission_id'][i]
mapped_keys[old_key] = new_key
else:
new_key = add_record(sampled_data, data, k, i, '0')
old_key = k + '_' + data[k]['admissions']['admission_id'][i]
mapped_keys[old_key] = new_key
return sampled_data, mapped_keys
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--threshold", default=30, type=int, required=True,
help = "The span of days to monitor if the patient is going to be readmitted to the ICU or no.")
args = parser.parse_args()
# grouped ICD9 version
data = read_json('data/processed_data/2_data_after_dictionary_mappings_grouped_icd9.json')
sampled_data_final, mapped_keys = sample_data(data, args.threshold)
save_json(sampled_data_final, 'data/processed_data/3_data_task_valid_grouped_icd9.json')
save_json(mapped_keys, 'data/processed_data/key_mapping_from_total_to_task_valid.json')
# non-grouped ICD9 version
data = read_json('data/processed_data/2_data_after_dictionary_mappings.json')
sampled_data_final, mapped_keys = sample_data(data, args.threshold)
save_json(sampled_data_final, 'data/processed_data/3_data_task_valid.json') | 8,858 | 76.034783 | 195 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/5_notes_info_integration.py | import os
import argparse
import pandas as pd
from utils_ import read_json, save_json, find_json_files
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--grouped_ICD9", default=None, type=int, required=True,
help = "Flag to define the input data (grouped ICD9 version or non-grouped ICD9 version).")
parser.add_argument("--umls_codes_path", default=None, type=str, required=True,
help = "The path where the mapped extracted UMLS codes are stored.")
parser.add_argument("--employment_mapping_path", default=None, type=str, required=True,
help = "The path of the employment mapping csv file.")
parser.add_argument("--household_mapping_path", default=None, type=str, required=True,
help = "The path of the household mapping csv file.")
parser.add_argument("--housing_mapping_path", default=None, type=str, required=True,
help = "The path of the housing mapping csv file.")
args = parser.parse_args()
if args.grouped_ICD9:
data_init = read_json('data/processed_data/3_data_task_valid_grouped_icd9.json')
else:
data_init = read_json('data/processed_data/3_data_task_valid.json')
social_files = find_json_files(args.umls_codes_path)
employment_mapping = pd.read_csv(args.employment_mapping_path)
employment_umls_codes = employment_mapping['CUI'].tolist()
employment_textual_description = employment_mapping['Description'].tolist()
household_mapping = pd.read_csv(args.household_mapping_path)
household_umls_codes = household_mapping['CUI'].tolist()
household_textual_description = household_mapping['Description'].tolist()
housing_mapping = pd.read_csv(args.housing_mapping_path)
housing_umls_codes = housing_mapping['CUI'].tolist()
housing_textual_description = housing_mapping['Description'].tolist()
for f in social_files:
s_f = read_json(f)
name = f.split('/')[-1].split('.')[0]
k1 = name.split('_')[0]
k2 = name.split('_')[1]
data_init[k1][k2]['notes_info'] = {'umls_codes': s_f['umls_codes'],
'textual_description': s_f['textual_description']}
data_init[k1][k2]['social_info'] = {'employment': {'umls_codes': [],
'textual_description': []},
'housing': {'umls_codes': [],
'textual_description': []},
'household_composition': {'umls_codes': [],
'textual_description': []}}
for c in s_f['umls_codes']:
# Treat employment codes
try:
employment_index = employment_umls_codes.index(c)
data_init[k1][k2]['social_info']['employment']['umls_codes'].append(c)
data_init[k1][k2]['social_info']['employment']['textual_description'].append(employment_textual_description[employment_index].lower())
except:
pass
# Treat household
try:
household_index = household_umls_codes.index(c)
data_init[k1][k2]['social_info']['household_composition']['umls_codes'].append(c)
data_init[k1][k2]['social_info']['household_composition']['textual_description'].append(household_textual_description[household_index].lower())
except:
pass
# Treat housing
try:
housing_index = housing_umls_codes.index(c)
data_init[k1][k2]['social_info']['housing']['umls_codes'].append(c)
data_init[k1][k2]['social_info']['housing']['textual_description'].append(housing_textual_description[housing_index].lower())
except:
pass
output_path = "data/processed_data/"
if args.grouped_ICD9:
save_json(data_init, output_path + '4_data_after_adding_notes_info_grouped_icd9.json')
else:
save_json(data_init, output_path + '4_data_after_adding_notes_info.json') | 4,270 | 52.3875 | 159 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/6_1_data_analysis_overall.py | import json
from statistics import mean
from datetime import date
import pandas as pd
import argparse
import os
from utils_ import read_json
class DataAnalysis:
def __init__(self, input_path, output_path, diagnoses_dict_path1, diagnoses_dict_path2,
procedures_dict_path1, procedures_dict_path2,
age_group_step, co_morbidity_group_step):
self.input_path = input_path
self.output_path = output_path
self.file = self.read_json(self.input_path)
self.age_group_step = age_group_step
self.co_morbidity_group_step = co_morbidity_group_step
# Dictionaries (diagnoses and procedures) for textual description mapping
self.diagnoses_dict1 = pd.read_csv(diagnoses_dict_path1, dtype = str)
self.icd_codes_diagnoses1 = self.convert_to_str(self.diagnoses_dict1['icd9_code'.upper()].tolist())
self.long_title_diagnoses1 = self.diagnoses_dict1['long_title'.upper()].tolist()
self.diagnoses_dict2 = self.read_json(diagnoses_dict_path2)
self.icd_codes_diagnoses2, self.long_title_diagnoses2 = self.get_codes_descr(self.diagnoses_dict2)
self.procedures_dict1 = pd.read_csv(procedures_dict_path1, dtype = str)
self.icd_codes_procedures1 = self.convert_to_str(self.procedures_dict1['icd9_code'.upper()].tolist())
self.long_title_procedures1 = self.procedures_dict1['long_title'.upper()].tolist()
self.procedures_dict2 = self.read_json(procedures_dict_path2)
self.icd_codes_procedures2, self.long_title_procedures2 = self.get_codes_descr(self.procedures_dict2)
def exec_analysis(self):
info = {}
info['total_subjects'] = len(list(self.file.keys()))
info['total_admissions'] = self.get_total_admissions()
info['avg_admissions_per_subject'] = self.get_average_admissions_per_subj()
info['gender_distribution'] = self.get_distribution('gender')
info['age_distribution'] = self.get_distribution('age')
info['age_group_distribution'] = self.get_age_group_distribution(info['age_distribution'])
info['religion_distribution'] = self.get_distribution('religion')
info['race_distribution'] = self.get_distribution('ethnicity')
info['marital_status_distribution'] = self.get_distribution('marital_status')
info['readmissions'] = self.get_distribution('readmission')
info['initial_diagnosis'] = self.get_distribution('diagnosis')
info['cpt_events_section_header'] = self.get_distribution_second_order('cpt_events', 'section_header', 1)
info['cpt_events_subsection_header'] = self.get_distribution_second_order('cpt_events', 'subsection_header', 1)
info['diagnoses_icd9_code'] = self.get_distribution_second_order('diagnoses', 'icd9_code', 1)
info['prescriptions_drug'] = self.get_distribution_second_order('prescriptions', 'drug', 1)
info['procedures_icd9_code'] = self.get_distribution_second_order('procedures', 'icd9_code', 1)
info['employment'] = self.get_distribution_third_order('social_info', 'employment', 'textual_description', 1)
info['household_composition'] = self.get_distribution_third_order('social_info', 'household_composition', 'textual_description', 1)
info['housing'] = self.get_distribution_third_order('social_info', 'housing', 'textual_description', 1)
info['co-morbidity'] = self.get_co_morbidity_group_distribution()
return info
def get_co_morbidity_group_distribution(self):
co_morbidity_groups_distr, ranges = self.get_co_morbidity_groups()
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
n_diagnoses = len(list(set(self.file[k1][k2]['diagnoses']['icd9_code'])))
for i, r in enumerate(ranges):
if n_diagnoses >= r[0] and n_diagnoses <= r[1]:
co_morbidity_groups_distr[list(co_morbidity_groups_distr.keys())[i]] += 1
return self.sort_dict(co_morbidity_groups_distr)
def get_co_morbidity_groups(self):
co_morbidity_groups_distr = {}
ranges = []
for i in range(0, 40, self.co_morbidity_group_step):
co_morbidity_groups_distr[str(i) + '-' + str(i+self.co_morbidity_group_step-1)] = 0
ranges.append((i, i+self.co_morbidity_group_step-1))
return co_morbidity_groups_distr, ranges
def get_age_group_distribution(self, age_distr):
age_groups_distr, ranges = self.get_age_groups()
for k in age_distr.keys():
for i, r in enumerate(ranges):
if int(k) >= r[0] and int(k) <= r[1]:
age_groups_distr[list(age_groups_distr.keys())[i]] += age_distr[k]
return self.sort_dict(age_groups_distr)
def get_age_groups(self):
age_groups_distr = {}
ranges = []
for i in range(0, 85, self.age_group_step):
age_groups_distr[str(i) + '-' + str(i+self.age_group_step-1)] = 0
ranges.append((i, i+self.age_group_step-1))
age_groups_distr['85-88'] = 0
ranges.append((85, 88))
age_groups_distr['89-_'] = 0
ranges.append((89, 400))
return age_groups_distr, ranges
def get_distribution_third_order(self, key1, key2, key3, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if set_ == 0:
for it in self.file[k1][k2][key1][key2][key3]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
try:
for it in list(set(self.file[k1][k2][key1][key2][key3])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
except:
pass
return self.sort_dict(distr)
def get_distribution_second_order(self, key1, key2, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if set_ == 0:
for it in self.file[k1][k2][key1][key2]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
for it in list(set(self.file[k1][k2][key1][key2])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
return self.sort_dict(distr)
def get_distribution(self, key):
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if self.file[k1][k2][key] not in distr.keys():
distr[self.file[k1][k2][key]] = 1
else:
distr[self.file[k1][k2][key]] += 1
return self.sort_dict(distr)
def sort_dict(self, dict_):
sorted_dict = {}
sorted_keys = sorted(dict_, key=dict_.get, reverse=True)
for w in sorted_keys:
sorted_dict[w] = dict_[w]
return sorted_dict
def get_average_admissions_per_subj(self):
n_adm = []
for k in self.file.keys():
n_adm.append(len(list(self.file[k].keys())))
return round(mean(n_adm), 2)
def get_total_admissions(self):
adm_sum = 0
for k in self.file.keys():
adm_sum += len(list(self.file[k].keys()))
return adm_sum
def get_codes_descr(self, dict_):
codes = []
descr = []
for l in dict_:
for d in l:
if d['code'] == None or '-' in d['code'] or d['code'] in codes:
continue
else:
codes.append(d['code'].replace('.', ''))
descr.append(d['descr'].lower())
return codes, descr
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def save_json(self):
info_distr = self.exec_analysis()
with open(self.output_path + 'info_distributions.json', 'w') as outfile:
json.dump(info_distr, outfile)
def save_csv(self):
info_distr = self.exec_analysis()
for k in info_distr.keys():
if k in ['total_subjects', 'total_admissions', 'avg_admissions_per_subject']:
continue
elif k == 'diagnoses_icd9_code':
tmp_text_discr = []
for icd9_code in list(info_distr[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_diagnoses1.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses1[ind])
except:
ind = self.icd_codes_diagnoses2.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses2[ind])
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
elif k == 'procedures_icd9_code':
tmp_text_discr = []
for icd9_code in list(info_distr[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_procedures1.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures1[ind])
except:
ind = self.icd_codes_procedures2.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures2[ind])
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
else:
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values())})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
def convert_to_str(self, l):
l_str = [str(it) for it in l]
return l_str
class DataAnalysisOntMapping:
def __init__(self, input_path, output_path, ethnicity_mapping,
marital_status_mapping, religion_mapping, file={}):
self.input_path = input_path
self.output_path = output_path
if len(file.keys()) == 0:
self.file = self.read_json(self.input_path)
else:
self.file = file
self.ethnicity_mapping = ethnicity_mapping
self.marital_status_mapping = marital_status_mapping
self.religion_mapping = religion_mapping
def exec_analysis(self):
info = {}
info['religion_distribution_mapped_to_ont'] = self.get_distribution('religion')
info['race_distribution_mapped_to_ont'] = self.get_distribution('ethnicity')
info['marital_status_distribution_mapped_to_ont'] = self.get_distribution('marital_status')
return info
def get_distribution(self, key):
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if key == 'religion':
mapping = self.religion_mapping[self.file[k1][k2][key].lower()]
elif key == 'marital_status':
mapping = self.marital_status_mapping[self.file[k1][k2][key].lower()]
elif key == 'ethnicity':
mapping = self.ethnicity_mapping[self.file[k1][k2][key].lower()]
if mapping not in distr.keys():
distr[mapping] = 1
else:
distr[mapping] += 1
return self.sort_dict(distr)
def sort_dict(self, dict_):
sorted_dict = {}
sorted_keys = sorted(dict_, key=dict_.get, reverse=True)
for w in sorted_keys:
sorted_dict[w] = dict_[w]
return sorted_dict
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def save_json(self):
info_distr = self.exec_analysis()
with open(self.output_path + 'info_distributions_mapped_to_ont.json', 'w') as outfile:
json.dump(info_distr, outfile)
def save_csv(self):
info_distr = self.exec_analysis()
for k in info_distr.keys():
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values())})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
def convert_to_str(self, l):
l_str = [str(it) for it in l]
return l_str
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", default='data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json', type=str, required=False,
help = "The path of the final json file with the data.")
parser.add_argument("--output_path", default='data/distributions/readmission_case/overall/grouped_icd9/', type=str, required=False,
help = "The output path where distributions are going to be stored.")
parser.add_argument("--diagnoses_dictionary_path", default='data/dictionaries/D_ICD_DIAGNOSES_updated.csv', type=str, required=False,
help = "The path of the diagnoses dictionary.")
parser.add_argument("--procedures_dictionary_path", default='data/dictionaries/D_ICD_PROCEDURES.csv', type=str, required=False,
help = "The path of the procedure dictionary.")
parser.add_argument("--diagnoses_manual_dict_path", default='data/dictionaries/codes_diag_updated.json', type=str, required=False,
help = "The path of the diagnoses manual dictionary.")
parser.add_argument("--procedures_manual_dict_path", default='data/dictionaries/codes_proc_updated.json', type=str, required=False,
help = "The path of the procedure manual dictionary.")
parser.add_argument("--ethnicity_mapping_path", default='data/ethnicity_mappings.json', type=str, required=False,
help = "The path of the ethnicity mapping file.")
parser.add_argument("--marital_status_mapping_path", default='data/marital_status_mappings.json', type=str, required=False,
help = "The path of the marital status mapping file.")
parser.add_argument("--religion_mapping_path", default='data/religion_mappings.json', type=str, required=False,
help = "The path of the relation mapping file.")
args = parser.parse_args()
if not os.path.exists(args.output_path):
os.makedirs(args.output_path)
obj_analysis = DataAnalysis(args.data_path,
args.output_path,
args.diagnoses_dictionary_path,
args.diagnoses_manual_dict_path,
args.procedures_dictionary_path,
args.procedures_manual_dict_path,
5, 2)
info = obj_analysis.exec_analysis()
obj_analysis.save_json()
obj_analysis.save_csv()
ethnicity_mapping = read_json(args.ethnicity_mapping_path)
marital_status_mapping = read_json(args.marital_status_mapping_path)
religion_mapping = read_json(args.religion_mapping_path)
obj_analysis_ont = DataAnalysisOntMapping(args.data_path,
args.output_path,
ethnicity_mapping,
marital_status_mapping,
religion_mapping)
obj_analysis_ont.save_json()
obj_analysis_ont.save_csv()
| 17,191 | 43.53886 | 144 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/6_2_data_analysis_per_group.py | import json
from statistics import mean
from datetime import date
import numpy as np
import pandas as pd
import argparse
import os
from utils_ import read_json, DataAnalysisOntMapping
class DataAnalysis:
def __init__(self, input_path, output_path, diagnoses_dict_path1, diagnoses_dict_path2,
procedures_dict_path1, procedures_dict_path2, age_group_step,
co_morbidity_group_step, ethnicity_mapping, marital_status_mapping, religion_mapping):
self.input_path = input_path
self.output_path = output_path
self.file = self.read_json(self.input_path)
self.age_group_step = age_group_step
self.co_morbidity_group_step = co_morbidity_group_step
self.readmission_0, self.readmission_1 = self.divide_data_based_on_readmission_label()
# Mappings
self.ethnicity_mapping = ethnicity_mapping
self.marital_status_mapping = marital_status_mapping
self.religion_mapping = religion_mapping
# Dictionaries (diagnoses and procedures) for textual description mapping
self.diagnoses_dict1 = pd.read_csv(diagnoses_dict_path1, dtype = str)
self.icd_codes_diagnoses1 = self.convert_to_str(self.diagnoses_dict1['icd9_code'.upper()].tolist())
self.long_title_diagnoses1 = self.diagnoses_dict1['long_title'.upper()].tolist()
self.diagnoses_dict2 = self.read_json(diagnoses_dict_path2)
self.icd_codes_diagnoses2, self.long_title_diagnoses2 = self.get_codes_descr(self.diagnoses_dict2)
self.procedures_dict1 = pd.read_csv(procedures_dict_path1, dtype = str)
self.icd_codes_procedures1 = self.convert_to_str(self.procedures_dict1['icd9_code'.upper()].tolist())
self.long_title_procedures1 = self.procedures_dict1['long_title'.upper()].tolist()
self.procedures_dict2 = self.read_json(procedures_dict_path2)
self.icd_codes_procedures2, self.long_title_procedures2 = self.get_codes_descr(self.procedures_dict2)
def divide_data_based_on_readmission_label(self):
readmission_0 = {}
readmission_1 = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if self.file[k1][k2]['readmission'] == '0':
if k1 not in readmission_0.keys():
readmission_0[k1] = {k2: self.file[k1][k2]}
else:
readmission_0[k1][k2] = self.file[k1][k2]
else:
if k1 not in readmission_1.keys():
readmission_1[k1] = {k2: self.file[k1][k2]}
else:
readmission_1[k1][k2] = self.file[k1][k2]
return readmission_0, readmission_1
def exec_analysis(self):
info_0 = self.get_info(self.readmission_0)
self.save_json(info_0, '0')
self.save_csv(info_0, '0')
info_1 = self.get_info(self.readmission_1)
self.save_json(info_1, '1')
self.save_csv(info_1, '1')
# Mapped on ontology
readmission_0_ont = DataAnalysisOntMapping('', self.output_path + '/' + '0' + '/',
self.ethnicity_mapping, self.marital_status_mapping,
self.religion_mapping, self.readmission_0)
readmission_0_ont.save_json()
readmission_0_ont.save_csv()
readmission_1_ont = DataAnalysisOntMapping('', self.output_path + '/' + '1' + '/',
self.ethnicity_mapping, self.marital_status_mapping,
self.religion_mapping, self.readmission_1)
readmission_1_ont.save_json()
readmission_1_ont.save_csv()
def get_info(self, data):
info = {}
info['total_subjects'] = len(list(data.keys()))
info['avg_admissions_per_subject'] = self.get_average_admissions_per_subj(data)
info['gender_distribution'] = self.get_distribution('gender', data)
info['age_distribution'] = self.get_distribution('age', data)
info['age_group_distribution'] = self.get_age_group_distribution(info['age_distribution'])
info['religion_distribution'] = self.get_distribution('religion', data)
info['race_distribution'] = self.get_distribution('ethnicity', data)
info['marital_status_distribution'] = self.get_distribution('marital_status', data)
info['readmissions'] = self.get_distribution('readmission', data)
info['initial_diagnosis'] = self.get_distribution('diagnosis', data)
info['cpt_events_section_header'] = self.get_distribution_second_order(data, 'cpt_events', 'section_header', 1)
info['cpt_events_subsection_header'] = self.get_distribution_second_order(data, 'cpt_events', 'subsection_header', 1)
info['diagnoses_icd9_code'] = self.get_distribution_second_order(data, 'diagnoses', 'icd9_code', 1)
info['prescriptions_drug'] = self.get_distribution_second_order(data, 'prescriptions', 'drug', 1)
info['procedures_icd9_code'] = self.get_distribution_second_order(data, 'procedures', 'icd9_code', 1)
info['employment'] = self.get_distribution_third_order('social_info', 'employment', 'textual_description', 1)
info['household_composition'] = self.get_distribution_third_order('social_info', 'household_composition', 'textual_description', 1)
info['housing'] = self.get_distribution_third_order('social_info', 'housing', 'textual_description', 1)
info['co-morbidity'] = self.get_co_morbidity_group_distribution(data)
return info
def get_co_morbidity_group_distribution(self, data):
co_morbidity_groups_distr, ranges = self.get_co_morbidity_groups()
for k1 in data.keys():
for k2 in data[k1].keys():
n_diagnoses = len(list(set(data[k1][k2]['diagnoses']['icd9_code'])))
for i, r in enumerate(ranges):
if n_diagnoses >= r[0] and n_diagnoses <= r[1]:
co_morbidity_groups_distr[list(co_morbidity_groups_distr.keys())[i]] += 1
return self.sort_dict(co_morbidity_groups_distr)
def get_co_morbidity_groups(self):
co_morbidity_groups_distr = {}
ranges = []
for i in range(0, 40, self.co_morbidity_group_step):
co_morbidity_groups_distr[str(i) + '-' + str(i+self.co_morbidity_group_step-1)] = 0
ranges.append((i, i+self.co_morbidity_group_step-1))
return co_morbidity_groups_distr, ranges
def get_age_group_distribution(self, age_distr):
age_groups_distr, ranges = self.get_age_groups()
for k in age_distr.keys():
for i, r in enumerate(ranges):
if int(k) >= r[0] and int(k) <= r[1]:
age_groups_distr[list(age_groups_distr.keys())[i]] += age_distr[k]
return self.sort_dict(age_groups_distr)
def get_age_groups(self):
age_groups_distr = {}
ranges = []
for i in range(0, 85, self.age_group_step):
age_groups_distr[str(i) + '-' + str(i+self.age_group_step-1)] = 0
ranges.append((i, i+self.age_group_step-1))
age_groups_distr['85-88'] = 0
ranges.append((85, 88))
age_groups_distr['89-_'] = 0
ranges.append((89, 400))
return age_groups_distr, ranges
def get_distribution_third_order(self, key1, key2, key3, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if set_ == 0:
for it in self.file[k1][k2][key1][key2][key3]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
try:
for it in list(set(self.file[k1][k2][key1][key2][key3])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
except:
pass
return self.sort_dict(distr)
def get_distribution_second_order(self, data, key1, key2, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in data.keys():
for k2 in data[k1].keys():
if set_ == 0:
for it in data[k1][k2][key1][key2]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
for it in list(set(data[k1][k2][key1][key2])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
return self.sort_dict(distr)
def get_distribution(self, key, data):
distr = {}
for k1 in data.keys():
for k2 in data[k1].keys():
if data[k1][k2][key] not in distr.keys():
distr[data[k1][k2][key]] = 1
else:
distr[data[k1][k2][key]] += 1
return self.sort_dict(distr)
def get_codes_descr(self, dict_):
codes = []
descr = []
for l in dict_:
for d in l:
if d['code'] == None or '-' in d['code'] or d['code'] in codes:
continue
else:
codes.append(d['code'].replace('.', ''))
descr.append(d['descr'].lower())
return codes, descr
def sort_dict(self, dict_):
sorted_dict = {}
sorted_keys = sorted(dict_, key=dict_.get, reverse=True)
for w in sorted_keys:
sorted_dict[w] = dict_[w]
return sorted_dict
def get_average_admissions_per_subj(self, data):
n_adm = []
for k in data.keys():
n_adm.append(len(list(data[k].keys())))
return round(mean(n_adm), 2)
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def save_json(self, info, group):
with open(self.output_path + group + '/' + 'info_distributions.json', 'w') as outfile:
json.dump(info, outfile)
def save_csv(self, info, group):
for k in info.keys():
if k in ['total_subjects', 'avg_admissions_per_subject']:
continue
elif k == 'diagnoses_icd9_code':
tmp_text_discr = []
for icd9_code in list(info[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_diagnoses1.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses1[ind])
except:
ind = self.icd_codes_diagnoses2.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses2[ind])
df = pd.DataFrame({'Value' : list(info[k].keys()),
'Frequency': list(info[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + '/' + group + '/' + k + '.csv', index=False, encoding="utf-8")
elif k == 'procedures_icd9_code':
tmp_text_discr = []
for icd9_code in list(info[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_procedures1.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures1[ind])
except:
ind = self.icd_codes_procedures2.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures2[ind])
df = pd.DataFrame({'Value' : list(info[k].keys()),
'Frequency': list(info[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + '/' + group + '/' + k + '.csv', index=False, encoding="utf-8")
else:
df = pd.DataFrame({'Value' : list(info[k].keys()),
'Frequency': list(info[k].values())})
df.to_csv(self.output_path + '/' + group + '/' + k + '.csv', index=False, encoding="utf-8")
def convert_to_str(self, l):
l_str = [str(it) for it in l]
return l_str
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", default='data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json', type=str, required=False,
help = "The path of the final json file with the data.")
parser.add_argument("--output_path", default='data/distributions/readmission_case/per_group/grouped_icd9/', type=str, required=False,
help = "The output path where distributions are going to be stored.")
parser.add_argument("--diagnoses_dictionary_path", default='data/dictionaries/D_ICD_DIAGNOSES_updated.csv', type=str, required=False,
help = "The path of the diagnoses dictionary.")
parser.add_argument("--procedures_dictionary_path", default='data/dictionaries/D_ICD_PROCEDURES.csv', type=str, required=False,
help = "The path of the procedure dictionary.")
parser.add_argument("--diagnoses_manual_dict_path", default='data/dictionaries/codes_diag_updated.json', type=str, required=False,
help = "The path of the diagnoses manual dictionary.")
parser.add_argument("--procedures_manual_dict_path", default='data/dictionaries/codes_proc_updated.json', type=str, required=False,
help = "The path of the procedure manual dictionary.")
parser.add_argument("--ethnicity_mapping_path", default='data/ethnicity_mappings.json', type=str, required=False,
help = "The path of the ethnicity mapping file.")
parser.add_argument("--marital_status_mapping_path", default='data/marital_status_mappings.json', type=str, required=False,
help = "The path of the marital status mapping file.")
parser.add_argument("--religion_mapping_path", default='data/religion_mappings.json', type=str, required=False,
help = "The path of the relation mapping file.")
args = parser.parse_args()
if not os.path.exists(args.output_path + '0/'):
os.makedirs(args.output_path+ '0/')
if not os.path.exists(args.output_path + '1/'):
os.makedirs(args.output_path+ '1/')
ethnicity_mapping = read_json(args.ethnicity_mapping_path)
marital_status_mapping = read_json(args.marital_status_mapping_path)
religion_mapping = read_json(args.religion_mapping_path)
obj_analysis = DataAnalysis(args.data_path,
args.output_path,
args.diagnoses_dictionary_path,
args.diagnoses_manual_dict_path,
args.procedures_dictionary_path,
args.procedures_manual_dict_path,
5, 2,
ethnicity_mapping,
marital_status_mapping,
religion_mapping)
obj_analysis.exec_analysis() | 16,376 | 46.607558 | 144 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/6_3_data_analysis_specific_use_case.py | import json
from statistics import mean
from datetime import date
import pandas as pd
import argparse
import os
from utils_ import read_json, InputFile, DataAnalysisOntMapping
class DataAnalysis:
def __init__(self, input_path, output_path,
query_codes, query_code_descriptions,
diagnoses_dict_path1, diagnoses_dict_path2,
procedures_dict_path1, procedures_dict_path2,
age_group_step, co_morbidity_group_step,
ethnicity_mapping, marital_status_mapping, religion_mapping):
self.input_path = input_path
self.output_path = output_path
self.file = InputFile(input_path, query_codes, query_code_descriptions).sampled_file_or_operation
self.age_group_step = age_group_step
self.co_morbidity_group_step = co_morbidity_group_step
# Mappings
self.ethnicity_mapping = ethnicity_mapping
self.marital_status_mapping = marital_status_mapping
self.religion_mapping = religion_mapping
# Dictionaries (diagnoses and procedures) for textual description mapping
self.diagnoses_dict1 = pd.read_csv(diagnoses_dict_path1, dtype = str)
self.icd_codes_diagnoses1 = self.convert_to_str(self.diagnoses_dict1['icd9_code'.upper()].tolist())
self.long_title_diagnoses1 = self.diagnoses_dict1['long_title'.upper()].tolist()
self.diagnoses_dict2 = self.read_json(diagnoses_dict_path2)
self.icd_codes_diagnoses2, self.long_title_diagnoses2 = self.get_codes_descr(self.diagnoses_dict2)
self.procedures_dict1 = pd.read_csv(procedures_dict_path1, dtype = str)
self.icd_codes_procedures1 = self.convert_to_str(self.procedures_dict1['icd9_code'.upper()].tolist())
self.long_title_procedures1 = self.procedures_dict1['long_title'.upper()].tolist()
self.procedures_dict2 = self.read_json(procedures_dict_path2)
self.icd_codes_procedures2, self.long_title_procedures2 = self.get_codes_descr(self.procedures_dict2)
def exec_analysis(self):
info = {}
info['total_subjects'] = len(list(self.file.keys()))
info['total_admissions'] = self.get_total_admissions()
info['avg_admissions_per_subject'] = self.get_average_admissions_per_subj()
info['gender_distribution'] = self.get_distribution('gender')
info['age_distribution'] = self.get_distribution('age')
info['age_group_distribution'] = self.get_age_group_distribution(info['age_distribution'])
info['religion_distribution'] = self.get_distribution('religion')
info['race_distribution'] = self.get_distribution('ethnicity')
info['marital_status_distribution'] = self.get_distribution('marital_status')
info['readmissions'] = self.get_distribution('readmission')
info['initial_diagnosis'] = self.get_distribution('diagnosis')
info['cpt_events_section_header'] = self.get_distribution_second_order('cpt_events', 'section_header', 1)
info['cpt_events_subsection_header'] = self.get_distribution_second_order('cpt_events', 'subsection_header', 1)
info['diagnoses_icd9_code'] = self.get_distribution_second_order('diagnoses', 'icd9_code', 1)
info['prescriptions_drug'] = self.get_distribution_second_order('prescriptions', 'drug', 1)
info['procedures_icd9_code'] = self.get_distribution_second_order('procedures', 'icd9_code', 1)
info['employment'] = self.get_distribution_third_order('social_info', 'employment', 'textual_description', 1)
info['household_composition'] = self.get_distribution_third_order('social_info', 'household_composition', 'textual_description', 1)
info['housing'] = self.get_distribution_third_order('social_info', 'housing', 'textual_description', 1)
info['co-morbidity'] = self.get_co_morbidity_group_distribution()
# Mapped on ontology
mapped_distr_ont = DataAnalysisOntMapping('', self.output_path, self.ethnicity_mapping,
self.marital_status_mapping,
self.religion_mapping, self.file)
mapped_distr_ont.save_json()
mapped_distr_ont.save_csv()
return info
def get_co_morbidity_group_distribution(self):
co_morbidity_groups_distr, ranges = self.get_co_morbidity_groups()
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
n_diagnoses = len(list(set(self.file[k1][k2]['diagnoses']['icd9_code'])))
for i, r in enumerate(ranges):
if n_diagnoses >= r[0] and n_diagnoses <= r[1]:
co_morbidity_groups_distr[list(co_morbidity_groups_distr.keys())[i]] += 1
return self.sort_dict(co_morbidity_groups_distr)
def get_co_morbidity_groups(self):
co_morbidity_groups_distr = {}
ranges = []
for i in range(0, 40, self.co_morbidity_group_step):
co_morbidity_groups_distr[str(i) + '-' + str(i+self.co_morbidity_group_step-1)] = 0
ranges.append((i, i+self.co_morbidity_group_step-1))
return co_morbidity_groups_distr, ranges
def get_age_group_distribution(self, age_distr):
age_groups_distr, ranges = self.get_age_groups()
for k in age_distr.keys():
for i, r in enumerate(ranges):
if int(k) >= r[0] and int(k) <= r[1]:
age_groups_distr[list(age_groups_distr.keys())[i]] += age_distr[k]
return self.sort_dict(age_groups_distr)
def get_age_groups(self):
age_groups_distr = {}
ranges = []
for i in range(0, 85, self.age_group_step):
age_groups_distr[str(i) + '-' + str(i+self.age_group_step-1)] = 0
ranges.append((i, i+self.age_group_step-1))
age_groups_distr['85-88'] = 0
ranges.append((85, 88))
age_groups_distr['89-_'] = 0
ranges.append((89, 400))
return age_groups_distr, ranges
def get_distribution_third_order(self, key1, key2, key3, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if set_ == 0:
for it in self.file[k1][k2][key1][key2][key3]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
try:
for it in list(set(self.file[k1][k2][key1][key2][key3])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
except:
pass
return self.sort_dict(distr)
def get_distribution_second_order(self, key1, key2, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if set_ == 0:
for it in self.file[k1][k2][key1][key2]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
for it in list(set(self.file[k1][k2][key1][key2])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
return self.sort_dict(distr)
def get_distribution(self, key):
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if self.file[k1][k2][key] not in distr.keys():
distr[self.file[k1][k2][key]] = 1
else:
distr[self.file[k1][k2][key]] += 1
return self.sort_dict(distr)
def sort_dict(self, dict_):
sorted_dict = {}
sorted_keys = sorted(dict_, key=dict_.get, reverse=True)
for w in sorted_keys:
sorted_dict[w] = dict_[w]
return sorted_dict
def get_average_admissions_per_subj(self):
n_adm = []
for k in self.file.keys():
n_adm.append(len(list(self.file[k].keys())))
return round(mean(n_adm), 2)
def get_total_admissions(self):
adm_sum = 0
for k in self.file.keys():
adm_sum += len(list(self.file[k].keys()))
return adm_sum
def get_codes_descr(self, dict_):
codes = []
descr = []
for l in dict_:
for d in l:
if d['code'] == None or '-' in d['code'] or d['code'] in codes:
continue
else:
codes.append(d['code'].replace('.', ''))
descr.append(d['descr'].lower())
return codes, descr
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def save_json(self):
info_distr = self.exec_analysis()
with open(self.output_path + 'info_distributions.json', 'w') as outfile:
json.dump(info_distr, outfile)
def save_csv(self):
info_distr = self.exec_analysis()
for k in info_distr.keys():
if k in ['total_subjects', 'total_admissions', 'avg_admissions_per_subject']:
continue
elif k == 'diagnoses_icd9_code':
tmp_text_discr = []
for icd9_code in list(info_distr[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_diagnoses1.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses1[ind])
except:
ind = self.icd_codes_diagnoses2.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses2[ind])
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
elif k == 'procedures_icd9_code':
tmp_text_discr = []
for icd9_code in list(info_distr[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_procedures1.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures1[ind])
except:
ind = self.icd_codes_procedures2.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures2[ind])
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
else:
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values())})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
def convert_to_str(self, l):
l_str = [str(it) for it in l]
return l_str
class DataAnalysisPerGroup:
def __init__(self, input_path, output_path,
query_codes, query_code_descriptions,
diagnoses_dict_path1, diagnoses_dict_path2,
procedures_dict_path1, procedures_dict_path2,
age_group_step, co_morbidity_group_step,
ethnicity_mapping, marital_status_mapping, religion_mapping):
self.input_path = input_path
self.output_path = output_path
self.file = InputFile(input_path, query_codes, query_code_descriptions).sampled_file_or_operation
self.age_group_step = age_group_step
self.co_morbidity_group_step = co_morbidity_group_step
# Mappings
self.ethnicity_mapping = ethnicity_mapping
self.marital_status_mapping = marital_status_mapping
self.religion_mapping = religion_mapping
self.readmission_0, self.readmission_1 = self.divide_data_based_on_readmission_label()
# Dictionaries (diagnoses and procedures) for textual description mapping
self.diagnoses_dict1 = pd.read_csv(diagnoses_dict_path1, dtype = str)
self.icd_codes_diagnoses1 = self.convert_to_str(self.diagnoses_dict1['icd9_code'.upper()].tolist())
self.long_title_diagnoses1 = self.diagnoses_dict1['long_title'.upper()].tolist()
self.diagnoses_dict2 = self.read_json(diagnoses_dict_path2)
self.icd_codes_diagnoses2, self.long_title_diagnoses2 = self.get_codes_descr(self.diagnoses_dict2)
self.procedures_dict1 = pd.read_csv(procedures_dict_path1, dtype = str)
self.icd_codes_procedures1 = self.convert_to_str(self.procedures_dict1['icd9_code'.upper()].tolist())
self.long_title_procedures1 = self.procedures_dict1['long_title'.upper()].tolist()
self.procedures_dict2 = self.read_json(procedures_dict_path2)
self.icd_codes_procedures2, self.long_title_procedures2 = self.get_codes_descr(self.procedures_dict2)
def divide_data_based_on_readmission_label(self):
readmission_0 = {}
readmission_1 = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if self.file[k1][k2]['readmission'] == '0':
if k1 not in readmission_0.keys():
readmission_0[k1] = {k2: self.file[k1][k2]}
else:
readmission_0[k1][k2] = self.file[k1][k2]
else:
if k1 not in readmission_1.keys():
readmission_1[k1] = {k2: self.file[k1][k2]}
else:
readmission_1[k1][k2] = self.file[k1][k2]
return readmission_0, readmission_1
def exec_analysis(self):
info_0 = self.get_info(self.readmission_0)
self.save_json(info_0, '0')
self.save_csv(info_0, '0')
info_1 = self.get_info(self.readmission_1)
self.save_json(info_1, '1')
self.save_csv(info_1, '1')
# Mapped on ontology
readmission_0_ont = DataAnalysisOntMapping('', self.output_path + '0' + '/',
self.ethnicity_mapping, self.marital_status_mapping,
self.religion_mapping, self.readmission_0)
readmission_0_ont.save_json()
readmission_0_ont.save_csv()
readmission_1_ont = DataAnalysisOntMapping('', self.output_path + '1' + '/',
self.ethnicity_mapping, self.marital_status_mapping,
self.religion_mapping, self.readmission_1)
readmission_1_ont.save_json()
readmission_1_ont.save_csv()
def get_info(self, data):
info = {}
info['total_subjects'] = len(list(data.keys()))
info['avg_admissions_per_subject'] = self.get_average_admissions_per_subj(data)
info['gender_distribution'] = self.get_distribution('gender', data)
info['age_distribution'] = self.get_distribution('age', data)
info['age_group_distribution'] = self.get_age_group_distribution(info['age_distribution'])
info['religion_distribution'] = self.get_distribution('religion', data)
info['race_distribution'] = self.get_distribution('ethnicity', data)
info['marital_status_distribution'] = self.get_distribution('marital_status', data)
info['readmissions'] = self.get_distribution('readmission', data)
info['initial_diagnosis'] = self.get_distribution('diagnosis', data)
info['cpt_events_section_header'] = self.get_distribution_second_order(data, 'cpt_events', 'section_header', 1)
info['cpt_events_subsection_header'] = self.get_distribution_second_order(data, 'cpt_events', 'subsection_header', 1)
info['diagnoses_icd9_code'] = self.get_distribution_second_order(data, 'diagnoses', 'icd9_code', 1)
info['prescriptions_drug'] = self.get_distribution_second_order(data, 'prescriptions', 'drug', 1)
info['procedures_icd9_code'] = self.get_distribution_second_order(data, 'procedures', 'icd9_code', 1)
info['employment'] = self.get_distribution_third_order('social_info', 'employment', 'textual_description', 1)
info['household_composition'] = self.get_distribution_third_order('social_info', 'household_composition', 'textual_description', 1)
info['housing'] = self.get_distribution_third_order('social_info', 'housing', 'textual_description', 1)
info['co-morbidity'] = self.get_co_morbidity_group_distribution(data)
return info
def get_co_morbidity_group_distribution(self, data):
co_morbidity_groups_distr, ranges = self.get_co_morbidity_groups()
for k1 in data.keys():
for k2 in data[k1].keys():
n_diagnoses = len(list(set(data[k1][k2]['diagnoses']['icd9_code'])))
for i, r in enumerate(ranges):
if n_diagnoses >= r[0] and n_diagnoses <= r[1]:
co_morbidity_groups_distr[list(co_morbidity_groups_distr.keys())[i]] += 1
return self.sort_dict(co_morbidity_groups_distr)
def get_co_morbidity_groups(self):
co_morbidity_groups_distr = {}
ranges = []
for i in range(0, 40, self.co_morbidity_group_step):
co_morbidity_groups_distr[str(i) + '-' + str(i+self.co_morbidity_group_step-1)] = 0
ranges.append((i, i+self.co_morbidity_group_step-1))
return co_morbidity_groups_distr, ranges
def get_age_group_distribution(self, age_distr):
age_groups_distr, ranges = self.get_age_groups()
for k in age_distr.keys():
for i, r in enumerate(ranges):
if int(k) >= r[0] and int(k) <= r[1]:
age_groups_distr[list(age_groups_distr.keys())[i]] += age_distr[k]
return self.sort_dict(age_groups_distr)
def get_age_groups(self):
age_groups_distr = {}
ranges = []
for i in range(0, 85, self.age_group_step):
age_groups_distr[str(i) + '-' + str(i+self.age_group_step-1)] = 0
ranges.append((i, i+self.age_group_step-1))
age_groups_distr['85-88'] = 0
ranges.append((85, 88))
age_groups_distr['89-_'] = 0
ranges.append((89, 400))
return age_groups_distr, ranges
def get_distribution_third_order(self, key1, key2, key3, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if set_ == 0:
for it in self.file[k1][k2][key1][key2][key3]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
try:
for it in list(set(self.file[k1][k2][key1][key2][key3])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
except:
pass
return self.sort_dict(distr)
def get_distribution_second_order(self, data, key1, key2, set_=0):
"""
@param set_: boolean (0 or 1), defines if we need to take the set of the list (unique values) or not.
e.g.: the prescription list has many duplicates (medication received more than once).
"""
distr = {}
for k1 in data.keys():
for k2 in data[k1].keys():
if set_ == 0:
for it in data[k1][k2][key1][key2]:
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
else:
for it in list(set(data[k1][k2][key1][key2])):
if it not in distr.keys():
distr[it] = 1
else:
distr[it] += 1
return self.sort_dict(distr)
def get_distribution(self, key, data):
distr = {}
for k1 in data.keys():
for k2 in data[k1].keys():
if data[k1][k2][key] not in distr.keys():
distr[data[k1][k2][key]] = 1
else:
distr[data[k1][k2][key]] += 1
return self.sort_dict(distr)
def get_codes_descr(self, dict_):
codes = []
descr = []
for l in dict_:
for d in l:
if d['code'] == None or '-' in d['code'] or d['code'] in codes:
continue
else:
codes.append(d['code'].replace('.', ''))
descr.append(d['descr'].lower())
return codes, descr
def sort_dict(self, dict_):
sorted_dict = {}
sorted_keys = sorted(dict_, key=dict_.get, reverse=True)
for w in sorted_keys:
sorted_dict[w] = dict_[w]
return sorted_dict
def get_average_admissions_per_subj(self, data):
n_adm = []
for k in data.keys():
n_adm.append(len(list(data[k].keys())))
return round(mean(n_adm), 2)
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def save_json(self, info, group):
with open(self.output_path + group + '/' + 'info_distributions.json', 'w') as outfile:
json.dump(info, outfile)
def save_csv(self, info, group):
for k in info.keys():
if k in ['total_subjects', 'avg_admissions_per_subject']:
continue
elif k == 'diagnoses_icd9_code':
tmp_text_discr = []
for icd9_code in list(info[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_diagnoses1.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses1[ind])
except:
ind = self.icd_codes_diagnoses2.index(icd9_code)
tmp_text_discr.append(self.long_title_diagnoses2[ind])
df = pd.DataFrame({'Value' : list(info[k].keys()),
'Frequency': list(info[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + '/' + group + '/' + k + '.csv', index=False, encoding="utf-8")
elif k == 'procedures_icd9_code':
tmp_text_discr = []
for icd9_code in list(info[k].keys()):
if icd9_code == '':
tmp_text_discr.append('')
else:
try:
ind = self.icd_codes_procedures1.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures1[ind])
except:
ind = self.icd_codes_procedures2.index(icd9_code)
tmp_text_discr.append(self.long_title_procedures2[ind])
df = pd.DataFrame({'Value' : list(info[k].keys()),
'Frequency': list(info[k].values()),
'Textual description': tmp_text_discr})
df.to_csv(self.output_path + '/' + group + '/' + k + '.csv', index=False, encoding="utf-8")
else:
df = pd.DataFrame({'Value' : list(info[k].keys()),
'Frequency': list(info[k].values())})
df.to_csv(self.output_path + '/' + group + '/' + k + '.csv', index=False, encoding="utf-8")
def convert_to_str(self, l):
l_str = [str(it) for it in l]
return l_str
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", default='data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json', type=str, required=False,
help = "The path of the final json file with the data.")
parser.add_argument("--output_path_1", default='data/distributions/overall/use_case_heart_failure_cardiac_dysrhythmias/', type=str, required=False,
help = "The output path where the overall distributions are going to be stored.")
parser.add_argument("--output_path_2", default='data/distributions/per_group/use_case_heart_failure_cardiac_dysrhythmias/', type=str, required=False,
help = "The output path where the distributions per group (readmission & no readmission cases) are going to be stored.")
parser.add_argument("--diagnoses_dictionary_path", default='data/dictionaries/D_ICD_DIAGNOSES_updated.csv', type=str, required=False,
help = "The path of the diagnoses dictionary.")
parser.add_argument("--procedures_dictionary_path", default='data/dictionaries/D_ICD_PROCEDURES.csv', type=str, required=False,
help = "The path of the procedure dictionary.")
parser.add_argument("--diagnoses_manual_dict_path", default='data/dictionaries/codes_diag_updated.json', type=str, required=False,
help = "The path of the diagnoses manual dictionary.")
parser.add_argument("--procedures_manual_dict_path", default='data/dictionaries/codes_proc_updated.json', type=str, required=False,
help = "The path of the procedure manual dictionary.")
parser.add_argument("--ethnicity_mapping_path", default='data/ethnicity_mappings.json', type=str, required=False,
help = "The path of the ethnicity mapping file.")
parser.add_argument("--marital_status_mapping_path", default='data/marital_status_mappings.json', type=str, required=False,
help = "The path of the marital status mapping file.")
parser.add_argument("--religion_mapping_path", default='data/religion_mappings.json', type=str, required=False,
help = "The path of the relation mapping file.")
parser.add_argument("--query_codes", nargs="+", default=['428', '427'], required=False,
help = "The list of codes (ICD9) that are used to create the use case.")
parser.add_argument("--query_code_descriptions", nargs="+", action='append', required=False,
help = "The list of the description (keys) of the codes (ICD9) that are used to create the use case. It is used to properly parse the json file.")
args = parser.parse_args()
if not os.path.exists(args.output_path_1):
os.makedirs(args.output_path_1)
if not os.path.exists(args.output_path_2 + '0/'):
os.makedirs(args.output_path_2 + '0/')
if not os.path.exists(args.output_path_2 + '1/'):
os.makedirs(args.output_path_2 + '1/')
ethnicity_mapping = read_json(args.ethnicity_mapping_path)
marital_status_mapping = read_json(args.marital_status_mapping_path)
religion_mapping = read_json(args.religion_mapping_path)
obj_analysis = DataAnalysis(args.data_path,
args.output_path_1,
args.query_codes,
args.query_code_descriptions,
args.diagnoses_dictionary_path,
args.diagnoses_manual_dict_path,
args.procedures_dictionary_path,
args.procedures_manual_dict_path,
5, 2,
ethnicity_mapping,
marital_status_mapping,
religion_mapping)
obj_analysis.save_json()
obj_analysis.save_csv()
obj_analysis_per_group = DataAnalysisPerGroup(args.data_path,
args.output_path_2,
args.query_codes,
args.query_code_descriptions,
args.diagnoses_dictionary_path,
args.diagnoses_manual_dict_path,
args.procedures_dictionary_path,
args.procedures_manual_dict_path,
5, 2,
ethnicity_mapping,
marital_status_mapping,
religion_mapping)
obj_analysis_per_group.exec_analysis() | 30,534 | 47.086614 | 170 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/README.md | # Person-Centric Knowledge Graph Extraction using MIMIC-III dataset: An ICU-readmission prediction study
## EHR Data Preprocessing
## Setup
### Requirements
- Python 3.7+
- numpy (tested with version 1.23.1)
- pandas (tested with version 1.4.2)
- <a target="_blank" href="https://github.com/AnthonyMRios/pymetamap">pymetamap</a>
### Execution Steps
- Download the <a target="_blank" href="https://physionet.org/content/mimiciii/1.4/">MIMIC-III</a> dataset \[1\] and store the .csv files under the ```data/initial_data/``` folder. Move the dictionary files under the ```data/dictionaries/``` folder.
- Run the ```1_data_selection.py``` script to clean and select the data.
- Run the ```2_1_data_wrangling.py``` and ```2_2_data_wrangling_grouped_icd9.py``` scripts to extract a unified json information with the information that is needed for the next steps. In the second version (```2_2_data_wrangling_grouped_icd9.py```), the ICD9 codes of the diseases/diagnoses and procedures are grouped.
- Run the ```3_1_data_mapping_dictionaries.py``` and ```3_2_data_mapping_dictionaries_grouped_icd9.py``` scripts (order should be respected) to extract map the ICD9 codes, using dictionaries, and extract the corresponding textual description.
- Run the ```4_data_sampling.py [--threshold]``` script to sample the patient records that are valid for our task. The threshold argument defines the the day span for monitoring if the patient is going to be readmitted to the ICU or no (e.g. python 4_data_sampling.py --threshold 30).
- Extract the UMLS codes from notes using the following steps:
- Install <a target="_blank" href="https://lhncbc.nlm.nih.gov/ii/tools/MetaMap/run-locally/MetaMapLite.html"> MetaMap Lite </a> \[2\] (and <a target="_blank" href="https://lhncbc.nlm.nih.gov/ii/tools/MetaMap/documentation/Installation.html"> MetaMap </a> \[3\] optionally) locally. We recommend to store everything under the <i> notes_cui_extraction/MetaMap </i> folder.
- Run the ```notes_cui_extraction/find_remaining_files_create_note_buckets.py --umls_codes_path [--bucket_size]``` script to find the notes that have not been processed yet and create buckets with them. We divide the notes into buckets for smoother processing in the next steps. Arguments:
- umls_codes_path: The path where the extracted UMLS codes are stored.
- bucket_size (optional): The size of each bucket of notes.
- Move the ```notes_cui_extraction/MetaMap/extract_umls_codes.py --bucket_path --bucket_id --metamap_path --output_path [--divide_and_merge]``` script under the base directory of MetaMap lite installment (e.g. (<i> notes_cui_extraction/MetaMap/public_mm_lite_3.6.2rc8 </i>).
- Run the ```notes_cui_extraction/MetaMap/extract_umls_codes.py --bucket_path --bucket_id --metamap_path --output_path [--divide_and_merge]``` script to extract the UMLS codes of the notes. Arguments:
- bucket_path: The relative path of the note buckets that were created by ```notes_cui_extraction/find_remaining_files_create_note_buckets.py --umls_codes_path [--bucket_size]``` script.
- bucket_id: The bucket id/number to indicate the one that is going to be processed.
- metamap_path: The full path of metamap base directory.
- output_path: The path where the extracted umls codes are stored (e.g. <i> ../../data/processed_data/umls_codes_notes/ </i>).
- divide_and_merge (optional): This is a flag to define if the notes are going to be divided into subnotes and then processed by metamap. The final UMLS sublists are merged. (Values: 0 or 1)
- When the UMLS code extraction has been completed for all the notes, then run the ```notes_cui_extraction/map_extracted_umls_files.py --umls_codes_path --output_path``` to map the extracted umls files to the task-valid (readmission prediction) files. Arguments:
- umls_codes_path: The path where the extracted umls codes are stored (e.g. <i> ../data/processed_data/umls_codes_notes/ </i>).
- output_path: The path where the <b>mapped</b> extracted umls codes are going to be stored (e.g. <i> ../data/processed_data/umls_codes_notes_task_valid/ </i>).
- Run the ```5_notes_info_integration.py --grouped_ICD9 --umls_codes_path --employment_mapping_path --household_mapping_path --housing_mapping_path``` script to integrate the social info, related to employment, household and housing conditions, that exists in the extracted umls codes. The three mappings (employment, household and housing) should be provided by the user in csv files with two columns, one with the name <i>CUI</i> that contains the umls codes, and one with the name <i>Description</i> that shows the corresponding textual description of each code. The mapping can be created manually and/or using the ontology. Examples of mappings can be found under the <i>data</i> folder. Arguments:
- grouped_ICD9: Flag to define the input data (grouped ICD9 version or non-grouped ICD9 version).
- umls_codes_path: The path where the <b>mapped</b> extracted umls codes are stored (e.g. <i>../data/processed_data/umls_codes_notes/</i>)
- employment_mapping_path: The path of the employment mapping csv file.
- household_mapping_path: The path of the household mapping csv file.
- housing_mapping_path: The path of the housing mapping csv file.
- Run the ```6_1_data_analysis_overall.py --data_path --output_path --diagnoses_dictionary_path --procedures_dictionary_path --procedures_dictionary_path --procedures_manual_dict_path --ethnicity_mapping_path --marital_status_mapping_path --religion_mapping_path``` script to extract the overall distributions of the data. The ontology-based mappings for the ethnicity, marital status and religion should be provided by the user. Example of mappings can be found under the <i>data</i> folder. Finally, the following distributions are extracted:
- Distributions:
- age
- age group
- co-morbidity
- CPT events
- diagnoses
- employment status
- gender
- household composition
- housing conditions
- marital status
- prescriptions
- procedures
- race/ethnicity
- readmissions
- Arguments:
- data_path: The path of the final json file with the data (e.g. <i>4_data_after_adding_notes_info_grouped_icd9.json</i>).
- output_path: The output path where distributions are going to be stored.
- diagnoses_dictionary_path: The path of the dignoses dictionary (<i>D_ICD_DIAGNOSES_updated.csv</i>).
- procedures_dictionary_path: The path of the procedure dictionary (<i>D_ICD_PROCEDURES.csv</i>).
- diagnoses_manual_dict_path: The path of the diagnoses manual dictionary (<i>codes_diag_updated.json</i>).
- procedures_manual_dict_path: The path of the procedure manual dictionary (<i>codes_proc_updated.json</i>).
- ethnicity_mapping_path: The path of the ethnicity mapping file.
- marital_status_mapping_path: The path of the marital_status mapping file.
- religion_mapping_path: The path of the religion mapping file.
- Run the ```6_2_data_analysis_per_group.py --data_path --output_path --diagnoses_dictionary_path --procedures_dictionary_path --procedures_dictionary_path --procedures_manual_dict_path --ethnicity_mapping_path --marital_status_mapping_path --religion_mapping_path``` script to extract the distributions of the data per group (readmission and no readmission cases).
- Run the ```6_3_data_analysis_specific_use_case.py --data_path --output_path --diagnoses_dictionary_path --procedures_dictionary_path --procedures_dictionary_path --procedures_manual_dict_path --ethnicity_mapping_path --marital_status_mapping_path --religion_mapping_path``` script to extract the distributions of a specific use case. For example, if only the patients that have heart failure (ICD9 code: 428) or cardiac_dysrhythmias (ICD9 code: 427) should be included, then the following command should be executed: ```6_3_data_analysis_specific_use_case.py --query_codes '428' '427' --query_code_descriptions 'diagnoses' 'icd9_code' --query_code_descriptions 'diagnoses' 'icd9_code'``` Additional arguments:
- output_path_1: The output path where the overall distributions are going to be stored.
- output_path_2: The output path where the distributions per group (readmission & no readmission cases) are going to be stored.
- query_codes: The list of codes (ICD9) that are used to create the use case.
- query_code_descriptions: The list of the description (keys) of the codes (ICD9) that are used to create the use case. It is used to properly parse the json file.
- Run the ```extract_explore_use_cases.py --data_path --query_codes --query_code_descriptions``` script to extract a use case and explore how many positive and negative readmission cases exist.
### Notes
- The MIMIC dictionaries for mappings (ICD9 codes --> description) were not complete. So, we manually created complete mappings (files: ```codes_diag_updated.json```, ```codes_proc_updated.json``` under the <i>data/dictionaries/</i> folder).
- The implementation can be adapted easily other predictive tasks (e.g. mortality prediction) with an appropriate implementation/modification of the ```4_data_sampling.py``` script.
- If the ```notes_cui_extraction/MetaMap/extract_umls_codes.py --bucket_path --bucket_id --metamap_path --output_path [--divide_and_merge]``` script has not been completed for all the buckets that were extracted, then the ```notes_cui_extraction/find_remaining_files_create_note_buckets.py --umls_codes_path [--bucket_size]``` script should be executed again to find the remaining non-processed notes and create the new buckets.
## References
```
[1] Johnson, A., Pollard, T., & Mark, R. (2016). MIMIC-III Clinical Database (version 1.4). PhysioNet. https://doi.org/10.13026/C2XW26
[2] Demner-Fushman, Dina, Willie J. Rogers, and Alan R. Aronson. "MetaMap Lite: an evaluation of a new Java implementation of MetaMap." Journal of the American Medical Informatics Association 24.4 (2017): 841-844.
[3] Aronson, Alan R. "Effective mapping of biomedical text to the UMLS Metathesaurus: the MetaMap program." Proceedings of the AMIA Symposium. American Medical Informatics Association, 2001.
``` | 10,296 | 121.583333 | 711 | md |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/extract_explore_use_cases.py | import argparse
from utils_ import InputFile
def count_0_1_labels(file):
count_0 = 0
count_1 = 0
for k1 in file.keys():
for k2 in file[k1].keys():
if file[k1][k2]['readmission'] == '1':
count_1 += 1
else:
count_0 += 1
print('Label 0: {}' .format(count_0))
print('Label 1: {}' .format(count_1))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", default='data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json', type=str, required=False,
help = "The path of the final json file with the data.")
parser.add_argument("--query_codes", nargs="+", default=['428', '427'], required=False,
help = "The list of codes (ICD9) that are used to create the use case.")
parser.add_argument("--query_code_descriptions", nargs="+", action='append', required=False,
help = "The list of the description (keys) of the codes (ICD9) that are used to create the use case. It is used to properly parse the json file.")
args = parser.parse_args()
use_case = InputFile(args.data_path,
args.query_codes,
args.query_code_descriptions)
count_0_1_labels(use_case.sampled_file_or_operation) | 1,368 | 40.484848 | 170 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/utils_.py | import pandas as pd
import json
import os
def read_csv(path):
return pd.read_csv(path, dtype = str)
def read_json(path):
with open(path) as json_file:
return json.load(json_file)
def save_json(file, path):
with open(path, 'w') as outfile:
json.dump(file, outfile)
def convert_to_str(l):
l_str = [str(it) for it in l]
return l_str
def find_json_files(folder_path):
files = []
for file in os.listdir(folder_path):
if file.endswith(".json"):
files.append(os.path.join(folder_path, file))
return files
class DataAnalysisOntMapping:
def __init__(self, input_path, output_path, ethnicity_mapping,
marital_status_mapping, religion_mapping, file={}):
self.input_path = input_path
self.output_path = output_path
if len(file.keys()) == 0:
self.file = self.read_json(self.input_path)
else:
self.file = file
self.ethnicity_mapping = ethnicity_mapping
self.marital_status_mapping = marital_status_mapping
self.religion_mapping = religion_mapping
def exec_analysis(self):
info = {}
info['religion_distribution_mapped_to_ont'] = self.get_distribution('religion')
info['race_distribution_mapped_to_ont'] = self.get_distribution('ethnicity')
info['marital_status_distribution_mapped_to_ont'] = self.get_distribution('marital_status')
return info
def get_distribution(self, key):
distr = {}
for k1 in self.file.keys():
for k2 in self.file[k1].keys():
if key == 'religion':
mapping = self.religion_mapping[self.file[k1][k2][key].lower()]
elif key == 'marital_status':
mapping = self.marital_status_mapping[self.file[k1][k2][key].lower()]
elif key == 'ethnicity':
mapping = self.ethnicity_mapping[self.file[k1][k2][key].lower()]
if mapping not in distr.keys():
distr[mapping] = 1
else:
distr[mapping] += 1
return self.sort_dict(distr)
def sort_dict(self, dict_):
sorted_dict = {}
sorted_keys = sorted(dict_, key=dict_.get, reverse=True)
for w in sorted_keys:
sorted_dict[w] = dict_[w]
return sorted_dict
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def save_json(self):
info_distr = self.exec_analysis()
with open(self.output_path + 'info_distributions_mapped_to_ont.json', 'w') as outfile:
json.dump(info_distr, outfile)
def save_csv(self):
info_distr = self.exec_analysis()
for k in info_distr.keys():
df = pd.DataFrame({'Value' : list(info_distr[k].keys()),
'Frequency': list(info_distr[k].values())})
df.to_csv(self.output_path + k + '.csv', index=False, encoding="utf-8")
def convert_to_str(self, l):
l_str = [str(it) for it in l]
return l_str
class InputFile:
def __init__(self, input_path, query_codes, query_code_descriptions):
self.init_file = self.read_json(input_path)
self.query_codes = query_codes
self.query_code_descriptions = query_code_descriptions
self.sampled_file_and_operation = self.get_sampled_file_and_operation()
self.sampled_file_or_operation = self.get_sampled_file_or_operation()
def read_json(self, path):
with open(path) as json_file:
return json.load(json_file)
def get_sampled_file_and_operation(self):
sampled_dict = {}
for k1 in self.init_file.keys():
for k2 in self.init_file[k1].keys():
flag = 0
# Check if all the query codes exist in the record.
for i, q_c in enumerate(self.query_codes):
q_c_descr = self.query_code_descriptions[i]
if len(q_c_descr) == 1:
if not(q_c in self.init_file[k1][k2][q_c_descr[0]]):
flag = 1
elif len(q_c_descr) == 2:
if not(q_c in self.init_file[k1][k2][q_c_descr[0]][q_c_descr[1]]):
flag = 1
if flag == 0:
if k1 not in sampled_dict.keys():
sampled_dict[k1] = {}
sampled_dict[k1][k2] = self.init_file[k1][k2]
else:
sampled_dict[k1][k2] = self.init_file[k1][k2]
return sampled_dict
def get_sampled_file_or_operation(self):
sampled_dict = {}
for k1 in self.init_file.keys():
for k2 in self.init_file[k1].keys():
flag = 0
# Check if at least one of the query codes exists in the record.
for i, q_c in enumerate(self.query_codes):
q_c_descr = self.query_code_descriptions[i]
if len(q_c_descr) == 1:
if q_c in self.init_file[k1][k2][q_c_descr[0]]:
flag = 1
break
elif len(q_c_descr) == 2:
if q_c in self.init_file[k1][k2][q_c_descr[0]][q_c_descr[1]]:
flag = 1
break
if flag == 1:
if k1 not in sampled_dict.keys():
sampled_dict[k1] = {}
sampled_dict[k1][k2] = self.init_file[k1][k2]
else:
sampled_dict[k1][k2] = self.init_file[k1][k2]
return sampled_dict
class UniqueValues:
def __init__(self, input_path, output_path):
self.input_path = input_path
self.output_path = output_path
self.data = self.read_json()
def exec(self):
return {'marital_status': self.get_unique_values('marital_status'),
'gender': self.get_unique_values('gender'),
'religion': self.get_unique_values('religion'),
'ethnicity': self.get_unique_values('ethnicity'),
'diagnosis_initial': self.get_unique_values('diagnosis'),
'cpt_events_codes': self.get_unique_values_second_order('cpt_events', 'cpt_code'),
'cpt_events_section_header': self.get_unique_values_second_order('cpt_events', 'section_header'),
'cpt_events_subsection_header': self.get_unique_values_second_order('cpt_events', 'subsection_header'),
'diagnoses_icd9_codes': self.get_unique_values_second_order('diagnoses', 'icd9_code'),
'diagnoses_textual_description': self.get_unique_values_second_order('diagnoses', 'textual_description'),
'prescriptions_drug': self.get_unique_values_second_order('prescriptions', 'drug'),
'procedures_icd9_codes': self.get_unique_values_second_order('procedures', 'icd9_code'),
'procedures_textual_description': self.get_unique_values_second_order('procedures', 'textual_description'),
'employment': self.get_unique_values_third_order('social_info', 'employment', 'textual_description'),
'household_composition': self.get_unique_values_third_order('social_info', 'household_composition', 'textual_description'),
'housing': self.get_unique_values_third_order('social_info', 'housing', 'textual_description')}
def get_unique_values_third_order(self, key1, key2, key3):
all_values = []
for k1 in self.data.keys():
for k2 in self.data[k1].keys():
try:
all_values.extend(self.data[k1][k2][key1][key2][key3])
except:
pass
return list(set(all_values))
def get_unique_values_second_order(self, key1, key2):
all_values = []
for k1 in self.data.keys():
for k2 in self.data[k1].keys():
all_values.extend(self.data[k1][k2][key1][key2])
return list(set(all_values))
def get_unique_values(self, key):
all_values = []
for k1 in self.data.keys():
for k2 in self.data[k1].keys():
all_values.append(self.data[k1][k2][key].lower())
return list(set(all_values))
def get_number_of_unique_values(self):
unique_values_dict = self.exec()
for k in unique_values_dict:
print('{}: {}' .format(k, len(unique_values_dict[k])))
def read_json(self):
with open(self.input_path) as json_file:
return json.load(json_file)
def save_json(self):
info_distr = self.exec()
with open(self.output_path, 'w') as outfile:
json.dump(info_distr, outfile) | 8,969 | 37.497854 | 139 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/notes_cui_extraction/find_remaining_files_create_note_buckets.py | import pandas as pd
import argparse
import os
from utils_ import read_csv, save_json, find_json_files, remove_empty_strings
def dataframe_to_dictionary_notes(df):
notes_dict = {}
for _, row in df.iterrows():
if str(row['subject_id']) + '_' + str(int(float(row['hadm_id']))) not in notes_dict.keys():
clean_text = remove_empty_strings(row['text'])
notes_dict[str(row['subject_id']) + '_' + str(int(float(row['hadm_id'])))] = []
notes_dict[str(row['subject_id']) + '_' + str(int(float(row['hadm_id'])))].extend(clean_text)
else:
# If there is a key for this subject_id + admission_id combination then extend the note list.
clean_text = remove_empty_strings(row['text'])
notes_dict[str(row['subject_id']) + '_' + str(int(float(row['hadm_id'])))].extend(clean_text)
return notes_dict
def join_notes(dict_):
notes_dict_joined = {}
for k in dict_.keys():
joined_text_0 = ' '.join(dict_[k])
joined_text_1 = joined_text_0.replace('__', ' ')
joined_text_2 = joined_text_1.replace(' ', '')
joined_text_3 = joined_text_2.replace(' ', '')
joined_text_4 = joined_text_3.replace(' ', '')
joined_text_5 = joined_text_4.replace('*', '')
joined_text_6 = joined_text_5.replace('|', '')
notes_dict_joined[k] = joined_text_6
return notes_dict_joined
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--umls_codes_path", default=None, type=str, required=True,
help = "The path where the extracted UMLS codes are stored.")
parser.add_argument("--bucket_size", default=1000, type=int, required=False,
help = "The size of each bucket of notes.")
args = parser.parse_args()
notes = read_csv('../data/selected_data/noteevents.csv')
notes_clear = notes.dropna(subset=['hadm_id'])
notes_dict = dataframe_to_dictionary_notes(notes_clear)
notes_dict_joined = join_notes(notes_dict)
file_names = list(notes_dict.keys())
if not os.path.exists(args.umls_codes_path):
os.makedirs(args.umls_codes_path)
files_done = find_json_files(args.umls_codes_path)
print("Number of processed notes: {}" .format(len(files_done)))
files_to_be_done = []
for f in file_names:
if f not in files_done:
files_to_be_done.append(f)
print("Number of notes to be processed: {}" .format(len(files_to_be_done)))
chunks = []
for i in range(0, len(files_to_be_done), args.bucket_size):
chunks.append({'filenames': files_to_be_done[i:i+args.bucket_size]})
bucket_path = '../data/processed_data/filenames_notes/'
if not os.path.exists(bucket_path):
os.makedirs(bucket_path)
files_done = find_json_files(bucket_path)
for i, l in enumerate(chunks):
save_json(l, bucket_path + 'bucket_' + str(i) + '.json')
for i, c in enumerate(chunks):
tmp_dict_notes = {}
for k in c['filenames']:
tmp_dict_notes[k] = notes_dict_joined[k]
save_json(tmp_dict_notes, bucket_path + 'notes_bucket_' + str(i) + '.json')
| 3,201 | 38.530864 | 105 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/notes_cui_extraction/map_extracted_umls_files.py | import argparse
import os
from utils_ import find_json_files, read_json, save_json
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--umls_codes_path", default=None, type=str, required=True,
help = "The path where the extracted UMLS codes are stored.")
parser.add_argument("--output_path", default=None, type=str, required=True,
help = "The path where the task-valid extracted UMLS files are going to be stored.")
args = parser.parse_args()
extracted_files = find_json_files(args.umls_codes_path)
mapping = read_json('../data/processed_data/key_mapping_from_total_to_task_valid.json')
if not os.path.exists(args.output_path):
os.makedirs(args.output_path)
for ex_f in extracted_files:
ex_f_dict = read_json(args.umls_codes_path + ex_f + '.json')
try:
save_json(ex_f_dict, args.output_path + mapping[ex_f] + '.json')
except:
pass | 1,009 | 36.407407 | 108 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/notes_cui_extraction/utils_.py | import pandas as pd
import os
import json
def read_csv(path):
return pd.read_csv(path)
def read_json(path):
with open(path) as json_file:
return json.load(json_file)
def save_json(file, path):
with open(path, 'w') as outfile:
json.dump(file, outfile)
def find_json_files(folder_path):
files = []
for file in os.listdir(folder_path):
if file.endswith(".json"):
files.append(file.split('.')[0])
return files
def remove_empty_strings(text):
clean_text = []
for r in text.split('\n'):
if r == '':
continue
else:
clean_text.append(r)
return clean_text
| 704 | 19.142857 | 44 | py |
null | hspo-ontology-main/hspo-kg-builder/data-lifting/mimic/notes_cui_extraction/MetaMap/extract_umls_codes.py | import pandas as pd
import pymetamap
import random
import os
from time import sleep
import argparse
import json
def read_csv(path):
return pd.read_csv(path)
def read_json(path):
with open(path) as json_file:
return json.load(json_file)
def save_json(file, path):
with open(path, 'w') as outfile:
json.dump(file, outfile)
def get_keys_from_mm(concept, klist):
conc_dict = concept._asdict()
conc_list = [conc_dict.get(kk) for kk in klist]
return(tuple(conc_list))
class MetaMapConnection:
def __init__(self, lite, metamap_base_dir='', metamap_bin_dir='',
metamap_pos_server_dir='', metamap_wsd_server_dir='',
metamap_lite_base_dir=''):
if lite:
self.metamap_lite_base_dir = metamap_lite_base_dir
self.mm = self.get_metamap_lite_instance()
else:
self.metamap_base_dir = metamap_base_dir
self.metamap_bin_dir = metamap_bin_dir
self.metamap_pos_server_dir = metamap_pos_server_dir
self.metamap_wsd_server_dir = metamap_wsd_server_dir
self.mm = self.get_metamap_instance()
def get_metamap_lite_instance(self):
mm = pymetamap.MetaMapLite.get_instance(self.metamap_lite_base_dir)
return mm
def get_metamap_instance(self):
# Start servers
os.system(self.metamap_base_dir + self.metamap_pos_server_dir + ' start') # Part of speech tagger
os.system(self.metamap_base_dir + self.metamap_wsd_server_dir + ' start') # Word sense disambiguation
# Sleep a bit to give time for these servers to start up
sleep(60)
mm = pymetamap.MetaMap.get_instance(self.metamap_base_dir + self.metamap_bin_dir)
return mm
class ExtractorUMLSOld:
def __init__(self, notes_path, lite, metamap_lite_base_dir, metamap_base_dir, metamap_bin_dir,
metamap_pos_server_dir, metamap_wsd_server_dir, output_data_path, filenames_to_be_done):
# Read the csv with the notes.
self.notes = read_csv(notes_path)
# Drop the rows with unknown admission id (mapping cannot be done).
self.notes_clear = self.notes.dropna(subset=['hadm_id'])
# Transform the dataframe to dictionary with note aggregation
self.notes_dict = self.dataframe_to_dictionary_notes()
# Join the notes
self.notes_dict_joined = self.join_notes()
# Initialize an instance of MetaMap annotator
self.lite = lite
if lite:
self.mm_conn = MetaMapConnection(lite=1,
metamap_lite_base_dir=metamap_lite_base_dir)
else:
self.mm_conn = MetaMapConnection(lite=0,
metamap_base_dir=metamap_base_dir,
metamap_bin_dir=metamap_bin_dir,
metamap_pos_server_dir=metamap_pos_server_dir,
metamap_wsd_server_dir=metamap_wsd_server_dir,
composite_phrase = 1)
self.output_data_path = output_data_path
self.files_to_be_done = read_json(filenames_to_be_done)
def join_notes(self):
notes_dict_joined = {}
for k in self.notes_dict.keys():
joined_text_0 = ' '.join(self.notes_dict[k])
joined_text_1 = joined_text_0.replace('__', ' ')
joined_text_2 = joined_text_1.replace(' ', '')
joined_text_3 = joined_text_2.replace(' ', '')
joined_text_4 = joined_text_3.replace(' ', '')
joined_text_5 = joined_text_4.replace('*', '')
joined_text_6 = joined_text_5.replace('|', '')
notes_dict_joined[k] = joined_text_6
return notes_dict_joined
def dataframe_to_dictionary_notes(self):
notes_dict = {}
for _, row in self.notes_clear.iterrows():
if str(row['subject_id']) + '_' + str(int(float(row['hadm_id']))) not in notes_dict.keys():
clean_text = self.remove_empty_strings(row['text'])
notes_dict[str(row['subject_id']) + '_' + str(int(float(row['hadm_id'])))] = []
notes_dict[str(row['subject_id']) + '_' + str(int(float(row['hadm_id'])))].extend(clean_text)
else:
# If there is a key for this subject_id + admission_id combination then extend the note list.
clean_text = self.remove_empty_strings(row['text'])
notes_dict[str(row['subject_id']) + '_' + str(int(float(row['hadm_id'])))].extend(clean_text)
return notes_dict
def remove_empty_strings(self, text):
clean_text = []
for r in text.split('\n'):
if r == '':
continue
else:
clean_text.append(r)
return clean_text
def get_umls_codes_of_notes(self):
for k in self.notes_dict_joined.keys():
if not(k.split('_')[0] + '_' + k.split('_')[1] in self.files_to_be_done['filenames']):
continue
if self.lite:
cons, _ = self.mm_conn.mm.extract_concepts([self.notes_dict_joined[k]])
else:
cons, _ = self.mm_conn.mm.extract_concepts([self.notes_dict_joined[k]],
word_sense_disambiguation = True,
#restrict_to_sts = ['sosy'], # signs and symptoms
composite_phrase = 1) # for memory issues
keys_of_interest = ['preferred_name', 'cui', 'semtypes', 'pos_info']
cols = [get_keys_from_mm(cc, keys_of_interest) for cc in cons]
results_df = pd.DataFrame(cols, columns = keys_of_interest)
umls_dict = {'umls_codes': results_df['cui'].tolist(),
'textual_description': results_df['preferred_name'].tolist()}
save_json(umls_dict, self.output_data_path + k.split('_')[0] + '_' + k.split('_')[1] + '.json')
class ExtractorUMLS:
def __init__(self, notes_path, lite, metamap_lite_base_dir, metamap_base_dir, metamap_bin_dir,
metamap_pos_server_dir, metamap_wsd_server_dir, output_data_path):
# Read the json with the joined notes.
self.notes = read_json(notes_path)
# Initialize an instance of MetaMap annotator
self.lite = lite
if lite:
self.mm_conn = MetaMapConnection(lite=1,
metamap_lite_base_dir=metamap_lite_base_dir)
else:
self.mm_conn = MetaMapConnection(lite=0,
metamap_base_dir=metamap_base_dir,
metamap_bin_dir=metamap_bin_dir,
metamap_pos_server_dir=metamap_pos_server_dir,
metamap_wsd_server_dir=metamap_wsd_server_dir,
composite_phrase = 1)
self.output_data_path = output_data_path
def remove_empty_strings(self, text):
clean_text = []
for r in text.split('\n'):
if r == '':
continue
else:
clean_text.append(r)
return clean_text
def get_umls_codes_of_notes(self):
k_list = list(self.notes.keys())
random.shuffle(k_list)
for k in k_list:
if self.lite:
cons, _ = self.mm_conn.mm.extract_concepts([self.notes[k]])
else:
cons, _ = self.mm_conn.mm.extract_concepts([self.notes[k]],
word_sense_disambiguation = True,
#restrict_to_sts = ['sosy'], # signs and symptoms
composite_phrase = 1) # for memory issues
keys_of_interest = ['preferred_name', 'cui', 'semtypes', 'pos_info']
cols = [get_keys_from_mm(cc, keys_of_interest) for cc in cons]
results_df = pd.DataFrame(cols, columns = keys_of_interest)
umls_dict = {'umls_codes': results_df['cui'].tolist(),
'textual_description': results_df['preferred_name'].tolist()}
save_json(umls_dict, self.output_data_path + k.split('_')[0] + '_' + k.split('_')[1] + '.json')
def get_umls_codes_of_notes_divide_and_merge(self):
step = 20000
k_list = list(self.notes.keys())
random.shuffle(k_list)
for k in k_list:
n = self.notes[k]
cui_all, textual_all = [], []
for i in range(0, len(n), step):
if self.lite:
cons, _ = self.mm_conn.mm.extract_concepts([n[i:i+step]])
else:
cons, _ = self.mm_conn.mm.extract_concepts([n[i:i+step]],
word_sense_disambiguation = True,
#restrict_to_sts = ['sosy'], # signs and symptoms
composite_phrase = 1) # for memory issues
keys_of_interest = ['preferred_name', 'cui', 'semtypes', 'pos_info']
cols = [get_keys_from_mm(cc, keys_of_interest) for cc in cons]
results_df = pd.DataFrame(cols, columns = keys_of_interest)
cui_all.extend(results_df['cui'].tolist())
textual_all.extend(results_df['preferred_name'].tolist())
umls_dict = {'umls_codes': cui_all,
'textual_description': textual_all}
save_json(umls_dict, self.output_data_path + k.split('_')[0] + '_' + k.split('_')[1] + '.json')
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--bucket_path", default=None, type=str, required=True,
help = "The path of the note buckets.")
parser.add_argument("--bucket_id", default=None, type=str, required=True,
help = "The bucket id/number to indicate the one that is going to be processed.")
parser.add_argument("--metamap_path", default=None, type=str, required=True,
help = "The path of metamap base directory.")
parser.add_argument("--output_path", default=None, type=str, required=True,
help = "The path where the extracted umls codes are stored.")
parser.add_argument("--divide_and_merge", default=0, type=int, required=False,
help = "This is a flag to define if the notes are going to be divided into subnotes and then processed by metamap. The final UMLS sublists are merged. Values: 0 or 1")
args = parser.parse_args()
if not os.path.exists(args.output_path):
os.makedirs(args.output_path)
ex = ExtractorUMLS(notes_path = args.bucket_path + 'notes_bucket_' + args.bucket_id + '.json',
lite = 1,
metamap_lite_base_dir = args.metamap_path,
metamap_base_dir = '',
metamap_bin_dir = '',
metamap_pos_server_dir = '',
metamap_wsd_server_dir = '',
output_data_path = args.output_path)
if args.divide_and_merge:
ex.get_umls_codes_of_notes_divide_and_merge()
else:
ex.get_umls_codes_of_notes() | 11,752 | 44.203846 | 191 | py |
null | hspo-ontology-main/hspo-kg-builder/kg-generation/mimic/README.md | # Person-Centric Knowledge Graph Extraction using MIMIC-III dataset: An ICU-readmission prediction study
## Knowledge Graph Generation
## Setup
### Requirements
- Python 3.7+
- rdflib (tested with version 6.1.1)
- HSPO ontology (tested with version 0.0.17)
### Execution - Description
- Run the ```graph_creation_ontology_mapping.py --data_path --ontology_path --URIflag --output_path --text_URI --gender_mapping_path --ethnicity_mapping_path --marital_status_mapping_path --religion_mapping_path``` script to extract the person-centric Knowledge Graphs in RDF format using the final .json file that is extracted from the data-preprocessing pipeline (code under <i>hspo-kg-builder/data-lifting/mimic/</i> folder). Arguments:
- data_path: The path of the final json file with the data.
- ontology_path: The path of the ontology .ttl file.
- URIflag: The flag to define the URI creation strategy. Possible values: 0, 1, 2
- output_path: The output path where the RDF graphs are going to be stored.
- text_URI: The flag to define if text (1) or ICD9 codes (0) are going to be used in the URI creation. Possible values: 0, 1
- gender_mapping_path: The path of the gender ontology mapping file.
- ethnicity_mapping_path: The path of the ethnicity ontology mapping file.
- marital_status_mapping_path: The path of the marital status ontology mapping file.
- religion_mapping_path: The path of the relation mapping file.
- The user should provide the ontology mappings for gender, ethnicity/race, marital status, and relation. Example mappings are provided.
- The <i>URIflag</i> argument defines the 3 different URI creation strategies as follows:
- 0: No URIs are introduced and the extracted graphs contain empty nodes (BNode).
- 1 and 2: URIs are introduced. There are slight differences between the two strategies in some nodes that are introduced (e.g. Age node). The second strategy is more detailed.
- The person-centric Knowledge Graphs are extracted in RDF format.
### Notes
- Different graph versions can be extracted. The user can choose which one is more appropriate for the application. | 2,144 | 70.5 | 439 | md |
null | hspo-ontology-main/hspo-kg-builder/kg-generation/mimic/graph_creation_ontology_mapping.py | from rdflib import Graph, Literal, BNode
from rdflib.term import URIRef
from rdflib.namespace import RDF
import json
import os
import argparse
from utils_ import remove_special_character_and_spaces, read_json, process_URIRef_terms
from utils_ import Ontology
class GraphMapping:
def __init__(self, input_data_path, input_ont_path, ont_namespace,
URIflag, output_path, text_URI, gender_mapping, ethnicity_mapping,
marital_status_mapping, religion_mapping):
self.input_data_path = input_data_path
self.data = self.read_json()
self.ont_namespace = ont_namespace
self.ont_obj = Ontology(input_ont_path, ont_namespace)
self.gender_mapping = gender_mapping
self.ethnicity_mapping = ethnicity_mapping
self.marital_status_mapping = marital_status_mapping
self.religion_mapping = religion_mapping
self.URIflag = URIflag
self.output_path = output_path
self.text_URI = text_URI
self.create_output_dirs()
def create_output_dirs(self):
if self.URIflag == 0:
if not(os.path.exists(self.output_path + 'withoutURI/1/')):
os.makedirs(self.output_path + 'withoutURI/1/')
if not(os.path.exists(self.output_path + 'withoutURI/0/')):
os.makedirs(self.output_path + 'withoutURI/0/')
elif self.URIflag == 1:
if not(os.path.exists(self.output_path + 'withURI_mixed/1/')):
os.makedirs(self.output_path + 'withURI_mixed/1/')
if not(os.path.exists(self.output_path + 'withURI_mixed/0/')):
os.makedirs(self.output_path + 'withURI_mixed/0/')
elif self.URIflag == 2:
if not(os.path.exists(self.output_path + 'with_new_URI/1/')):
os.makedirs(self.output_path + 'with_new_URI/1/')
if not(os.path.exists(self.output_path + 'with_new_URI/0/')):
os.makedirs(self.output_path + 'with_new_URI/0/')
else:
print('Wrong URIflag was given.')
def exec(self):
for k1 in self.data.keys():
for k2 in self.data[k1].keys():
patient_adm_id = k1 + '_' + k2
# Initialize the graph
g = Graph()
g.bind('hspo', self.ont_obj.ont_namespace)
# Initialize the central patient node
if self.URIflag == 0:
patient = BNode()
elif self.URIflag == 1:
patient = URIRef(self.ont_namespace + 'Person')
elif self.URIflag == 2:
#patient = URIRef(self.ont_namespace + patient_adm_id)
patient = URIRef(self.ont_namespace + 'patient/' + patient_adm_id)
if self.URIflag in [0, 2]:
g.add((patient, RDF.type, self.ont_obj.ont_namespace.Person))
g.add((patient, self.ont_obj.ont_namespace.person_id, Literal(patient_adm_id)))
#g.add((patient, RDF.type, FOAF.Person))
#g.add((patient, FOAF.name, Literal(patient_adm_id)))
# Adding demographics information
g.add((patient, self.ont_obj.ont_namespace.hasGender, self.gender_mapping[self.data[k1][k2]['gender'].lower()]))
g.add((patient, self.ont_obj.ont_namespace.hasRaceorEthnicity, self.ethnicity_mapping[self.data[k1][k2]['ethnicity'].lower()]))
g.add((patient, self.ont_obj.ont_namespace.hasMaritalStatus, self.marital_status_mapping[self.data[k1][k2]['marital_status'].lower()]))
g.add((patient, self.ont_obj.ont_namespace.followsReligion, self.religion_mapping[self.data[k1][k2]['religion'].lower()]))
# Adding age information
if self.URIflag == 0:
age = BNode()
elif self.URIflag == 1:
age = URIRef(self.ont_namespace + 'Age')
elif self.URIflag == 2:
age = URIRef(self.ont_namespace + 'age/' + self.data[k1][k2]['age'])
if self.URIflag in [0, 2]:
g.add((age, RDF.type, self.ont_obj.ont_namespace.Age))
g.add((patient, self.ont_obj.ont_namespace.hasAge, age))
g.add((age, self.ont_obj.ont_namespace.age_in_years, Literal(int(self.data[k1][k2]['age']))))
g.add((age, self.ont_obj.ont_namespace.hasStageOfLife, self.define_stage_of_life(int(self.data[k1][k2]['age']))))
g.add((age, self.ont_obj.ont_namespace.belongsToAgeGroup, self.get_age_group(int(self.data[k1][k2]['age']))))
# Adding diagnoses/diseases
tmp_diseases = []
for j, d_icd9 in enumerate(self.data[k1][k2]['diagnoses']['icd9_code']):
if d_icd9 not in tmp_diseases:
tmp_diseases.append(d_icd9)
if self.URIflag == 0:
disease = BNode()
elif self.URIflag in [1, 2]:
####################### TO BE DONE: Use the EFO ontology to create the URIs for the diseases. ######################
# Implement the method: get_EFO_mapping
# Strategy:
# - Load the EFO ontology.
# - Manipulate and process it in a similar to HSPO ontology processing.
# - Map the ICD9 code to the provided URI by the EFO ontology.
# - Use the URI for the created node.
####################################################################################################################
if self.text_URI:
diseases_URIRef_ready = remove_special_character_and_spaces(self.data[k1][k2]['diagnoses']['textual_description'][j])
#disease = URIRef(self.ont_namespace + diseases_URIRef_ready)
disease = URIRef(self.ont_namespace + 'disease/' + diseases_URIRef_ready)
else:
#disease = URIRef(self.ont_namespace + 'icd9_' + d_icd9)
disease = URIRef(self.ont_namespace + 'disease/icd9_' + d_icd9)
g.add((disease, RDF.type, self.ont_obj.ont_namespace.Disease))
g.add((patient, self.ont_obj.ont_namespace.hasDisease, disease))
g.add((disease, self.ont_obj.ont_namespace.icd9Code, Literal(d_icd9)))
# disease_name is going to be removed when the EFO ontology is going to be used for mapping.
g.add((disease, self.ont_obj.ont_namespace.disease_name, Literal(self.data[k1][k2]['diagnoses']['textual_description'][j])))
else:
continue
# Adding prescriptions as intervations
tmp_drugs = []
for j, prescription in enumerate(self.data[k1][k2]['prescriptions']['drug']):
# Avoid adding the drug more than ones.
if prescription not in tmp_drugs:
tmp_drugs.append(prescription)
if self.URIflag == 0:
intervention = BNode()
elif self.URIflag in [1, 2]:
prescription_URIRef_ready = remove_special_character_and_spaces(prescription.lower())
#intervention = URIRef(self.ont_namespace + prescription_URIRef_ready)
intervention = URIRef(self.ont_namespace + 'intervention/' + prescription_URIRef_ready)
g.add((intervention, RDF.type, self.ont_obj.ont_namespace.Intervation))
g.add((patient, self.ont_obj.ont_namespace.hasIntervention, intervention))
g.add((intervention, self.ont_obj.ont_namespace.intervention_name, Literal(prescription.lower())))
g.add((intervention, self.ont_obj.ont_namespace.intervention_code_system, Literal("NDC")))
#g.add((intervention, self.ont_obj.ont_namespace.intervention_code_system, Literal("GSN")))
g.add((intervention, self.ont_obj.ont_namespace.intervention_code, Literal(self.data[k1][k2]['prescriptions']['ndc'][j])))
#g.add((intervention, self.ont_obj.ont_namespace.intervention_code, Literal(self.data[k1][k2]['prescriptions']['gsn'][j])))
g.add((intervention, self.ont_obj.ont_namespace.hasInterventionType, URIRef(self.ont_namespace + 'medication_provisioning')))
else:
continue
# Adding CPT events
tmp_cpt_events = []
for j, cpt_event in enumerate(self.data[k1][k2]['cpt_events']['subsection_header']):
# Avoid adding the CPT event more than ones.
if cpt_event not in tmp_cpt_events:
tmp_cpt_events.append(cpt_event)
if self.URIflag == 0:
intervention = BNode()
elif self.URIflag in [1, 2]:
#intervention = URIRef(self.ont_namespace + remove_special_character_and_spaces(cpt_event.lower()))
intervention = URIRef(self.ont_namespace + 'intervention/' + remove_special_character_and_spaces(cpt_event.lower()))
g.add((intervention, RDF.type, self.ont_obj.ont_namespace.Intervation))
g.add((patient, self.ont_obj.ont_namespace.hasIntervention, intervention))
g.add((intervention, self.ont_obj.ont_namespace.intervention_name, Literal(cpt_event.lower())))
g.add((intervention, self.ont_obj.ont_namespace.intervention_code_system, Literal("CPT")))
g.add((intervention, self.ont_obj.ont_namespace.intervention_code, Literal(self.data[k1][k2]['cpt_events']['cpt_code'][j])))
g.add((intervention, self.ont_obj.ont_namespace.hasInterventionType, URIRef(self.ont_namespace + 'procedure_provisioning')))
# Adding procedures
for j, proc_icd9 in enumerate(self.data[k1][k2]['procedures']['icd9_code']):
if self.URIflag == 0:
intervention = BNode()
elif self.URIflag in [1, 2]:
if self.text_URI:
intervention_URIRef_ready = remove_special_character_and_spaces(self.data[k1][k2]['procedures']['textual_description'][j])
#intervention = URIRef(self.ont_namespace + intervention_URIRef_ready)
intervention = URIRef(self.ont_namespace + 'intervention/' + intervention_URIRef_ready)
else:
#intervention = URIRef(self.ont_namespace + 'icd9_' + proc_icd9)
intervention = URIRef(self.ont_namespace + 'intervention/icd9_' + proc_icd9)
g.add((intervention, RDF.type, self.ont_obj.ont_namespace.Intervation))
g.add((patient, self.ont_obj.ont_namespace.hasIntervention, intervention))
g.add((intervention, self.ont_obj.ont_namespace.icd9Code, Literal(proc_icd9)))
g.add((intervention, self.ont_obj.ont_namespace.intervention_name, Literal(self.data[k1][k2]['procedures']['textual_description'][j])))
g.add((intervention, self.ont_obj.ont_namespace.intervention_code_system, Literal("ICD9")))
g.add((intervention, self.ont_obj.ont_namespace.intervention_code, Literal(proc_icd9)))
g.add((intervention, self.ont_obj.ont_namespace.hasInterventionType, URIRef(self.ont_namespace + 'procedure_provisioning')))
# Adding social context
# Add employment
try:
for empl in self.data[k1][k2]['social_info']['employment']['textual_description']:
employment_URIRef_ready = remove_special_character_and_spaces(empl)
#employment = URIRef(self.ont_namespace + employment_URIRef_ready)
employment = URIRef(self.ont_namespace + 'employment/' + employment_URIRef_ready)
g.add((employment, RDF.type, self.ont_obj.ont_namespace.Employment))
g.add((patient, self.ont_obj.ont_namespace.hasSocialContext, employment))
except:
pass
# Add household
try:
for h_cui in self.data[k1][k2]['social_info']['household_composition']['umls_codes']:
index = self.ont_obj.get_ont_classes_instances()[URIRef(self.ont_namespace + 'Household')]['umlsCui'].index(Literal(h_cui))
household = self.ont_obj.get_ont_classes_instances()[URIRef(self.ont_namespace + 'Household')]['instances'][index]
# Add the "household/" in the URI, it is useful for the next step where the RDF graphs are transformed into triplets for GNN training.
household_edited = '/'.join(household.split('/')[:-1] + ['household'] + [household.split('/')[-1]])
g.add((household_edited, RDF.type, self.ont_obj.ont_namespace.Household))
g.add((patient, self.ont_obj.ont_namespace.hasSocialContext, household_edited))
except:
pass
# Add housing
try:
for h in self.data[k1][k2]['social_info']['housing']['textual_description']:
housing_URIRef_ready = remove_special_character_and_spaces(h)
#housing = URIRef(self.ont_namespace + housing_URIRef_ready)
housing = URIRef(self.ont_namespace + 'housing/' + housing_URIRef_ready)
g.add((housing, RDF.type, self.ont_obj.ont_namespace.Housing))
g.add((patient, self.ont_obj.ont_namespace.hasSocialContext, housing))
except:
pass
# Save the graph
readmission_label = self.data[k1][k2]['readmission']
if self.URIflag == 0:
g.serialize(destination = self.output_path + 'withoutURI/' + readmission_label + '/' + patient_adm_id + '.ttl')
elif self.URIflag == 1:
g.serialize(destination = self.output_path + 'withURI_mixed/' + readmission_label + '/' + patient_adm_id + '.ttl')
elif self.URIflag == 2:
g.serialize(destination = self.output_path + 'with_new_URI/' + readmission_label + '/' + patient_adm_id + '.ttl')
def define_stage_of_life(self, age):
if age <= 1:
return URIRef(self.ont_namespace + 'infant')
elif age <= 4:
return URIRef(self.ont_namespace + 'toddler')
elif age <= 12:
return URIRef(self.ont_namespace + 'child')
elif age <= 19:
return URIRef(self.ont_namespace + 'teen')
elif age <= 39:
return URIRef(self.ont_namespace + 'adult')
elif age <= 59:
return URIRef(self.ont_namespace + 'middle_age_adult')
else:
return URIRef(self.ont_namespace + 'senior_adult')
def get_age_group(self, age):
if age < 5:
return URIRef(self.ont_namespace + 'under_five')
elif age < 10:
return URIRef(self.ont_namespace + 'five_to_nine')
elif age < 15:
return URIRef(self.ont_namespace + 'ten_to_fourteen')
elif age < 20:
return URIRef(self.ont_namespace + 'fifteen_to_nineteen')
elif age < 25:
return URIRef(self.ont_namespace + 'twenty_to_twentyfour')
elif age < 30:
return URIRef(self.ont_namespace + 'twentyfive_to_twentynine')
elif age < 35:
return URIRef(self.ont_namespace + 'thirty_to_thirtyfour')
elif age < 40:
return URIRef(self.ont_namespace + 'thirtyfive_to_thirtynine')
elif age < 45:
return URIRef(self.ont_namespace + 'forty_to_fortyfour')
elif age < 50:
return URIRef(self.ont_namespace + 'fortyfive_to_fortynine')
elif age < 55:
return URIRef(self.ont_namespace + 'fifty_to_fiftyfour')
elif age < 60:
return URIRef(self.ont_namespace + 'fiftyfive_to_fiftynine')
elif age < 65:
return URIRef(self.ont_namespace + 'sixty_to_sixtyfour')
elif age < 70:
return URIRef(self.ont_namespace + 'sixtyfive_to_sixtynine')
elif age < 75:
return URIRef(self.ont_namespace + 'seventy_to_seventyfour')
elif age < 80:
return URIRef(self.ont_namespace + 'seventyfive_to_seventynine')
elif age < 85:
return URIRef(self.ont_namespace + 'eighty_to_eightyfour')
else:
return URIRef(self.ont_namespace + 'over_eightyfive')
def get_EFO_mapping(self):
pass
def read_json(self):
with open(self.input_data_path) as json_file:
return json.load(json_file)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", default='../../data-lifting/mimic/data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json', type=str, required=False,
help = "The path of the final json file with the data.")
parser.add_argument("--ontology_path", default='../../../ontology/hspo.ttl', type=str, required=False,
help = "The path of the ontology .ttl file.")
parser.add_argument("--URIflag", default=None, type=int, required=True,
help = "The flag to define the URI creation strategy. Possible values: 0, 1, 2")
parser.add_argument("--output_path", default='PKG/grouped_icd9/nodes_with_textual_description/', type=str, required=True,
help = "The output path where the RDF graphs are going to be stored.")
parser.add_argument("--text_URI", default=None, type=int, required=True,
help = "The flag to define if text (1) or ICD9 codes (0) are going to be used in the URI creation. Possible values: 0, 1")
parser.add_argument("--gender_mapping_path", default='data/gender_mappings.json', type=str, required=False,
help = "The path of the gender mapping file.")
parser.add_argument("--ethnicity_mapping_path", default='data/ethnicity_mappings.json', type=str, required=False,
help = "The path of the ethnicity mapping file.")
parser.add_argument("--marital_status_mapping_path", default='data/marital_status_mappings.json', type=str, required=False,
help = "The path of the marital status mapping file.")
parser.add_argument("--religion_mapping_path", default='data/religion_mappings.json', type=str, required=False,
help = "The path of the relation mapping file.")
args = parser.parse_args()
gender_mapping = process_URIRef_terms(read_json(args.gender_mapping_path))
ethnicity_mapping = process_URIRef_terms(read_json(args.ethnicity_mapping_path))
marital_status_mapping = process_URIRef_terms(read_json(args.marital_status_mapping_path))
religion_mapping = process_URIRef_terms(read_json(args.religion_mapping_path))
# Without URI
g_obj = GraphMapping(args.data_path,
args.ontology_path,
'http://research.ibm.com/ontologies/hspo/',
args.URIflag,
args.output_path,
args.text_URI,
gender_mapping,
ethnicity_mapping,
marital_status_mapping,
religion_mapping)
g_obj.exec() | 20,480 | 59.594675 | 169 | py |
null | hspo-ontology-main/hspo-kg-builder/kg-generation/mimic/utils_.py | from rdflib import Graph, Namespace
from rdflib.namespace import RDF, OWL
from rdflib.term import URIRef
import json
def read_json(path):
with open(path) as json_file:
return json.load(json_file)
def process_URIRef_terms(dict_):
updated_dict_ = {}
for k in dict_.keys():
updated_dict_[k] = URIRef(dict_[k])
return updated_dict_
def remove_special_character_and_spaces(text):
proc_text = ''
for word in text.split(' '):
tmp_word = ''.join(c for c in word if c.isalnum())
if len(tmp_word) > 0:
proc_text += tmp_word.lower()
proc_text += '_'
# Remove the last _
proc_text = proc_text[:-1]
return proc_text
class Ontology:
def __init__(self, input_path, ont_namespace):
self.input_path = input_path
self.ont = self.load_ontology()
self.ont_namespace = Namespace(ont_namespace)
self.ont_classes = self.get_ont_classes()
self.ont_class_instances = self.get_ont_classes_instances()
def load_ontology(self):
ont = Graph()
ont.parse(self.input_path)
return ont
def print_number_of_statements(self):
print("Ontology has {} statements." .format(len(self.ont)))
def get_ont_classes(self):
classes = {'name': [],
'umlsCui': []}
for s, _, _ in self.ont.triples((None, RDF.type, OWL.Class)):
classes['name'].append(s)
tmp_umlsCui = []
for _, _, o1 in self.ont.triples((s, self.ont_namespace.umlsCui, None)):
tmp_umlsCui.append(o1)
classes['umlsCui'].append(tmp_umlsCui)
return classes
def get_ont_classes_instances(self):
classes_instances = {}
for c in self.ont_classes['name']:
classes_instances[c] = {'instances': [],
'umlsCui': []}
for s, _, _ in self.ont.triples((None, RDF.type, c)):
classes_instances[c]['instances'].append(s)
for _, _, o1 in self.ont.triples((s, self.ont_namespace.umlsCui, None)):
classes_instances[c]['umlsCui'].append(o1)
return classes_instances | 2,228 | 30.394366 | 88 | py |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/0_data_split.py | import os
import random
import argparse
from helper import save_json
def find_json_files(path):
files = []
filenames = []
for file in os.listdir(path):
if file.endswith(".json"):
files.append(os.path.join(path, file))
filenames.append(file.split('.')[0])
return files, filenames
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--input_path_graphs_0", default='../../transformation/mimic/data/precalculated_embeddings/use_case_428_427/undirected/0/bow/v1/', type=str, required=False,
help = "The path of the precalculated embeddings of the graphs with 0 label (no readmission).")
parser.add_argument("--input_path_graphs_1", default='../../transformation/mimic/data/precalculated_embeddings/use_case_428_427/undirected/1/bow/v1/', type=str, required=False,
help = "The path of the precalculated embeddings of the graphs with 1 label (readmission).")
args = parser.parse_args()
_, graphs_p_0 = find_json_files(args.input_path_graphs_0)
_, graphs_p_1 = find_json_files(args.input_path_graphs_1)
random.seed(42)
random.shuffle(graphs_p_0)
splits_0 = []
for i in range(0, len(graphs_p_0), len(graphs_p_1)):
splits_0.append(graphs_p_0[i: i+len(graphs_p_1)])
if not os.path.exists('use_case_428_427_data_splits'):
os.makedirs('use_case_428_427_data_splits')
splits = []
for s in splits_0:
tmp_merge = graphs_p_1 + s
random.shuffle(tmp_merge)
splits.append(tmp_merge)
for i, s in enumerate(splits):
if not os.path.exists('use_case_428_427_data_splits/split_' + str(i) + '/'):
os.makedirs('use_case_428_427_data_splits/split_' + str(i) + '/')
save_json(s, 'use_case_428_427_data_splits/split_' + str(i) + '/all_data_' + str(i) + '.json')
# Create the cv folds
step = len(s)//5
c = 0
for j in range(0, len(s)-step, step):
fold = s[j:j+step]
rest = s[:j] + s[j+step:]
cv = {'train_set': rest,
'test_set': fold}
save_json(cv, 'use_case_428_427_data_splits/split_' + str(i) + '/cv_split_' + str(c) + '.json')
c += 1 | 2,280 | 37.661017 | 180 | py |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/README.md | # Person-Centric Knowledge Graph Extraction using MIMIC-III dataset: An ICU-readmission prediction study
## Graph Neural Networks (GNNs)
## Setup
### Requirements
- Python 3.7+
- tqdm (tested with version 4.64.0)
- scikit-learn (tested with version 1.1.2)
- pytorch (tested with version 1.12.1)
- pytorch_geometric (tested with version 2.1.0)
### Execution - Description
- Run the ```0_data_split.py --input_path_graphs_0 --input_path_graphs_1``` script to create the different balanced dataset splits for the experimentation. Arguments:
- input_path_graphs_0: The path of the precalculated embeddings of the graphs with 0 label (no readmission). Any path with precalculated embeddings (KG transformation step) can be used.
- input_path_graphs_1: The path of the precalculated embeddings of the graphs with 1 label (readmission). Any path with precalculated embeddings (KG transformation step) can be used.
- Run the ```main.py --input_path_data_files --input_path_graphs --directed --add_self_loop -batch_size --model_id --use_bases --num_bases --learning_rate --weight_decay --epochs --output_path``` to execute the training and evaluation of the models. Arguments:
- input_path_data_files: The input path of the data files (e.g. <i>use_case_428_427_data_splits/split_0/cv_split_0.json</i>).
- input_path_graphs: The input path of the processed graphs (transformation step).
- directed: Int value to define if the graph is going to be directed (1) or no (0).
- add_self_loop: Int value to define if self loops are going to be added in the graph (1) or no (0).
- batch_size: The size of the batch.
- model_id: The model id. Choices: 1_1, 1_2, 2_1, 2_2
- use_bases: Define if basis-decomposition regularization \[1\] is applied (1) or no (0).
- num_bases: The number of bases for the basis-decomposition technique.
- learning_rate: The learning rate for the optimizer.
- weight_decay: The weight decay for the optimizer.
- epochs: The number of training epochs.
- output_path: The output path for saving the model.
A bash script (```run_experiments.sh [-h] [-in d s a o l b m u n r w e x]```) to execute the experimental setup is also available. The paths (input, output, conda source, conda environments) should be updated accordingly.
## References
```
[1] Schlichtkrull, Michael, et al. "Modeling relational data with graph convolutional networks." European semantic web conference. Springer, Cham, 2018.
```
| 2,504 | 64.921053 | 260 | md |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/datasets.py | import torch_geometric.transforms as T
import torch
import os
from torch_geometric.data import Dataset
from helper import read_json
class MyDataset(Dataset):
def __init__(self, input_path, filenames, directed, add_self_loops, transform=None):
super(MyDataset, self).__init__('.', transform, None, None)
self.root = input_path
self.filenames = filenames
self.directed = directed
self.add_self_loops = add_self_loops
self.graph_paths = self.find_pt_files()
self.metadata = self.get(42).metadata()
def len(self):
return len(self.graph_paths)
def get(self, idx):
g = torch.load(self.graph_paths[idx])
return self._process(g)
def find_pt_files(self):
files_l = []
for root_, _, files in os.walk(self.root):
for file in files:
if file.endswith(".pt") and file.split('.')[0] in self.filenames:
files_l.append(os.path.join(root_, file))
return files_l
def _download(self):
return
def _process(self, g):
if not(self.directed):
g = T.ToUndirected()(g)
if self.add_self_loops:
g = T.AddSelfLoops()(g)
#g = T.NormalizeFeatures()(g)
return g
def __repr__(self):
return '{}()'.format(self.__class__.__name__)
| 1,379 | 23.210526 | 88 | py |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/helper.py | import json
import os
def save_json(file, path):
with open(path, 'w') as outfile:
json.dump(file, outfile)
def find_json_files(folder_path):
files = []
for file in os.listdir(folder_path):
if file.endswith(".json"):
files.append(os.path.join(folder_path, file))
return files
def read_json(path):
with open(path) as json_file:
return json.load(json_file)
def filter_list(l, filenames):
l_filtered = []
for p in l:
if p.split('/')[-1].split('.')[0] in filenames:
l_filtered.append(p)
return l_filtered
def filter_list_2(l, black_list):
l_filtered = []
for p in l:
if p.split('/')[-1].split('.')[0] not in black_list:
l_filtered.append(p)
return l_filtered
class InputFile:
def __init__(self, input_path, query_codes, query_code_descriptions):
self.init_file = read_json(input_path)
self.query_codes = query_codes
self.query_code_descriptions = query_code_descriptions
self.sampled_file_and_operation, self.key_list_and_operation = self.get_sampled_file_and_operation()
self.sampled_file_or_operation, self.key_list_or_operation = self.get_sampled_file_or_operation()
def get_sampled_file_and_operation(self):
sampled_dict = {}
key_list = []
for k1 in self.init_file.keys():
for k2 in self.init_file[k1].keys():
flag = 0
# Check if all the query codes exist in the record.
for i, q_c in enumerate(self.query_codes):
q_c_descr = self.query_code_descriptions[i]
if len(q_c_descr) == 1:
if not(q_c in self.init_file[k1][k2][q_c_descr[0]]):
flag = 1
elif len(q_c_descr) == 2:
if not(q_c in self.init_file[k1][k2][q_c_descr[0]][q_c_descr[1]]):
flag = 1
if flag == 0:
if k1 not in sampled_dict.keys():
sampled_dict[k1] = {}
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
else:
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
return sampled_dict, key_list
def get_sampled_file_or_operation(self):
sampled_dict = {}
key_list = []
for k1 in self.init_file.keys():
for k2 in self.init_file[k1].keys():
flag = 0
# Check if at least one of the query codes exists in the record.
for i, q_c in enumerate(self.query_codes):
q_c_descr = self.query_code_descriptions[i]
if len(q_c_descr) == 1:
if q_c in self.init_file[k1][k2][q_c_descr[0]]:
flag = 1
break
elif len(q_c_descr) == 2:
if q_c in self.init_file[k1][k2][q_c_descr[0]][q_c_descr[1]]:
flag = 1
break
if flag == 1:
if k1 not in sampled_dict.keys():
sampled_dict[k1] = {}
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
else:
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
return sampled_dict, key_list
class save_results(object):
def __init__(self, filename, header=None):
self.filename = filename
if os.path.exists(filename):
os.remove(filename)
if header is not None:
with open(filename, 'w') as out:
print(header, file=out)
def save(self, info):
with open(self.filename, 'a') as out:
print(info, file=out) | 4,084 | 35.150442 | 108 | py |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/main.py | import argparse
import torch
from tqdm import tqdm
import os
import sys
import logging
from torch_geometric.loader import DataLoader
from torch_geometric.nn import to_hetero, to_hetero_with_bases
from sklearn.metrics import precision_recall_fscore_support, accuracy_score
from datasets import MyDataset
from models import Net1_1, Net1_2, Net2_1, Net2_2
from helper import read_json, save_results
def train():
model.train()
steps, total_training_loss = 0, 0
predictions, ground_truth = [], []
for batch in tqdm(train_dataloader):
batch = batch.to(device)
steps += 1
optimizer.zero_grad()
x_dict_ = batch.x_dict
edge_index_dict_ = batch.edge_index_dict
out = model(x_dict_, edge_index_dict_)
loss = loss_function(out['patient'], torch.unsqueeze(batch['patient']['y'], 1))
loss.backward()
optimizer.step()
total_training_loss += loss
pred = torch.squeeze((torch.sigmoid(out['patient']) > 0.5).long(), 1)
predictions.extend(pred.tolist())
ground_truth.extend(batch['patient']['y'].long().tolist())
logger.info("------ Training Set Results ------")
logger.info("Epoch: {}, loss: {:.4f}" .format(epoch, total_training_loss / steps))
precision, recall, f1_score, _ = precision_recall_fscore_support(y_true=ground_truth, y_pred=predictions, average = 'binary', zero_division=0)
train_info = {'loss': total_training_loss / steps,
'accuracy': accuracy_score(y_true=ground_truth, y_pred=predictions),
'precision': precision,
'recall': recall,
'f1_score': f1_score}
return train_info, ground_truth, predictions
def evaluation(eval_loader, test_or_val):
steps, total_eval_loss = 0, 0
predictions, ground_truth = [], []
with torch.no_grad():
model.eval()
logger.info("------ Testing ------")
for batch in tqdm(eval_loader):
batch = batch.to(device)
steps += 1
x_dict_ = batch.x_dict
edge_index_dict_ = batch.edge_index_dict
out = model(x_dict_, edge_index_dict_)
loss = loss_function(out['patient'], torch.unsqueeze(batch['patient']['y'], 1))
total_eval_loss += loss
pred = torch.squeeze((torch.sigmoid(out['patient']) > 0.5).long(), 1)
predictions.extend(pred.tolist())
ground_truth.extend(batch['patient']['y'].long().tolist())
precision, recall, f1_score, _ = precision_recall_fscore_support(y_true=ground_truth, y_pred=predictions, average = 'binary', zero_division=0)
eval_info = {'loss': total_eval_loss/steps,
'accuracy': accuracy_score(y_true=ground_truth, y_pred=predictions),
'precision': precision,
'recall': recall,
'f1_score': f1_score}
logger.info("-------- {} Results --------" .format(test_or_val))
logger.info("loss: {:.4f}" .format(eval_info['loss'].item()))
logger.info("accuracy: {:.4f}" .format(eval_info['accuracy']))
logger.info("precision: {:.4f}" .format(eval_info['precision']))
logger.info("recall: {:.4f}" .format(eval_info['recall']))
logger.info("f1_score: {:.4f}" .format(eval_info['f1_score']))
return eval_info, ground_truth, predictions
if __name__ == '__main__':
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%m/%d/%Y %H:%M:%S',
level=logging.INFO)
logger = logging.getLogger(__name__)
parser = argparse.ArgumentParser()
parser.add_argument("--input_path_data_files", default=None, type=str, required=True,
help = "The input path of the data files")
parser.add_argument("--input_path_graphs", default=None, type=str, required=True,
help = "The input path of the processed graphs")
parser.add_argument("--directed", default=None, type=int, required=True,
help = "Int value to define if the graph is going to be directed (1) or no (0).")
parser.add_argument("--add_self_loop", default=None, type=int, required=True,
help = "Int value to define if self loops are going to be added in the graph (1) or no (0).")
parser.add_argument("--batch_size", default=None, type=int, required=True,
help = "The size of the batch")
parser.add_argument("--model_id", default=None, type=str, required=True,
help = "The model id")
parser.add_argument("--use_bases", default=None, type=int, required=True,
help = "Define if basis-decomposition regularization is applied (1) or no (0).")
parser.add_argument("--num_bases", default=None, type=int, required=False,
help = "The number of bases for the basis-decomposition technique. https://arxiv.org/pdf/1703.06103.pdf")
parser.add_argument("--learning_rate", default=None, type=float, required=True,
help = "The learning rate for the optimizer.")
parser.add_argument("--weight_decay", default=None, type=float, required=True,
help = "The weight decay for the optimizer.")
parser.add_argument("--epochs", default=None, type=int, required=True,
help = "The number of training epochs.")
parser.add_argument("--output_path", default=None, type=str, required=True,
help = "The output path for saving the model.")
args = parser.parse_args()
if not os.path.exists(args.output_path):
os.makedirs(args.output_path)
logger.addHandler(logging.FileHandler(args.output_path + 'log_info.log', 'w'))
logger.info(sys.argv)
logger.info(args)
saved_file = save_results(args.output_path + 'training_info.txt',
header='# epoch \t train_loss \t val_loss \t test_lost \t train_acc \t train_f1 \t val_acc \t val_f1 \t test_acc \t test_f1')
model_file = "best_model.pt"
# Define the device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
data_files = read_json(args.input_path_data_files)
# Split the data files in train, val, and test set.
train_filenames = data_files['train_set'][round(0.15*len(data_files['train_set'])):]
val_filenames = data_files['train_set'][:round(0.15*len(data_files['train_set']))]
test_filenames = data_files['test_set']
# Define the dataset and the dataloaders
train_dataset = MyDataset(input_path=args.input_path_graphs,
filenames=train_filenames, directed=args.directed, add_self_loops=args.add_self_loop)
val_dataset = MyDataset(input_path=args.input_path_graphs,
filenames=val_filenames, directed=args.directed, add_self_loops=args.add_self_loop)
test_dataset = MyDataset(input_path=args.input_path_graphs,
filenames=test_filenames, directed=args.directed, add_self_loops=args.add_self_loop)
train_dataloader = DataLoader(train_dataset, batch_size=args.batch_size, shuffle=True)
val_dataloader = DataLoader(val_dataset, batch_size=args.batch_size, shuffle=False)
test_dataloader = DataLoader(test_dataset, batch_size=args.batch_size, shuffle=False)
# Define the model
if args.model_id == '1_1':
model = Net1_1([256, 32])
elif args.model_id == '1_2':
model = Net1_2([256, 32])
elif args.model_id == '2_1':
model = Net2_1([256, 32])
elif args.model_id == '2_2':
model = Net2_2([256, 32])
else:
print('Wrong model id was given.')
if args.use_bases:
model = to_hetero_with_bases(model, train_dataset.metadata, num_bases=args.num_bases)
else:
model = to_hetero(model, train_dataset.metadata, aggr='sum')
model.to(device)
optimizer = torch.optim.Adam(model.parameters(), lr=args.learning_rate, weight_decay=args.weight_decay)
loss_function = torch.nn.BCEWithLogitsLoss()
best_result = 0
test_best_acc = None
test_best_prec = None
test_best_rec = None
test_best_f1 = None
# Training + Evaluation
train_info = {'epoch': [],
'loss': [],
'accuracy': [],
'precision': [],
'recall': [],
'f1_score': []}
val_info = {'epoch': [],
'loss': [],
'accuracy': [],
'precision': [],
'recall': [],
'f1_score': []}
test_info = {'epoch': [],
'loss': [],
'accuracy': [],
'precision': [],
'recall': [],
'f1_score': []}
for epoch in range(args.epochs):
logger.info('---------Training---------')
# Train step
train_info_epoch, _, _ = train()
train_info['epoch'].append(epoch + 1)
train_info['loss'].append(train_info_epoch['loss'].item())
train_info['accuracy'].append(train_info_epoch['accuracy'])
train_info['precision'].append(train_info_epoch['precision'])
train_info['recall'].append(train_info_epoch['recall'])
train_info['f1_score'].append(train_info_epoch['f1_score'])
# Validation step
eval_info, _, _ = evaluation(val_dataloader, 'val')
val_info['epoch'].append(epoch + 1)
val_info['loss'].append(eval_info['loss'].item())
val_info['accuracy'].append(eval_info['accuracy'])
val_info['precision'].append(eval_info['precision'])
val_info['recall'].append(eval_info['recall'])
val_info['f1_score'].append(eval_info['f1_score'])
# Test step
eval_info, _, _ = evaluation(test_dataloader, 'test')
test_info['epoch'].append(epoch + 1)
test_info['loss'].append(eval_info['loss'].item())
test_info['accuracy'].append(eval_info['accuracy'])
test_info['precision'].append(eval_info['precision'])
test_info['recall'].append(eval_info['recall'])
test_info['f1_score'].append(eval_info['f1_score'])
# Save the best model based on the performance in validation set.
if epoch == 0 or val_info['f1_score'][-1] > best_result:
best_result = val_info['f1_score'][-1]
test_best_acc = test_info['accuracy'][-1]
test_best_prec = test_info['precision'][-1]
test_best_rec = test_info['recall'][-1]
test_best_f1 = test_info['f1_score'][-1]
torch.save(model.state_dict(), args.output_path + model_file)
logger.info("Best results on val set saved!")
saved_file.save("{} \t {:.4f} \t {:.4f} \t {:.4f} \t {:.4f} \t {:.4f} \t {:.4f} \t {:.4f} \t {:.4f} \t {:.4f}" .format(epoch,
train_info['loss'][-1],
val_info['loss'][-1],
test_info['loss'][-1],
train_info['accuracy'][-1],
train_info['f1_score'][-1],
val_info['accuracy'][-1],
val_info['f1_score'][-1],
test_info['accuracy'][-1],
test_info['f1_score'][-1]))
saved_file.save("best test result: acc: {:.4f} \t prec: {:.4f} \t rec: {:.4f} \t f1: {:.4f}" .format(test_best_acc,
test_best_prec,
test_best_rec,
test_best_f1))
| 12,787 | 49.948207 | 155 | py |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/models.py | import torch
import torch.nn.functional as F
from torch_geometric.nn import SAGEConv, RGCNConv, GATv2Conv, Linear
class Net1_1(torch.nn.Module):
def __init__(self, hidden_channels):
super().__init__()
self.conv1 = SAGEConv((-1, -1), hidden_channels[0])
self.conv2 = SAGEConv((-1, -1), hidden_channels[1])
self.linear1 = Linear(hidden_channels[1], 1)
def forward(self, x, edge_index):
x = F.relu(self.conv1(x=x, edge_index=edge_index))
x = F.relu(self.conv2(x=x, edge_index=edge_index))
x = self.linear1(x)
return x
class Net1_2(torch.nn.Module):
def __init__(self, hidden_channels):
super().__init__()
self.conv1 = SAGEConv((-1, -1), hidden_channels[0])
self.conv2 = SAGEConv((-1, -1), hidden_channels[1])
self.conv3 = SAGEConv((-1, -1), 1)
def forward(self, x, edge_index):
x = F.relu(self.conv1(x=x, edge_index=edge_index))
x = F.relu(self.conv2(x=x, edge_index=edge_index))
x = self.conv3(x, edge_index=edge_index)
return x
class Net2_1(torch.nn.Module):
def __init__(self, hidden_channels):
super().__init__()
self.conv1 = GATv2Conv((-1, -1), hidden_channels[0], heads=1, add_self_loops=False)
self.linear1 = Linear(-1, hidden_channels[0])
self.conv2 = GATv2Conv((-1, -1), hidden_channels[1], heads=1, add_self_loops=False)
self.linear2 = Linear(-1, hidden_channels[1])
self.linear3 = Linear(hidden_channels[1], 1)
def forward(self, x, edge_index):
x = F.relu(self.conv1(x=x, edge_index=edge_index) + self.linear1(x))
x = F.relu(self.conv2(x=x, edge_index=edge_index) + self.linear2(x))
x = self.linear3(x)
return x
class Net2_2(torch.nn.Module):
def __init__(self, hidden_channels):
super().__init__()
self.conv1 = GATv2Conv((-1, -1), hidden_channels[0], heads=1, add_self_loops=False)
self.linear1 = Linear(-1, hidden_channels[0])
self.conv2 = GATv2Conv((-1, -1), hidden_channels[1], heads=1, add_self_loops=False)
self.linear2 = Linear(-1, hidden_channels[1])
self.conv3 = GATv2Conv((-1, -1), 1, heads=1, add_self_loops=False)
self.linear3 = Linear(-1, 1)
def forward(self, x, edge_index):
x = F.relu(self.conv1(x=x, edge_index=edge_index) + self.linear1(x))
x = F.relu(self.conv2(x=x, edge_index=edge_index) + self.linear2(x))
x = self.conv3(x=x, edge_index=edge_index) + self.linear3(x)
return x
| 2,570 | 33.743243 | 91 | py |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/run_experiments.sh | #!/bin/bash
############################################################
# Help #
############################################################
Help()
{
# Display Help
echo "Description of parameters."
echo
echo "Example: run_experiments.sh -d 0 -s 'lm' -a 'cls' -o 1 -l 1 -b 32 -m '1_2' -u 1 -n 5 -r 0.001 -w 0.0005 -e 100 -x 1"
echo "Parameters:"
echo "h Call the help function."
echo "d Directed (1) or Undected graph (0). Values: 0 or 1"
echo "s Embedding strategy. Values: 'bow' or 'lm'"
echo "a Aggregation strategy. Values: 'cls', 'avg', 'sum', '_'"
echo "o Graph version. Values: {1, 2, 3, 4, 5, 6, (7)}"
echo "l Adding a self loop (1) in the graph or no (0). Values: 0 or 1"
echo "b The batch size, e.g. 32, 64, etc."
echo "m The model id. Values: 1_1, 1_2, 2_1, 2_2"
echo "u Using bases (1) or no (0). Values: 0 or 1"
echo "n The number of bases, if some are used. e.g. 5"
echo "r The learning rate for training. e.g. 0.001"
echo "w The weight decay parameter. e.g. 0.0005"
echo "e The number of training epochs. e.g. 100"
echo "x The experiment id"
}
usage="$(basename "$0") [-h] [-in d s a o l b m u n r w e x] -- program to run the experiment pipeline"
if [ "$1" == "-h" ] ; then
echo "$usage"
Help
exit 0
fi
# A string with command options
options=$@
while getopts d:s:a:o:l:b:m:u:n:r:w:e:x: options
do
case "${options}" in
d) directed=${OPTARG};;
s) emb_strategy=${OPTARG};;
a) aggr_strategy=${OPTARG};;
o) graph_version=${OPTARG};;
l) add_self_loop=${OPTARG};;
b) batch_size=${OPTARG};;
m) model_id=${OPTARG};;
u) use_bases=${OPTARG};;
n) num_bases=${OPTARG};;
r) learning_rate=${OPTARG};;
w) weight_decay=${OPTARG};;
e) epochs=${OPTARG};;
x) exp_id=${OPTARG};;
esac
done
source /opt/share/anaconda3-2019.03/x86_64/etc/profile.d/conda.sh
conda conda_envs/pytorch
if [ $directed -eq 1 ]
then
direction='directed'
else
direction='undirected'
fi
if [ $emb_strategy = 'bow' ]
then
input_path_graphs='../../transformation/mimic/data/processed_graphs/use_case_428_427/'${direction}'/'${emb_strategy}'/v'${graph_version}'/'
else
input_path_graphs='../../transformation/mimic/data/processed_graphs/use_case_428_427/'${direction}'/'${emb_strategy}'/'${aggr_strategy}'/v'${graph_version}'/'
fi
for splits in {0..9}
do
for cv_splits in {0..4}
do
input_path_data_files='use_case_428_427_data_splits/split_'${splits}'/cv_split_'${cv_splits}'.json'
output_path='saved_models/use_case_428_427/exp_'${exp_id}'/'${direction}'/'${emb_strategy}'/v'${graph_version}'/'${model_id}'/split_'${splits}'/cv_split_'${cv_splits}'/'
jbsub -mem 16g -q x86_24h -cores 1+1 python main.py --input_path_data_files $input_path_data_files --input_path_graphs $input_path_graphs --directed $directed --add_self_loop $add_self_loop --batch_size $batch_size --model_id $model_id --use_bases $use_bases --num_bases $num_bases --learning_rate $learning_rate --weight_decay $weight_decay --epochs $epochs --output_path $output_path
done
done
| 3,271 | 36.181818 | 393 | sh |
null | hspo-ontology-main/kg-embedding/gnn-models/mimic/utils/explore_results.py | import os
import numpy as np
import json
import argparse
class Search:
def __init__(self, folder_path, output_path):
self.folder_path = folder_path
self.output_path = output_path
self.files_to_check = self.get_files()
self.res_dict = self.build_res_dict()
self.add_avg_metrics_cv()
self.res_dict_across_splits = self.add_avg_metrics_splits()
def get_files(self):
training_info_files = []
for root, _, files in os.walk(self.folder_path, topdown=False):
for name in files:
if name == 'training_info.txt':
training_info_files.append(os.path.join(root, name))
return training_info_files
def build_res_dict(self):
res_dict = {}
for f in self.files_to_check:
with open(f) as f_:
lines = f_.readlines()
try:
acc = lines[-1][:-1].split('\t')[0][-7:-1]
prec = lines[-1][:-1].split('\t')[1][-7:-1]
rec = lines[-1][:-1].split('\t')[2][-7:-1]
f1 = lines[-1][:-1].split('\t')[3][-6:]
f_sub = f.split('/')
if f_sub[5] not in res_dict.keys():
res_dict[f_sub[5]] = {}
if f_sub[6] not in res_dict[f_sub[5]].keys():
res_dict[f_sub[5]][f_sub[6]] = {}
if f_sub[7] not in res_dict[f_sub[5]][f_sub[6]].keys():
res_dict[f_sub[5]][f_sub[6]][f_sub[7]] = {}
if f_sub[8] not in res_dict[f_sub[5]][f_sub[6]][f_sub[7]].keys():
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]] = {}
if f_sub[9] not in res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]].keys():
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]] = {}
if f_sub[10] not in res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]].keys():
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]][f_sub[10]] = {'acc': [],
'prec': [],
'rec': [],
'f1': []}
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]][f_sub[10]]['acc'].append(float(acc))
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]][f_sub[10]]['prec'].append(float(prec))
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]][f_sub[10]]['rec'].append(float(rec))
res_dict[f_sub[5]][f_sub[6]][f_sub[7]][f_sub[8]][f_sub[9]][f_sub[10]]['f1'].append(float(f1))
except:
pass
return res_dict
def add_avg_metrics_cv(self):
for k1 in self.res_dict.keys():
for k2 in self.res_dict[k1].keys():
for k3 in self.res_dict[k1][k2].keys():
for k4 in self.res_dict[k1][k2][k3].keys():
for k5 in self.res_dict[k1][k2][k3][k4].keys():
for k6 in self.res_dict[k1][k2][k3][k4][k5].keys():
self.res_dict[k1][k2][k3][k4][k5][k6]['avg_acc']= round(np.mean(self.res_dict[k1][k2][k3][k4][k5][k6]['acc']), 4)
self.res_dict[k1][k2][k3][k4][k5][k6]['avg_prec']= round(np.mean(self.res_dict[k1][k2][k3][k4][k5][k6]['prec']), 4)
self.res_dict[k1][k2][k3][k4][k5][k6]['avg_rec']= round(np.mean(self.res_dict[k1][k2][k3][k4][k5][k6]['rec']), 4)
self.res_dict[k1][k2][k3][k4][k5][k6]['avg_f1']= round(np.mean(self.res_dict[k1][k2][k3][k4][k5][k6]['f1']), 4)
def add_avg_metrics_splits(self):
res_dict_across_splits = {}
for k1 in self.res_dict.keys():
if k1 not in res_dict_across_splits.keys():
res_dict_across_splits[k1] = {}
for k2 in self.res_dict[k1].keys():
if k2 not in res_dict_across_splits[k1].keys():
res_dict_across_splits[k1][k2] = {}
for k3 in self.res_dict[k1][k2].keys():
if k3 not in res_dict_across_splits[k1][k2].keys():
res_dict_across_splits[k1][k2][k3] = {}
for k4 in self.res_dict[k1][k2][k3].keys():
if k4 not in res_dict_across_splits[k1][k2][k3].keys():
res_dict_across_splits[k1][k2][k3][k4] = {}
for k5 in self.res_dict[k1][k2][k3][k4].keys():
if k5 not in res_dict_across_splits[k1][k2][k3][k4].keys():
res_dict_across_splits[k1][k2][k3][k4][k5] = {}
tmp_acc, tmp_prec, tmp_rec, tmp_f1 = [], [], [], []
for k6 in self.res_dict[k1][k2][k3][k4][k5].keys():
tmp_acc.append(self.res_dict[k1][k2][k3][k4][k5][k6]['avg_acc'])
tmp_prec.append(self.res_dict[k1][k2][k3][k4][k5][k6]['avg_prec'])
tmp_rec.append(self.res_dict[k1][k2][k3][k4][k5][k6]['avg_rec'])
tmp_f1.append(self.res_dict[k1][k2][k3][k4][k5][k6]['avg_f1'])
res_dict_across_splits[k1][k2][k3][k4][k5]['avg_acc_across_splits'] = round(np.mean(tmp_acc), 4)
res_dict_across_splits[k1][k2][k3][k4][k5]['avg_prec_across_splits'] = round(np.mean(tmp_prec), 4)
res_dict_across_splits[k1][k2][k3][k4][k5]['avg_rec_across_splits'] = round(np.mean(tmp_rec), 4)
res_dict_across_splits[k1][k2][k3][k4][k5]['avg_f1_across_splits'] = round(np.mean(tmp_f1), 4)
return res_dict_across_splits
def save_res_dict(self):
with open(self.output_path + 'overall_results.json', 'w') as outfile:
json.dump(self.res_dict, outfile)
with open(self.output_path + 'overall_results_across_splits.json', 'w') as outfile:
json.dump(self.res_dict_across_splits, outfile)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--saved_models_path", default='../saved_models/use_case_428_427/', type=str, required=False,
help = "The path of the saved models.")
parser.add_argument("--output_path", default='../saved_models/use_case_428_427/', type=str, required=False,
help = "The output path for storing the aggregated results.")
args = parser.parse_args()
obj = Search(args.saved_models_path,
args.output_path)
obj.save_res_dict() | 7,050 | 54.960317 | 147 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/1_graph_transformation.py | import os
import argparse
from helper import save_json
from rdflib import Graph
class GraphModUndirected:
def __init__(self, file_path, context_flag, graph_version):
self.file_path = file_path
self.context_flag = context_flag
self.init_graph = self.get_graph()
self.triplet_dict = self.get_triplet_dict()
if graph_version == 1:
self.transformed_graph = self.get_transformed_graph_1()
elif graph_version == 2:
self.transformed_graph = self.get_transformed_graph_2()
elif graph_version == 3:
self.transformed_graph = self.get_transformed_graph_3()
elif graph_version == 4:
self.transformed_graph = self.get_transformed_graph_4()
def get_graph(self):
g = Graph()
g.parse(self.file_path)
return g
def get_triplet_dict(self):
triplet_dict = {}
for s, p, o in self.init_graph.triples((None, None, None)):
k = s.toPython().split('/')[-2] + '_' + s.toPython().split('/')[-1]
if k not in triplet_dict.keys():
try:
relation = p.toPython().split('/')[-1]
object = o.toPython().split('/')[-1]
triplet_dict[k] = {'relations': [relation],
'objects': [object]}
except:
relation = p.toPython().split('/')[-1]
object = o.split('/')[-1]
triplet_dict[k] = {'relations': [relation],
'objects': [object]}
else:
try:
relation = p.toPython().split('/')[-1]
object = o.toPython().split('/')[-1]
triplet_dict[k]['relations'].append(relation)
triplet_dict[k]['objects'].append(object)
except:
relation = p.toPython().split('/')[-1]
object = o.split('/')[-1]
triplet_dict[k]['relations'].append(relation)
triplet_dict[k]['objects'].append(object)
for k in triplet_dict.keys():
t = k.split('_')[0]
for o in triplet_dict[k]['objects']:
if o == 'procedure_provisioning' or o == 'medication_provisioning':
t += '_'
t += o
triplet_dict[k]['type'] = t
return triplet_dict
def get_transformed_graph_1(self):
bag_of_triplets = []
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasMaritalStatus',
(ms_status.replace('_', ' '), 'marital_status', 'marital_status')))
else:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasMaritalStatus',
('unknown', 'marital_status', 'marital_status')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'followsReligion',
(religion.replace('_', ' '), 'religion', 'religion')))
else:
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'followsReligion', ('unknown', 'religion', 'religion')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasRaceorEthnicity',
(race.replace('_', ' '), 'race', 'race')))
else:
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'hasRaceorEthnicity', ('unknown', 'race', 'race')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasGender',
(gender.replace('_', ' '), 'gender', 'gender')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'belongsToAgeGroup',
(age_group.replace('_', ' '), 'age_group', 'age_group')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'hasDisease', (disease_name, 'disease', 'disease')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasIntervention',
(inter_name, 'procedure_' + o, 'procedure')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasIntervention',
(inter_name, 'procedure_' + o, 'procedure')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasIntervention',
(inter_name, 'procedure_medication', 'procedure')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasSocialContext', (
social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'social_context')))
return bag_of_triplets
def get_transformed_graph_2(self):
bag_of_triplets = []
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
(ms_status.replace('_', ' '), 'marital_status', 'demographic_info')))
else:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
('unknown', 'marital_status', 'demographic_info')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
(religion.replace('_', ' '), 'religion', 'demographic_info')))
else:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
('unknown', 'religion', 'demographic_info')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
(race.replace('_', ' '), 'race', 'demographic_info')))
else:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
('unknown', 'race', 'demographic_info')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
(gender.replace('_', ' '), 'gender', 'demographic_info')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasDemographics',
(age_group.replace('_', ' '), 'age_group', 'demographic_infop')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'hasDisease', (disease_name, 'disease', 'disease')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasIntervention',
(inter_name, 'procedure_' + o, 'procedure')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasIntervention',
(inter_name, 'procedure_' + o, 'procedure')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasIntervention',
(inter_name, 'procedure_medication', 'procedure')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'hasSocialContext', (
social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'social_context')))
return bag_of_triplets
def get_transformed_graph_3(self):
bag_of_triplets = []
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has',
(ms_status.replace('_', ' '), 'marital_status', 'info')))
else:
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', ('unknown', 'marital_status', 'info')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has',
(religion.replace('_', ' '), 'religion', 'info')))
else:
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', ('unknown', 'religion', 'info')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (race.replace('_', ' '), 'race', 'info')))
else:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has', ('unknown', 'race', 'info')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (gender.replace('_', ' '), 'gender', 'info')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (age_group.replace('_', ' '), 'age_group', 'info')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (disease_name, 'disease', 'info')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (inter_name, 'procedure_' + o, 'info')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (inter_name, 'procedure_' + o, 'info')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(
(('patient', 'patient', 'patient'), 'has', (inter_name, 'procedure_medication', 'info')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has',
(social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'info')))
return bag_of_triplets
def get_transformed_graph_4(self):
bag_of_triplets = []
if self.context_flag['demographics']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has', ('demographics', 'demographics', 'group_node')))
if self.context_flag['diseases']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has', ('diseases', 'diseases', 'group_node')))
if self.context_flag['interventions']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has', ('interventions', 'interventions', 'group_node')))
if self.context_flag['social_info']:
bag_of_triplets.append((('patient', 'patient', 'patient'), 'has', ('social context', 'social_context', 'group_node')))
if self.context_flag['interventions_procedure_CPT']:
bag_of_triplets.append((('interventions', 'interventions', 'group_node'), 'has', ('procedure provisioning CPT', 'procedure_provisioning_CPT', 'group_node')))
if self.context_flag['interventions_procedure_ICD9']:
bag_of_triplets.append((('interventions', 'interventions', 'group_node'), 'has', ('procedure provisioning ICD9', 'procedure_provisioning_ICD9', 'group_node')))
if self.context_flag['interventions_medication']:
bag_of_triplets.append((('interventions', 'interventions', 'group_node'), 'has', ('medication provisioning', 'medication_provisioning', 'group_node')))
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasMaritalStatus', (ms_status.replace('_', ' '), 'marital_status', 'marital_status')))
else:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasMaritalStatus', ('unknown', 'marital_status', 'marital_status')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'followsReligion', (religion.replace('_', ' '), 'religion', 'religion')))
else:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'followsReligion', ('unknown', 'religion', 'religion')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasRaceorEthnicity', (race.replace('_', ' '), 'race', 'race')))
else:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasRaceorEthnicity', ('unknown', 'race', 'race')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasGender', (gender.replace('_', ' '), 'gender', 'gender')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_node = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('age_in_years')]
# Corner-case in Mimic: Patients, that are 89 years old or older, are masked. The masked age is over 300 years.
if int(age_node) >= 300:
age_node = '300'
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'has', (age_node, 'age', 'group_node')))
stage_of_life = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasStageOfLife')]
bag_of_triplets.append(((age_node, 'age', 'group_node'), 'hasStageOfLife', (stage_of_life.replace('_', ' '), 'stage_of_life', 'stage_of_life')))
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append(((age_node, 'age', 'group_node'), 'belongsToAgeGroup', (age_group.replace('_', ' '), 'age_group', 'age_group')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append((('diseases', 'diseases', 'group_node'), 'hasDisease', (disease_name, 'disease', 'disease')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('procedure provisioning ' + o, 'procedure_provisioning_' + o, 'group_node'), 'hasIntervention', (inter_name, 'procedure_' + o, 'procedure_' + o)))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('procedure provisioning ' + o, 'procedure_provisioning_' + o, 'group_node'), 'hasIntervention', (inter_name, 'procedure_' + o, 'procedure_' + o)))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('medication provisioning', 'medication_provisioning', 'group_node'), 'hasIntervention', (inter_name, 'procedure_medication', 'procedure_medication')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append((('social context', 'social_context', 'group_node'), 'hasSocialContext', (social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'social_context')))
return bag_of_triplets
class GraphModDirected:
def __init__(self, file_path, context_flag, graph_version):
self.file_path = file_path
self.context_flag = context_flag
self.init_graph = self.get_graph()
self.triplet_dict = self.get_triplet_dict()
if graph_version == 1:
self.transformed_graph = self.get_transformed_graph_1()
elif graph_version == 2:
self.transformed_graph = self.get_transformed_graph_2()
elif graph_version == 3:
self.transformed_graph = self.get_transformed_graph_3()
elif graph_version == 4:
self.transformed_graph = self.get_transformed_graph_4()
def get_graph(self):
g = Graph()
g.parse(self.file_path)
return g
def get_triplet_dict(self):
triplet_dict = {}
for s, p, o in self.init_graph.triples((None, None, None)):
k = s.toPython().split('/')[-2] + '_' + s.toPython().split('/')[-1]
if k not in triplet_dict.keys():
try:
relation = p.toPython().split('/')[-1]
object = o.toPython().split('/')[-1]
triplet_dict[k] = {'relations': [relation],
'objects': [object]}
except:
relation = p.toPython().split('/')[-1]
object = o.split('/')[-1]
triplet_dict[k] = {'relations': [relation],
'objects': [object]}
else:
try:
relation = p.toPython().split('/')[-1]
object = o.toPython().split('/')[-1]
triplet_dict[k]['relations'].append(relation)
triplet_dict[k]['objects'].append(object)
except:
relation = p.toPython().split('/')[-1]
object = o.split('/')[-1]
triplet_dict[k]['relations'].append(relation)
triplet_dict[k]['objects'].append(object)
for k in triplet_dict.keys():
t = k.split('_')[0]
for o in triplet_dict[k]['objects']:
if o == 'procedure_provisioning' or o == 'medication_provisioning':
t += '_'
t += o
triplet_dict[k]['type'] = t
return triplet_dict
def get_transformed_graph_1(self):
bag_of_triplets = []
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append(((ms_status.replace('_', ' '), 'marital_status', 'marital_status'),
'hasMaritalStatus', ('patient', 'patient', 'patient')))
else:
bag_of_triplets.append((('unknown', 'marital_status', 'marital_status'), 'hasMaritalStatus',
('patient', 'patient', 'patient')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append(((religion.replace('_', ' '), 'religion', 'religion'), 'followsReligion',
('patient', 'patient', 'patient')))
else:
bag_of_triplets.append(
(('unknown', 'religion', 'religion'), 'followsReligion', ('patient', 'patient', 'patient')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append(((race.replace('_', ' '), 'race', 'race'), 'hasRaceorEthnicity',
('patient', 'patient', 'patient')))
else:
bag_of_triplets.append(
(('unknown', 'race', 'race'), 'hasRaceorEthnicity', ('patient', 'patient', 'patient')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append(((gender.replace('_', ' '), 'gender', 'gender'), 'hasGender',
('patient', 'patient', 'patient')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append((
(age_group.replace('_', ' '), 'age_group', 'age_group'), 'belongsToAgeGroup',
('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append(
((disease_name, 'disease', 'disease'), 'hasDisease', ('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(((inter_name, 'procedure_' + o, 'procedure'), 'hasIntervention',
('patient', 'patient', 'patient')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(((inter_name, 'procedure_' + o, 'procedure'), 'hasIntervention',
('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(((inter_name, 'procedure_medication', 'procedure'), 'hasIntervention',
('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append(((social_context.replace('_', ' '), self.triplet_dict[k]['type'],
'social_context'), 'hasSocialContext', ('patient', 'patient', 'patient')))
return bag_of_triplets
def get_transformed_graph_2(self):
bag_of_triplets = []
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append(((ms_status.replace('_', ' '), 'marital_status', 'demographic_info'),
'hasDemographics', ('patient', 'patient', 'patient')))
else:
bag_of_triplets.append((('unknown', 'marital_status', 'demographic_info'), 'hasDemographics',
('patient', 'patient', 'patient')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append(((religion.replace('_', ' '), 'religion', 'demographic_info'),
'hasDemographics', ('patient', 'patient', 'patient')))
else:
bag_of_triplets.append((('unknown', 'religion', 'demographic_info'), 'hasDemographics',
('patient', 'patient', 'patient')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append(((race.replace('_', ' '), 'race', 'demographic_info'), 'hasDemographics',
('patient', 'patient', 'patient')))
else:
bag_of_triplets.append((('unknown', 'race', 'demographic_info'), 'hasDemographics',
('patient', 'patient', 'patient')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append(((gender.replace('_', ' '), 'gender', 'demographic_info'), 'hasDemographics',
('patient', 'patient', 'patient')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append(((age_group.replace('_', ' '), 'age_group', 'demographic_info'),
'hasDemographics', ('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append(
(('diseases', 'diseases', 'diseases'), 'hasDisease', (disease_name, 'disease', 'disease')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(((inter_name, 'procedure_' + o, 'procedure'), 'hasIntervention',
('interventions', 'interventions', 'interventions')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(((inter_name, 'procedure_' + o, 'procedure'), 'hasIntervention',
('interventions', 'interventions', 'interventions')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(((inter_name, 'procedure_medication', 'procedure'), 'hasIntervention',
('interventions', 'interventions', 'interventions')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append(((social_context.replace('_', ' '), self.triplet_dict[k]['type'],
'social_context'), 'hasSocialContext', ('patient', 'patient', 'patient')))
return bag_of_triplets
def get_transformed_graph_3(self):
bag_of_triplets = []
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append(((ms_status.replace('_', ' '), 'marital_status', 'info'), 'has',
('patient', 'patient', 'patient')))
else:
bag_of_triplets.append(
(('unknown', 'marital_status', 'info'), 'has', ('patient', 'patient', 'patient')))
# Add religion
religion = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append(((religion.replace('_', ' '), 'religion', 'info'), 'has',
('patient', 'patient', 'patient')))
else:
bag_of_triplets.append(
(('unknown', 'religion', 'info'), 'has', ('patient', 'patient', 'patient')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append(
((race.replace('_', ' '), 'race', 'info'), 'has', ('patient', 'patient', 'patient')))
else:
bag_of_triplets.append((('unknown', 'race', 'info'), 'has', ('patient', 'patient', 'patient')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append(
((gender.replace('_', ' '), 'gender', 'info'), 'has', ('patient', 'patient', 'patient')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_group = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append(
((age_group.replace('_', ' '), 'age_group', 'info'), 'has', ('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append(
((disease_name, 'disease', 'info'), 'has', ('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(
((inter_name, 'procedure_' + o, 'info'), 'has', ('patient', 'patient', 'patient')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(
((inter_name, 'procedure_' + o, 'info'), 'has', ('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][
self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append(
((inter_name, 'procedure_medication', 'info'), 'has', ('patient', 'patient', 'patient')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append(((social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'info'),
'has', ('patient', 'patient', 'patient')))
return bag_of_triplets
def get_transformed_graph_4(self):
bag_of_triplets = []
if self.context_flag['demographics']:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'has', ('patient', 'patient', 'patient')))
if self.context_flag['diseases']:
bag_of_triplets.append((('diseases', 'diseases', 'group_node'), 'has', ('patient', 'patient', 'patient')))
if self.context_flag['interventions']:
bag_of_triplets.append((('interventions', 'interventions', 'group_node'), 'has', ('patient', 'patient', 'patient')))
if self.context_flag['social_info']:
bag_of_triplets.append((('social context', 'social_context', 'group_node'), 'has', ('patient', 'patient', 'patient')))
if self.context_flag['interventions_procedure_CPT']:
bag_of_triplets.append((('procedure provisioning CPT', 'procedure_provisioning_CPT', 'group_node'), 'has', ('interventions', 'interventions', 'group_node')))
if self.context_flag['interventions_procedure_ICD9']:
bag_of_triplets.append((('procedure provisioning ICD9', 'procedure_provisioning_ICD9', 'group_node'), 'has', ('interventions', 'interventions', 'group_node')))
if self.context_flag['interventions_medication']:
bag_of_triplets.append((('medication provisioning', 'medication_provisioning', 'group_node'), 'has', ('interventions', 'interventions', 'group_node')))
for k in self.triplet_dict.keys():
if self.triplet_dict[k]['type'] == 'patient':
if self.context_flag['demographics']:
# Add marital status
ms_status = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasMaritalStatus')]
if ms_status != 'marital_state_unknown':
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasMaritalStatus', (ms_status.replace('_', ' '), 'marital_status', 'marital_status')))
bag_of_triplets.append(((ms_status.replace('_', ' '), 'marital_status', 'marital_status'), 'rev_hasMaritalStatus', ('demographics', 'demographics', 'group_node')))
else:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasMaritalStatus', ('unknown', 'marital_status', 'marital_status')))
bag_of_triplets.append((('unknown', 'marital_status', 'marital_status'), 'rev_hasMaritalStatus', ('demographics', 'demographics', 'group_node')))
# Add religion
religion = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('followsReligion')]
if religion not in ['religion_unknown', 'other_religion']:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'followsReligion', (religion.replace('_', ' '), 'religion', 'religion')))
bag_of_triplets.append(((religion.replace('_', ' '), 'religion', 'religion'), 'rev_followsReligion', ('demographics', 'demographics', 'group_node')))
else:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'followsReligion', ('unknown', 'religion', 'religion')))
bag_of_triplets.append((('unknown', 'religion', 'religion'), 'rev_followsReligion', ('demographics', 'demographics', 'group_node')))
# Add race/ethnicity
race = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasRaceorEthnicity')]
if race not in ['race_not_stated', 'race_unknown']:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasRaceorEthnicity', (race.replace('_', ' '), 'race', 'race')))
bag_of_triplets.append(((race.replace('_', ' '), 'race', 'race'), 'rev_hasRaceorEthnicity', ('demographics', 'demographics', 'group_node')))
else:
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasRaceorEthnicity', ('unknown', 'race', 'race')))
bag_of_triplets.append((('unknown', 'race', 'race'), 'rev_hasRaceorEthnicity', ('demographics', 'demographics', 'group_node')))
# Add gender
gender = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasGender')]
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'hasGender', (gender.replace('_', ' '), 'gender', 'gender')))
bag_of_triplets.append(((gender.replace('_', ' '), 'gender', 'gender'), 'rev_hasGender', ('demographics', 'demographics', 'group_node')))
# Add age
if self.triplet_dict[k]['type'] == 'age':
if self.context_flag['demographics']:
age_node = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('age_in_years')]
# Corner-case in Mimic: Patients, that are 89 years old or older, are masked. The masked age is over 300 years.
if int(age_node) >= 300:
age_node = '300'
bag_of_triplets.append((('demographics', 'demographics', 'group_node'), 'has', (age_node, 'age', 'group_node')))
bag_of_triplets.append(((age_node, 'age', 'group_node'), 'rev_has', ('demographics', 'demographics', 'group_node')))
stage_of_life = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('hasStageOfLife')]
bag_of_triplets.append(((age_node, 'age', 'group_node'), 'hasStageOfLife', (stage_of_life.replace('_', ' '), 'stage_of_life', 'stage_of_life')))
bag_of_triplets.append(((stage_of_life.replace('_', ' '), 'stage_of_life', 'stage_of_life'), 'rev_hasStageOfLife', (age_node, 'age', 'group_node')))
age_group = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('belongsToAgeGroup')]
bag_of_triplets.append(((age_node, 'age', 'group_node'), 'belongsToAgeGroup', (age_group.replace('_', ' '), 'age_group', 'age_group')))
bag_of_triplets.append(((age_group.replace('_', ' '), 'age_group', 'age_group'), 'rev_belongsToAgeGroup', (age_node, 'age', 'group_node')))
if self.triplet_dict[k]['type'] == 'disease':
if self.context_flag['diseases']:
disease_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('disease_name')]
bag_of_triplets.append((('diseases', 'diseases', 'group_node'), 'hasDisease', (disease_name, 'disease', 'disease')))
bag_of_triplets.append(((disease_name, 'disease', 'disease'), 'rev_hasDisease', ('diseases', 'diseases', 'group_node')))
if self.triplet_dict[k]['type'] == 'intervention_procedure_provisioning':
for o in self.triplet_dict[k]['objects']:
if o == 'CPT':
if self.context_flag['interventions_procedure_CPT']:
inter_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('procedure provisioning ' + o, 'procedure_provisioning_' + o, 'group_node'), 'hasIntervention', (inter_name, 'procedure_' + o, 'procedure_' + o)))
bag_of_triplets.append(((inter_name, 'procedure_' + o, 'procedure_' + o), 'rev_hasIntervention', ('procedure provisioning ' + o, 'procedure_provisioning_' + o, 'group_node')))
elif o == 'ICD9':
if self.context_flag['interventions_procedure_ICD9']:
inter_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('procedure provisioning ' + o, 'procedure_provisioning_' + o, 'group_node'), 'hasIntervention', (inter_name, 'procedure_' + o, 'procedure_' + o)))
bag_of_triplets.append(((inter_name, 'procedure_' + o, 'procedure_' + o), 'rev_hasIntervention', ('procedure provisioning ' + o, 'procedure_provisioning_' + o, 'group_node')))
if self.triplet_dict[k]['type'] == 'intervention_medication_provisioning':
if self.context_flag['interventions_medication']:
inter_name = self.triplet_dict[k]['objects'][self.triplet_dict[k]['relations'].index('intervention_name')]
bag_of_triplets.append((('medication provisioning', 'medication_provisioning', 'group_node'), 'hasIntervention', (inter_name, 'procedure_medication', 'procedure_medication')))
bag_of_triplets.append(((inter_name, 'procedure_medication', 'procedure_medication'), 'rev_hasIntervention', ('medication provisioning', 'medication_provisioning', 'group_node')))
if self.triplet_dict[k]['type'] in ['employment', 'household', 'housing']:
if self.context_flag['social_info']:
social_context = k.split('_')[-1]
bag_of_triplets.append((('social context', 'social_context', 'group_node'), 'hasSocialContext', (
social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'social_context')))
bag_of_triplets.append(((social_context.replace('_', ' '), self.triplet_dict[k]['type'], 'social_context'), 'hasSocialContext', ('social context', 'social_context', 'group_node')))
return bag_of_triplets
class GraphTransformation:
def __init__(self, input_path, context_flag, output_path, directed, graph_version):
self.input_path = input_path
self.context_flag = context_flag
self.output_path = output_path
if not os.path.exists(self.output_path):
os.makedirs(self.output_path)
self.directed = directed
self.graph_version = graph_version
self.graph_file_paths = self.find_ttl_files()
def find_ttl_files(self):
files = []
for file in os.listdir(self.input_path):
if file.endswith(".ttl"):
files.append(os.path.join(self.input_path, file))
return files
def extraction(self):
c = 0
for f in self.graph_file_paths:
if self.directed:
save_json(GraphModDirected(f, self.context_flag, self.graph_version).transformed_graph, self.output_path + f.split('/')[-1].split('.')[0] + '.json')
else:
save_json(GraphModUndirected(f, self.context_flag, self.graph_version).transformed_graph, self.output_path + f.split('/')[-1].split('.')[0] + '.json')
c += 1
if c % 5000 == 0:
print('{} graphs were processed' .format(c))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--input_path", default='../../../hspo-kg-builder/kg-generation/mimic/PKG/grouped_icd9/nodes_with_textual_description/with_new_URI/', type=str, required=True,
help = "The input path with the ontology-mapped graphs.")
parser.add_argument("--output_path", default='data/triplet_format_graphs/', type=str, required=False,
help = "The path for storing the transformed graphs.")
parser.add_argument("--directed", default=None, type=int, required=True,
help = "Int value to define if the graph is going to be directed (1) or no. (0)")
parser.add_argument("--graph_version", default=None, type=int, required=True,
help = "An id to define the graph version that is going to be used.")
args = parser.parse_args()
context_flag = {'demographics': 1,
'diseases': 1,
'interventions': 1,
'interventions_procedure_CPT': 0,
'interventions_procedure_ICD9': 1,
'interventions_medication': 1,
'social_info': 1}
if args.directed:
full_output_path_0 = args.output_path + 'directed/0/' + 'v' + str(args.graph_version) + '/'
full_output_path_1 = args.output_path + 'directed/1/' + 'v' + str(args.graph_version) + '/'
else:
full_output_path_0 = args.output_path + 'undirected/0/' + 'v' + str(args.graph_version) + '/'
full_output_path_1 = args.output_path + 'undirected/1/' + 'v' + str(args.graph_version) + '/'
graph_0 = GraphTransformation(input_path = args.input_path + '0/',
context_flag = context_flag,
output_path = full_output_path_0,
directed = args.directed,
graph_version = args.graph_version)
graph_0.extraction()
graph_1 = GraphTransformation(input_path = args.input_path + '1/',
context_flag = context_flag,
output_path = full_output_path_1,
directed = args.directed,
graph_version = args.graph_version)
graph_1.extraction() | 58,295 | 67.422535 | 203 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/2_find_graphs_with_missing_info_v4.py | # This script is used to find graphs with missing information.
# To do that we need the first version of the undirected graphs.
# Information of interest that might be missing: diseases, medication, procedures.
import argparse
from helper import save_json, read_json, find_json_files
def find_graphs_with_missing_info(input_path):
unique_t = [["patient", "has", "demographics"],
["patient", "has", "diseases"],
["patient", "has", "interventions"],
["interventions", "has", "procedure_provisioning_ICD9"],
["interventions", "has", "medication_provisioning"],
["medication_provisioning", "hasIntervention", "procedure_medication"],
["demographics", "hasMaritalStatus", "marital_status"],
["demographics", "followsReligion", "religion"],
["demographics", "hasRaceorEthnicity", "race"],
["demographics", "hasGender", "gender"],
["diseases", "hasDisease", "disease"],
["procedure_provisioning_ICD9", "hasIntervention", "procedure_ICD9"],
["demographics", "has", "age"],
["age", "hasStageOfLife", "stage_of_life"],
["age", "belongsToAgeGroup", "age_group"]]
# Graphs with labels zero
black_list_graphs_0 = []
t_dict_0 = {}
for k in unique_t:
t_dict_0[k[0] + '_' + k[1] + '_' + k[2]] = 0
g0 = find_json_files(input_path + 'undirected/0/v4/')
for p in g0:
flag = 0
g = read_json(p)
uniq_tmp = []
for r in g:
if [r[0][1], r[1], r[2][1]] not in uniq_tmp:
uniq_tmp.append([r[0][1], r[1], r[2][1]])
for r in unique_t:
if r not in uniq_tmp:
t_dict_0[r[0] + '_' + r[1] + '_' + r[2]] += 1
flag = 1
if flag == 1:
black_list_graphs_0.append(p.split('/')[-1].split('.')[0])
# Graphs with labels zero
black_list_graphs_1 = []
t_dict_1 = {}
for k in unique_t:
t_dict_1[k[0] + '_' + k[1] + '_' + k[2]] = 0
g1 = find_json_files(input_path + 'undirected/1/v4/')
for p in g1:
flag = 0
g = read_json(p)
uniq_tmp = []
for r in g:
if [r[0][1], r[1], r[2][1]] not in uniq_tmp:
uniq_tmp.append([r[0][1], r[1], r[2][1]])
for r in unique_t:
if r not in uniq_tmp:
t_dict_1[r[0] + '_' + r[1] + '_' + r[2]] += 1
flag = 1
if flag == 1:
black_list_graphs_1.append(p.split('/')[-1].split('.')[0])
return t_dict_0, t_dict_1, black_list_graphs_0, black_list_graphs_1
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--input_path", default='data/triplet_format_graphs/', type=str, required=False,
help = "The input path with the graphs (version 4 undirected).")
args = parser.parse_args()
t_dict_0, t_dict_1, black_list_graphs_0, black_list_graphs_1 = find_graphs_with_missing_info(args.input_path)
save_json(t_dict_0, 'missing_info_dict_graph_0_v4_undirected.json')
save_json(t_dict_1, 'missing_info_dict_graph_1_v4_undirected.json')
save_json(black_list_graphs_0, 'missing_info_bl_graph_0_v4_undirected.json')
save_json(black_list_graphs_1, 'missing_info_bl_graph_1_v4_undirected.json') | 3,427 | 41.320988 | 113 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/3_vocabulary.py | import argparse
import os
from helper import read_json, save_json, find_json_files, filter_list, filter_list_2
from helper import InputFile
from spacy.lang.en import English
class Vocabulary:
def __init__(self, input_path_grouped_data, input_path_graphs, directed, graph_version, extra_filter):
# Take the files for the specific use case (428-->heart failure, 427-->dysrhythmia)
self.filenames_to_be_sampled = InputFile(input_path_grouped_data,
['428', '427'],
[['diagnoses', 'icd9_code'], ['diagnoses', 'icd9_code']]).key_list_or_operation
if directed:
self.graphs_0 = find_json_files(input_path_graphs + 'directed/0/v' + str(graph_version) + '/')
self.graphs_1 = find_json_files(input_path_graphs + 'directed/1/v' + str(graph_version) + '/')
else:
self.graphs_0 = find_json_files(input_path_graphs + 'undirected/0/v' + str(graph_version) + '/')
self.graphs_1 = find_json_files(input_path_graphs + 'undirected/1/v' + str(graph_version) + '/')
self.graphs_0_filtered_ = filter_list(self.graphs_0, self.filenames_to_be_sampled)
self.graphs_1_filtered_ = filter_list(self.graphs_1, self.filenames_to_be_sampled)
if extra_filter:
self.black_list_0 = read_json('missing_info_bl_graph_0_v4_undirected.json')
self.graphs_0_filtered = filter_list_2(self.graphs_0_filtered_, self.black_list_0)
self.black_list_1 = read_json('missing_info_bl_graph_1_v4_undirected.json')
self.graphs_1_filtered = filter_list_2(self.graphs_1_filtered_, self.black_list_1)
else:
self.graphs_0_filtered = self.graphs_0_filtered_
self.graphs_1_filtered = self.graphs_1_filtered_
self.nlp = English()
#self.nlp = spacy.load("en_core_sci_lg")
self.tokenizer = self.nlp.tokenizer
#self.tokenizer = Tokenizer(self.nlp.vocab)
self.rel_list, self.unique_rel_triplets, self.vocabulary, self.vocabulary_dict = self.get_vocabulary()
def get_vocabulary(self):
voc_list_1, rel_list, unique_rel_triplets = self.get_initial_voc_list()
voc_list_2 = self.tokenize_phrases(voc_list_1)
voc_list_3 = self.flatten_list(voc_list_2)
voc = self.create_dict(voc_list_3)
return rel_list, unique_rel_triplets, voc_list_3, voc
def get_initial_voc_list(self):
voc_list = []
rel_list = []
unique_rel_triplets = []
count = 0
for p in self.graphs_0_filtered:
f = read_json(p)
for t in f:
if t[0][0] not in voc_list:
voc_list.append(t[0][0].lower())
if t[2][0] not in voc_list:
voc_list.append(t[2][0].lower())
if t[1] not in rel_list:
rel_list.append(t[1])
if (t[0][2], t[1], t[2][2]) not in unique_rel_triplets:
unique_rel_triplets.append((t[0][2], t[1], t[2][2]))
count += 1
if (count % 1000) == 0:
print('{} graphs are processed' .format(count))
for p in self.graphs_1_filtered:
f = read_json(p)
for t in f:
if t[0][0] not in voc_list:
voc_list.append(t[0][0].lower())
if t[2][0] not in voc_list:
voc_list.append(t[2][0].lower())
if t[1] not in rel_list:
rel_list.append(t[1])
if (t[0][2], t[1], t[2][2]) not in unique_rel_triplets:
unique_rel_triplets.append((t[0][2], t[1], t[2][2]))
count += 1
if (count % 1000) == 0:
print('{} graphs are processed' .format(count))
return sorted(voc_list), rel_list, unique_rel_triplets
def tokenize_phrases(self, l):
l_tokenized = []
for p in l:
tokens = self.tokenizer(p)
l_tokenized.append([str(t) for t in tokens])
return l_tokenized
def flatten_list(self, l):
l_flattened = []
for p in l:
for w in p:
if w not in l_flattened and ' ' not in w:
l_flattened.append(w)
return sorted(l_flattened)
def create_dict(self, l):
dict_ = {}
c = 1
for w in l:
dict_[w] = c
c += 1
return dict_
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--input_path_grouped_data", default=None, type=str, required=True,
help = "The input path of the grouped json data after data preprocessing.")
parser.add_argument("--input_path_graphs", default='data/triplet_format_graphs/', type=str, required=False,
help = "The input path of the transformed graphs.")
parser.add_argument("--output_path", default='data/vocabularies/', type=str, required=False,
help = "The output path where the vocabularies are stored.")
parser.add_argument("--directed", default=None, type=int, required=True,
help = "Int value to define if the graph is going to be directed (1) or no (0).")
parser.add_argument("--graph_version", default=None, type=int, required=True,
help = "An id to define the graph version that is going to be used.")
parser.add_argument("--extra_filter", default=None, type=int, required=True,
help = "Int value to define if the graphs with missing info (medication or disease or procedure list) are going to be removed (1) or no (0).")
args = parser.parse_args()
voc = Vocabulary(args.input_path_grouped_data, args.input_path_graphs,
args.directed, args.graph_version, args.extra_filter)
if not os.path.exists(args.output_path):
os.makedirs(args.output_path)
if args.directed:
if args.extra_filter == 1:
save_json(voc.vocabulary, args.output_path + 'vocab_list_use_case_428_427_spacy_directed_v' + str(args.graph_version) + '_without_missing_info.json')
save_json(voc.vocabulary_dict, args.output_path + 'vocab_dict_use_case_428_427_spacy_directed_v' + str(args.graph_version) + '_without_missing_info.json')
else:
save_json(voc.vocabulary, args.output_path + 'vocab_list_use_case_428_427_spacy_directed_v' + str(args.graph_version) + '.json')
save_json(voc.vocabulary_dict, args.output_path + 'vocab_dict_use_case_428_427_spacy_directed_v' + str(args.graph_version) + '.json')
save_json(voc.rel_list, args.output_path + 'relation_labels_directed_v' + str(args.graph_version) + '.json')
save_json(voc.unique_rel_triplets, args.output_path + 'unique_rel_triplets_directed_v' + str(args.graph_version) + '.json')
else:
if args.extra_filter == 1:
save_json(voc.vocabulary, args.output_path + 'vocab_list_use_case_428_427_spacy_undirected_v' + str(args.graph_version) + '_without_missing_info.json')
save_json(voc.vocabulary_dict, args.output_path + 'vocab_dict_use_case_428_427_spacy_undirected_v' + str(args.graph_version) + '_without_missing_info.json')
else:
save_json(voc.vocabulary, args.output_path + 'vocab_list_use_case_428_427_spacy_undirected_v' + str(args.graph_version) + '.json')
save_json(voc.vocabulary_dict, args.output_path + 'vocab_dict_use_case_428_427_spacy_undirected_v' + str(args.graph_version) + '.json')
save_json(voc.rel_list, args.output_path + 'relation_labels_undirected_v' + str(args.graph_version) + '.json')
save_json(voc.unique_rel_triplets, args.output_path + 'unique_rel_triplets_undirected_v' + str(args.graph_version) + '.json')
| 7,974 | 50.785714 | 168 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/4_embedding_initialization.py | import argparse
import os
from spacy.lang.en import English
import numpy as np
from transformers import AutoTokenizer, AutoModel
import torch
from helper import read_json, save_json, find_json_files, filter_list, filter_list_2
from helper import InputFile
class Embeddings:
def __init__(self, emb_strategy, aggr_strategy='_', voc_path='_'):
if voc_path=='_':
self.len_v = 768
else:
self.voc = read_json(voc_path)
self.len_v = len(self.voc)
self.nlp = English()
self.emb_strategy = emb_strategy
if self.emb_strategy == 'bow':
self.tokenizer = self.nlp.tokenizer
elif self.emb_strategy == 'lm':
self.tokenizer_BioBERT = AutoTokenizer.from_pretrained("dmis-lab/biobert-v1.1")
self.BioBERT = AutoModel.from_pretrained("dmis-lab/biobert-v1.1")
self.BioBERT.to(device)
self.aggr_strategy = aggr_strategy
def process_graph(self, graph_path):
graph = read_json(graph_path)
emb_list = []
for t in graph:
if t[0][0] == 'unknown':
rep_s = np.zeros(self.len_v, dtype=int)
else:
if self.emb_strategy == 'bow':
s = self.tokenize_phrase(t[0][0])
rep_s = self.get_bow_rep(s)
elif self.emb_strategy == 'lm':
rep_s = self.get_LM_rep(t[0][0])
# If religion or race or marital status are unknown then initialize the node with a zero vector
if t[2][0] == 'unknown':
rep_o = np.zeros(self.len_v, dtype=int)
else:
if self.emb_strategy == 'bow':
o = self.tokenize_phrase(t[2][0])
rep_o = self.get_bow_rep(o)
elif self.emb_strategy == 'lm':
rep_o = self.get_LM_rep(t[2][0])
emb_list.append(((rep_s.tolist(), t[0][1], t[0][2]), t[1], (rep_o.tolist(), t[2][1], t[2][2])))
del graph
return emb_list
def tokenize_phrase(self, s):
tokens = self.tokenizer(s)
tokens_list = [str(t).lower() for t in tokens]
tokens_ready = []
for t in tokens_list:
if ' ' not in t:
tokens_ready.append(t)
return tokens_ready
def get_bow_rep(self, p):
bag_vector = np.zeros(len(self.voc), dtype=int)
for w in p:
bag_vector[self.voc.index(w)] += 1
return bag_vector
def get_LM_rep(self, p):
x = self.tokenizer_BioBERT(p, return_tensors='pt')
x.to(device)
x = self.BioBERT(**x)[0]
# If it is only one word, take its representation
if x[0].shape[0] == 3:
return x[0][1]
else:
if self.aggr_strategy == 'cls':
return x[0][0]
elif self.aggr_strategy == 'avg':
return torch.mean(x[0][1:-1], 0)
elif self.aggr_strategy == 'sum':
return torch.sum(x[0][1:-1], 0)
def extract_emb(input_path_grouped_data, input_path_graphs, output_path, directed,
graph_version, extra_filter, emb_strategy, aggr_strategy='_', vocab_path='_'):
emb = Embeddings(emb_strategy, aggr_strategy, vocab_path)
filenames_to_be_sampled = InputFile(input_path_grouped_data,
['428', '427'],
[['diagnoses', 'icd9_code'], ['diagnoses', 'icd9_code']]).key_list_or_operation
if directed:
graphs_0 = find_json_files(input_path_graphs + 'directed/0/v' + str(graph_version) + '/')
graphs_1 = find_json_files(input_path_graphs + 'directed/1/v' + str(graph_version) + '/')
else:
graphs_0 = find_json_files(input_path_graphs + 'undirected/0/v' + str(graph_version) + '/')
graphs_1 = find_json_files(input_path_graphs + 'undirected/1/v' + str(graph_version) + '/')
graphs_0_filtered_ = filter_list(graphs_0, filenames_to_be_sampled)
graphs_1_filtered_ = filter_list(graphs_1, filenames_to_be_sampled)
if extra_filter:
black_list_0 = read_json('missing_info_bl_graph_0_v4_undirected.json')
graphs_0_filtered = filter_list_2(graphs_0_filtered_, black_list_0)
black_list_1 = read_json('missing_info_bl_graph_1_v4_undirected.json')
graphs_1_filtered = filter_list_2(graphs_1_filtered_, black_list_1)
else:
graphs_0_filtered = graphs_0_filtered_
graphs_1_filtered = graphs_1_filtered_
c = 0
for p in graphs_0_filtered:
c += 1
emb_list = emb.process_graph(p)
if emb_strategy == 'bow':
if directed:
full_output_path = output_path + 'directed/0/' + emb_strategy + '/v' + str(graph_version) + '/'
else:
full_output_path = output_path + 'undirected/0/' + emb_strategy + '/v' + str(graph_version) + '/'
if not os.path.exists(full_output_path):
os.makedirs(full_output_path)
save_json(emb_list, full_output_path + p.split('/')[-1])
elif emb_strategy == 'lm':
if directed:
full_output_path = output_path + 'directed/0/' + emb_strategy + '/' + aggr_strategy + '/v' + str(graph_version) + '/'
else:
full_output_path = output_path + 'undirected/0/' + emb_strategy + '/' + aggr_strategy + '/v' + str(graph_version) + '/'
if not os.path.exists(full_output_path):
os.makedirs(full_output_path)
save_json(emb_list, full_output_path + p.split('/')[-1])
if c % 500 == 0:
print('{} graphs were processed' .format(c))
for p in graphs_1_filtered:
c += 1
emb_list = emb.process_graph(p)
if emb_strategy == 'bow':
if directed:
full_output_path = output_path + 'directed/1/' + emb_strategy + '/v' + str(graph_version) + '/'
else:
full_output_path = output_path + 'undirected/1/' + emb_strategy + '/v' + str(graph_version) + '/'
if not os.path.exists(full_output_path):
os.makedirs(full_output_path)
save_json(emb_list, full_output_path + p.split('/')[-1])
elif emb_strategy == 'lm':
if directed:
full_output_path = output_path + 'directed/1/' + emb_strategy + '/' + aggr_strategy + '/v' + str(graph_version) + '/'
else:
full_output_path = output_path + 'undirected/1/' + emb_strategy + '/' + aggr_strategy + '/v' + str(graph_version) + '/'
if not os.path.exists(full_output_path):
os.makedirs(full_output_path)
save_json(emb_list, full_output_path + p.split('/')[-1])
if c % 500 == 0:
print('{} graphs were processed' .format(c))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--input_path_grouped_data", default=None, type=str, required=True,
help = "The input path of the grouped json data after data preprocessing.")
parser.add_argument("--input_path_graphs", default='data/triplet_format_graphs/', type=str, required=False,
help = "The input path of the transformed graphs.")
parser.add_argument("--output_path", default='data/precalculated_embeddings/use_case_428_427/', type=str, required=False,
help = "The output path for storing the embeddings.")
parser.add_argument("--directed", default=None, type=int, required=True,
help = "Int value to define if the graph is going to be directed (1) or no (0).")
parser.add_argument("--graph_version", default=None, type=int, required=True,
help = "An id to define the graph version that is going to be used.")
parser.add_argument("--vocab_path", default=None, type=str, required=True,
help = "The path to vocabulary. It is needed if BOW strategy is applied.")
parser.add_argument("--extra_filter", default=None, type=int, required=True,
help = "Int value to define if the graphs with missing info (medication or disease or procedure list) are going to be removed (1) or no (0).")
parser.add_argument("--emb_strategy", default=None, type=str, required=True,
help = "The strategy for embedding initialization. Choices: bow, lm")
parser.add_argument("--aggr_strategy", default=None, type=str, required=False,
help = "The aggregation strategy for embedding initialization. Only applies for lm strategy. Choices: cls, avg, sum")
args = parser.parse_args()
# Define the device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
if args.emb_strategy == 'bow':
extract_emb(input_path_grouped_data=args.input_path_grouped_data,
input_path_graphs=args.input_path_graphs,
output_path=args.output_path,
directed=args.directed,
graph_version=args.graph_version,
extra_filter=args.extra_filter,
emb_strategy=args.emb_strategy,
vocab_path=args.vocab_path)
elif args.emb_strategy == 'lm':
extract_emb(input_path_grouped_data=args.input_path_grouped_data,
input_path_graphs=args.input_path_graphs,
output_path=args.output_path,
directed=args.directed,
graph_version=args.graph_version,
extra_filter=args.extra_filter,
emb_strategy=args.emb_strategy,
aggr_strategy=args.aggr_strategy)
else:
print('Invalid embedding strategy is given. Possible strategies: bow, lm')
| 9,937 | 47.009662 | 166 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/5_graph_preprocessing.py | import os
import argparse
import torch
import numpy as np
from torch_geometric.data import HeteroData
from helper import read_json, find_json_files
class GraphProc:
def __init__(self, graph_path, voc_path, unique_rel_triplets_path,
emb_strategy, label, output_path):
self.g = read_json(graph_path)
self.g_name = graph_path.split('/')[-1].split('.')[0]
self.label = label
self.emb_strategy = emb_strategy
self.output_path = output_path
self.unique_rel_triplets = read_json(unique_rel_triplets_path)
if voc_path=='_':
self.len_v = 768
else:
self.voc = read_json(voc_path)
self.len_v = len(self.voc)
#self.g_proc, self.valid = self.process()
self.g_proc = self.process()
def process(self):
g_conv = self.convert()
return g_conv
# Check if the graph is valid
#if g_conv.validate():
# return g_conv, 1
#else:
# print('The transformed graph is not valid.')
# return g_conv, 0
def convert(self):
dict_str = {}
dict_triplet_count = {}
for t_emb in self.g:
# Remember the triplet format: (embeddings, specific type, generic type)
# for example in directed graph version 4: (embeddings, marital_status, demographic_info)
k1_specific = t_emb[0][1]
k1_generic = t_emb[0][2]
k2_specific = t_emb[2][1]
k2_generic = t_emb[2][2]
if k1_generic not in dict_str.keys():
dict_str[k1_generic] = [t_emb[0][0]]
else:
# Avoid adding the same node twice.
if k1_specific not in ['patient', 'demographics', 'diseases', 'interventions', 'social_context',
'procedure_provisioning_ICD9', 'procedure_provisioning_CPT',
'medication_provisioning', 'age', 'marital_status', 'religion',
'race', 'gender', 'age_group', 'employment', 'housing', 'household']:
dict_str[k1_generic].append(t_emb[0][0])
if k2_generic not in dict_str.keys():
dict_str[k2_generic] = [t_emb[2][0]]
else:
if k2_specific not in ['patient', 'demographics', 'diseases', 'interventions', 'social_context',
'procedure_provisioning_ICD9', 'procedure_provisioning_CPT',
'medication_provisioning', 'age', 'marital_status', 'religion',
'race', 'gender', 'age_group', 'employment', 'housing', 'household']:
dict_str[k2_generic].append(t_emb[2][0])
if t_emb[0][2] + '_' + t_emb[1] + '_' + t_emb[2][2] not in dict_triplet_count.keys():
dict_triplet_count[t_emb[0][2] + '_' + t_emb[1] + '_' + t_emb[2][2]] = {'count': 1,
'triplet': (t_emb[0][2], t_emb[1], t_emb[2][2])}
else:
dict_triplet_count[t_emb[0][2] + '_' + t_emb[1] + '_' + t_emb[2][2]]['count'] += 1
for k in dict_triplet_count.keys():
s = dict_triplet_count[k]['triplet'][0]
o = dict_triplet_count[k]['triplet'][2]
s_count = len(dict_str[s])
o_count = len(dict_str[o])
rel_pairs = []
# If the node has an unknown value (then it is initiliazed with zeros vector) then the adj. matrix for the relation will be empty
if all(v == 0 for v in dict_str[o]):
dict_triplet_count[k]['COO_graph_connectivity'] = torch.LongTensor([[], []])
else:
for i1 in range(s_count):
for i2 in range(o_count):
rel_pairs.append([i1, i2])
# https://pytorch-geometric.readthedocs.io/en/latest/notes/introduction.html
#dict_triplet_count[k]['COO_graph_connectivity'] = torch.tensor(rel_pairs, dtype=torch.long).t().contiguous()
dict_triplet_count[k]['COO_graph_connectivity'] = torch.LongTensor(rel_pairs).t().contiguous()
# https://pytorch-geometric.readthedocs.io/en/latest/modules/data.html#torch_geometric.data.HeteroData
data = HeteroData()
for k in dict_str.keys():
data[k].x = torch.FloatTensor(dict_str[k])
rel_graph = []
for k in dict_triplet_count.keys():
t = dict_triplet_count[k]['triplet']
data[t[0], t[1], t[2]].edge_index = torch.LongTensor(dict_triplet_count[k]['COO_graph_connectivity'])
rel_graph.append([t[0], t[1], t[2]])
# Check if some relations are missing from the graph
# If this is the case add zero nodes and an empty adj. matrix
for rel in self.unique_rel_triplets:
if rel not in rel_graph:
if rel[0] not in dict_str.keys():
data[rel[0]].x = torch.FloatTensor([np.zeros(self.len_v, dtype=int).tolist()])
if rel[2] not in dict_str.keys():
data[rel[2]].x = torch.FloatTensor([np.zeros(self.len_v, dtype=int).tolist()])
data[rel[0], rel[1], rel[2]].edge_index = torch.LongTensor([[0], [0]])
#print(self.g_name)
#print(rel)
#data['patient'].y = torch.from_numpy(self.label).type(torch.long)
data['patient'].y = torch.from_numpy(self.label).type(torch.float)
return data
def save_graph(self):
if not os.path.exists(self.output_path):
os.makedirs(self.output_path)
torch.save(self.g_proc, self.output_path + self.g_name + '.pt')
#if self.valid:
# torch.save(self.g_proc, self.output_path + self.g_name + '.pt')
#else:
# print('Invalid graph')
def extract_graphs(files_path, voc_path, unique_rel_triplets_path,
emb_strategy, label, output_path):
graphs_emb = find_json_files(files_path)
for g_p_emb in graphs_emb:
g_obj = GraphProc(graph_path=g_p_emb,
voc_path=voc_path,
unique_rel_triplets_path=unique_rel_triplets_path,
emb_strategy=emb_strategy,
label=label,
output_path=output_path)
g_obj.save_graph()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--input_path_embeddings", default="data/precalculated_embeddings/use_case_428_427/", type=str, required=False,
help = "The input path of the precalculated embeddings.")
parser.add_argument("--vocab_path", default=None, type=str, required=False,
help = "The path of the vocabulary. It is needed if BOW strategy is applied.")
parser.add_argument("--unique_rel_triplets_path", default=None, type=str, required=True,
help = "The path of the list with the unique relation triplets.")
parser.add_argument("--emb_strategy", default=None, type=str, required=True,
help = "The strategy for embedding initialization. Choices: bow, lm")
parser.add_argument("--aggr_strategy", default=None, type=str, required=False,
help = "The aggregation strategy for embedding initialization. Only applies for lm strategy. Choices: cls, avg, sum")
parser.add_argument("--output_path", default="data/processed_graphs/use_case_428_427/", type=str, required=False,
help = "The output path for storing the processed graphs.")
parser.add_argument("--directed", default=None, type=int, required=True,
help = "Int value to define if the graph is going to be directed (1) or no (0).")
parser.add_argument("--graph_version", default=None, type=int, required=True,
help = "An id to define the graph version that is going to be used.")
args = parser.parse_args()
if args.directed:
if args.emb_strategy == 'bow':
final_input_path_embeddings_0 = args.input_path_embeddings + 'directed/0/' + args.emb_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_input_path_embeddings_1 = args.input_path_embeddings + 'directed/1/' + args.emb_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_output_path = args.output_path + 'directed/' + args.emb_strategy + '/' + 'v' + str(args.graph_version) + '/'
elif args.emb_strategy == 'lm':
final_input_path_embeddings_0 = args.input_path_embeddings + 'directed/0/' + args.emb_strategy + '/' + args.aggr_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_input_path_embeddings_1 = args.input_path_embeddings + 'directed/1/' + args.emb_strategy + '/' + args.aggr_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_output_path = args.output_path + 'directed/' + args.emb_strategy + '/' + args.aggr_strategy + '/' + 'v' + str(args.graph_version) + '/'
else:
if args.emb_strategy == 'bow':
final_input_path_embeddings_0 = args.input_path_embeddings + 'undirected/0/' + args.emb_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_input_path_embeddings_1 = args.input_path_embeddings + 'undirected/1/' + args.emb_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_output_path = args.output_path + 'undirected/' + args.emb_strategy + '/' + 'v' + str(args.graph_version) + '/'
elif args.emb_strategy == 'lm':
final_input_path_embeddings_0 = args.input_path_embeddings + 'undirected/0/' + args.emb_strategy + '/' + args.aggr_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_input_path_embeddings_1 = args.input_path_embeddings + 'undirected/1/' + args.emb_strategy + '/' + args.aggr_strategy + '/' + 'v' + str(args.graph_version) + '/'
final_output_path = args.output_path + 'undirected/' + args.emb_strategy + '/' + args.aggr_strategy + '/' + 'v' + str(args.graph_version) + '/'
# Label: 0
extract_graphs(files_path=final_input_path_embeddings_0,
voc_path=args.vocab_path,
unique_rel_triplets_path=args.unique_rel_triplets_path,
emb_strategy=args.emb_strategy,
label=np.array(0),
output_path=final_output_path)
# Label: 1
extract_graphs(files_path=final_input_path_embeddings_1,
voc_path=args.vocab_path,
unique_rel_triplets_path=args.unique_rel_triplets_path,
emb_strategy=args.emb_strategy,
label=np.array(1),
output_path=final_output_path)
| 11,030 | 55.569231 | 179 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/README.md | # Person-Centric Knowledge Graph Extraction using MIMIC-III dataset: An ICU-readmission prediction study
## Knowledge Graph Transformation
## Setup
### Requirements
- Python 3.7+
- rdflib (tested with version 6.1.1)
- spacy (tested with version 3.4.1)
- pytorch (tested with version 1.12.1)
- transformers (tested with version 4.21.2)
- tokenizers (tested with version 0.12.1)
- numpy (tested with version 1.23.2)
- pytorch_geometric (tested with version 2.1.0)
### Execution - Description
The generated Knowledge Graphs (kg-generation step) are in RDF format. So they have to be transformed in pytorch-geometric friendly format to be used for Graph Neural Network (GNN) training. In this implementation the extracted graphs, that contain URIs with textual description, are used (strategy 2 in kg-generation step). The following steps are required for the transformation:
- Run the ```1_graph_transformation.py --input_path --output_path --directed --graph_version``` script to transform the graphs from RDF format to triplet format. In total, there are 8 different graph versions, 4 undirected and 4 directed. Look to the corresponding paper (<i>Representation Learning for Person or Entity-centric Knowledge Graphs: an application in Healthcare</i>) for more information. Arguments:
- input_path: The input path with the ontology-mapped graphs.
- output_path: The path for storing the transformed graphs.
- directed: Int value to define if the graph is going to be directed (1) or no. (0)
- graph_version: The ID to define the graph version that is going to be used. Values: 1, 2, ...
- Run the ```2_find_graphs_with_missing_info_v1.py --input_path``` script to find graphs with missing information. Some of the records in MIMIC-III dataset are not complete. The fourth version of the undirected graphs is needed. The information of interest that might be missing is related to diseases, medication, and procedures. Arguments:
- input_path: The input path with the graphs. (e.g. <i>data/triplet_format_graphs/</i>)
- Run the ```3_vocabulary.py --input_path_grouped_data --input_path_graphs --output_path --directed --graph_version --extra_filter``` script to create the vocabulary. The use case with patients that have heart failure (ICD9 code: 428) or cardiac_dysrhythmias (ICD9 code: 427) has been predefined. Arguments:
- input_path_grouped_data: The input path of the grouped json data after data preprocessing (AKA <i>4_data_after_adding_notes_info_grouped_icd9.json</i>).
- input_path_graphs: The input path of the transformed graphs.
- output_path: The output path where the vocabularies are stored.
- directed: Value to define if the graph is going to be directed (1) or no (0).
- graph_version: The id to define the graph version that is going to be used.
- extra_filter: Value to define if the graphs with missing info (medication or disease or procedure list) are going to be removed (1) or no (0).
- Run the ```4_embedding_initialization.py --input_path_grouped_data --input_path_graphs --output_path --directed --graph_version --vocab_path --extra_filter --emb_strategy --aggr_strategy``` script to pre-compute and initialize the embeddings of every node in the graph. Arguments:
- input_path_grouped_data: The input path of the grouped json data after data preprocessing (AKA <i>4_data_after_adding_notes_info_grouped_icd9.json</i>).
- input_path_graphs: The input path of the transformed graphs.
- output_path: The output path where the embeddings are stored.
- directed: Value to define if the graph is going to be directed (1) or no (0).
- graph_version: The id to define the graph version that is going to be used.
- vocab_path: The path to vocabulary. It is needed if BOW strategy is applied.
- extra_filter: Value to define if the graphs with missing info (medication or disease or procedure list) are going to be removed (1) or no (0).
- emb_strategy: The strategy for embedding initialization. Choices: bow, lm. The BOW strategy corresponds to Bag-of-Words model \[1\]. The LM strategy corresponds to pre-trained BioBERT \[2\] usage.
- aggr_strategy: The aggregation strategy for embedding initialization. Only applies for lm strategy. Choices: cls, avg, sum
- Run the ```5_graph_preprocessing.py --input_path_embeddings --vocab_path --unique_rel_triplets_path --emb_strategy --aggr_strategy --output_path --directed --graph_version``` script to finally transform the graph in .pt format that can be used for GNN training using <a target="_blank" href="https://pytorch-geometric.readthedocs.io/en/latest/">PyTorch Geometric</a> framework. Arguments:
- input_path_embeddings: The input path of the precalculated embeddings.
- vocab_path: The path of the vocabulary. It is needed if BOW strategy is applied.
- unique_rel_triplets_path: The path of the list with the unique relation triplets. This file is created after the third step (vocabulary creation).
- emb_strategy: The strategy for embedding initialization. Choices: bow, lm
- aggr_strategy: The aggregation strategy for embedding initialization. Only applies for lm strategy. Choices: cls, avg, sum
- output_path: The output path where the processed graphs are going to be stored.
- directed: Value to define if the graph is going to be directed (1) or no (0).
- graph_version: The id to define the graph version that is going to be used.
A bash script (```run_graph_processing.sh [-h] [-g f v e p d o s a]```) to execute the full pipeline end-to-end is also available. The paths (input, output, conda source, conda environments) should be updated accordingly.
### Notes
- BioBERT is used as the selected Language Model in the embedding initialization step because of the medical domain (MIMIC-III) of the application. Different generic or domain-specific Language Models can be easily used for other applications.
## References
```
[1] Harris, Zellig S. "Distributional structure." Word 10.2-3 (1954): 146-162.
[2] Lee, Jinhyuk, et al. "BioBERT: a pre-trained biomedical language representation model for biomedical text mining." Bioinformatics 36.4 (2020): 1234-1240.
```
| 6,232 | 97.936508 | 412 | md |
null | hspo-ontology-main/kg-embedding/transformation/mimic/helper.py | import json
import os
def save_json(file, path):
with open(path, 'w') as outfile:
json.dump(file, outfile)
def find_json_files(folder_path):
files = []
for file in os.listdir(folder_path):
if file.endswith(".json"):
files.append(os.path.join(folder_path, file))
return files
def read_json(path):
with open(path) as json_file:
return json.load(json_file)
def filter_list(l, filenames):
l_filtered = []
for p in l:
if p.split('/')[-1].split('.')[0] in filenames:
l_filtered.append(p)
return l_filtered
def filter_list_2(l, black_list):
l_filtered = []
for p in l:
if p.split('/')[-1].split('.')[0] not in black_list:
l_filtered.append(p)
return l_filtered
class InputFile:
def __init__(self, input_path, query_codes, query_code_descriptions):
self.init_file = read_json(input_path)
self.query_codes = query_codes
self.query_code_descriptions = query_code_descriptions
self.sampled_file_and_operation, self.key_list_and_operation = self.get_sampled_file_and_operation()
self.sampled_file_or_operation, self.key_list_or_operation = self.get_sampled_file_or_operation()
del self.init_file
def get_sampled_file_and_operation(self):
sampled_dict = {}
key_list = []
for k1 in self.init_file.keys():
for k2 in self.init_file[k1].keys():
flag = 0
# Check if all the query codes exist in the record.
for i, q_c in enumerate(self.query_codes):
q_c_descr = self.query_code_descriptions[i]
if len(q_c_descr) == 1:
if not(q_c in self.init_file[k1][k2][q_c_descr[0]]):
flag = 1
elif len(q_c_descr) == 2:
if not(q_c in self.init_file[k1][k2][q_c_descr[0]][q_c_descr[1]]):
flag = 1
if flag == 0:
if k1 not in sampled_dict.keys():
sampled_dict[k1] = {}
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
else:
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
return sampled_dict, key_list
def get_sampled_file_or_operation(self):
sampled_dict = {}
key_list = []
for k1 in self.init_file.keys():
for k2 in self.init_file[k1].keys():
flag = 0
# Check if at least one of the query codes exists in the record.
for i, q_c in enumerate(self.query_codes):
q_c_descr = self.query_code_descriptions[i]
if len(q_c_descr) == 1:
if q_c in self.init_file[k1][k2][q_c_descr[0]]:
flag = 1
break
elif len(q_c_descr) == 2:
if q_c in self.init_file[k1][k2][q_c_descr[0]][q_c_descr[1]]:
flag = 1
break
if flag == 1:
if k1 not in sampled_dict.keys():
sampled_dict[k1] = {}
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
else:
sampled_dict[k1][k2] = self.init_file[k1][k2]
key_list.append(k1 + '_' + k2)
return sampled_dict, key_list | 3,696 | 36.343434 | 108 | py |
null | hspo-ontology-main/kg-embedding/transformation/mimic/run_graph_processing.sh | #!/bin/bash
############################################################
# Help #
############################################################
Help()
{
# Display Help
echo "Description of parameters."
echo
echo "Example: run_graph_processing.sh -g 1 -f 1 -v 1 -e 1 -p 1 -d 0 -o 1 -s 'bow' -a '_'"
echo "Parameters:"
echo "h Call the help function."
echo "g Run the 'graph_transformation' script. Values: 0 or 1"
echo "f Run the 'find_graphs_with_missing_info_v1' script. Values: 0 or 1"
echo "v Run the 'vocabulary' script. Values: 0 or 1"
echo "e Run the 'embedding_initialization' script. Values: 0 or 1"
echo "p Run the 'graph_preprocessing' script. Values: 0 or 1"
echo "d Directed (1) or Undected graph (0). Values: 0 or 1"
echo "o Graph version. Values: {1, 2, 3, 4, 5, 6, (7)}"
echo "s Embedding strategy. Values: 'bow' or 'lm'"
echo "a Aggregation strategy. Values: 'cls', 'avg', 'sum', '_'"
}
usage="$(basename "$0") [-h] [-g f v e p d o s a] -- program to run the graph processing pipeline"
if [ "$1" == "-h" ] ; then
echo "$usage"
Help
exit 0
fi
# A string with command options
options=$@
while getopts g:f:v:e:p:d:o:s:a: options
do
case "${options}" in
g) graph_transformation=${OPTARG};;
f) finding_missing_info=${OPTARG};;
v) vocabulary_creation=${OPTARG};;
e) emb_extraction=${OPTARG};;
p) graph_preprocessing=${OPTARG};;
d) directed=${OPTARG};;
o) graph_version=${OPTARG};;
s) emb_strategy=${OPTARG};;
a) aggr_strategy=${OPTARG};;
esac
done
source /opt/share/anaconda3-2019.03/x86_64/etc/profile.d/conda.sh
conda activate conda_envs/rdflib
if [ $graph_transformation -eq 1 ]
then
echo 'Graph transformation is starting ...'
input_path_graph_transformation='data/with_new_URI/'
output_path_graph_transformation='data/triplet_format_graphs/'
python 1_graph_transformation.py --input_path $input_path_graph_transformation --output_path $output_path_graph_transformation --directed $directed --graph_version $graph_version
echo 'Graph transformation is completed.'
fi
if [ $finding_missing_info -eq 1 ]
then
if [ $directed -eq 0 ] && [ $graph_version -eq 1 ]
then
input_path_missing_info='data/triplet_format_graphs/'
python 2_find_graphs_with_missing_info_v4.py --input_path $input_path_missing_info
fi
fi
conda deactivate
conda activate conda_envs/spacy
if [ $vocabulary_creation -eq 1 ]
then
echo 'Vocabulary creation is starting ...'
input_path_grouped_data='../../../hspo-kg-builder/data-lifting/mimic/data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json'
input_path_graphs='data/triplet_format_graphs/'
extra_filter=1
python 3_vocabulary.py --input_path_grouped_data $input_path_grouped_data --input_path_graphs $input_path_graphs --directed $directed --graph_version $graph_version --extra_filter $extra_filter
echo 'Vocabulary creation is completed.'
fi
if [ $emb_extraction -eq 1 ]
then
echo 'Embedding initialization is starting ...'
input_path_grouped_data='../../../hspo-kg-builder/data-lifting/mimic/data/processed_data/4_data_after_adding_notes_info_grouped_icd9.json'
input_path_graphs='data/triplet_format_graphs/'
output_path_emb='data/precalculated_embeddings/use_case_428_427/'
extra_filter=1
if [ $directed -eq 1 ]
then
vocab_path='data/vocabularies/vocab_list_use_case_428_427_spacy_directed_v'${graph_version}'_without_missing_info.json'
else
vocab_path='data/vocabularies/vocab_list_use_case_428_427_spacy_undirected_v'${graph_version}'_without_missing_info.json'
fi
python 4_embedding_initialization.py --input_path_grouped_data $input_path_grouped_data --input_path_graphs $input_path_graphs --output_path $output_path_emb --directed $directed --graph_version $graph_version --vocab_path $vocab_path --extra_filter $extra_filter --emb_strategy $emb_strategy --aggr_strategy $aggr_strategy
echo 'Embedding initialization is completed.'
fi
conda deactivate
conda activate conda_envs/pytorch
if [ $graph_preprocessing -eq 1 ]
then
echo 'Graph preprocessing is starting ...'
if [ $directed -eq 1 ]
then
unique_rel_triplets_path='data/vocabularies/unique_rel_triplets_directed_v'${graph_version}'.json'
else
unique_rel_triplets_path='data/vocabularies/unique_rel_triplets_undirected_v'${graph_version}'.json'
fi
output_path_emb='data/precalculated_embeddings/use_case_428_427/'
output_path_processed_graphs='data/processed_graphs/use_case_428_427/'
if [ $emb_strategy = 'bow' ]
then
if [ $directed -eq 1 ]
then
vocab_path='data/vocabularies/vocab_list_use_case_428_427_spacy_directed_v'${graph_version}'_without_missing_info.json'
else
vocab_path='data/vocabularies/vocab_list_use_case_428_427_spacy_undirected_v'${graph_version}'_without_missing_info.json'
fi
else
vocab_path='_'
fi
python 5_graph_preprocessing.py --input_path_embeddings $output_path_emb --vocab_path $vocab_path --unique_rel_triplets_path $unique_rel_triplets_path --emb_strategy $emb_strategy --aggr_strategy $aggr_strategy --output_path $output_path_processed_graphs --directed $directed --graph_version $graph_version
echo 'Graph preprocessing is completed.'
fi | 5,503 | 38.314286 | 328 | sh |
IID_representation_learning | IID_representation_learning-master/README.md | # IID representation learning
Official PyTorch implementation for the following manuscript:
[Towards IID representation learning and its application on biomedical data](https://openreview.net/forum?id=qKZH_U-tn9P), MIDL 2022. \
Jiqing Wu, Inti Zlobec, Maxime W Lafarge, Yukun He and Viktor Koelzer.
> Due to the heterogeneity of real-world data, the widely accepted independent and identically distributed (IID) assumption has been criticized in recent studies on causality. In this paper, we argue that instead of being a questionable assumption, IID is a fundamental task-relevant property that needs to be learned.
> Consider k independent random vectors <img src="https://latex.codecogs.com/png.image?\dpi{110}%20\mathsf{X}^{i%20=%201,%20\ldots,%20k}" />, We elaborate on how a variety of different causal questions can be reformulated to learning a task-relevant function <img src="https://latex.codecogs.com/png.image?\dpi{110}%20\phi" /> that induces IID among <img src="https://latex.codecogs.com/png.image?\dpi{110}%20\mathsf{Z}^i%20:=%20%20\phi%20\circ%20\mathsf{X}^i" />, which we term IID representation learning.
>
> For proof of concept, we examine the IID representation learning on Out-of-Distribution (OOD) generalization tasks. Concretely, by utilizing the representation obtained via the learned function that induces IID, we conduct prediction of molecular characteristics (molecular prediction) on two biomedical datasets with real-world distribution shifts introduced by a) preanalytical variation and b) sampling protocol. To enable reproducibility and for comparison to the state-of-the-art (SOTA) methods, this is done by following the OOD benchmarking guidelines recommended from WILDS. Compared to the SOTA baselines supported in WILDS, the results confirm the superior performance of IID representation learning on OOD tasks.
<p align="center">
<img src="visual/arch.png" width="800px"/>
<br>
The overall model illustrations of the proposed IID representation learning.
Left: Restyle Encoder and StyleGAN Decoder.
Right: The downstream molecular predictor (ERM + IID representation).
</p>
<a href="https://openreview.net/pdf?id=qKZH_U-tn9P"><img src="https://img.shields.io/badge/MIDL2022-OpenReview-brightgreen" height=22.5></a> \
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" height=22.5></a>
## WILDS Leaderboard
<a href="https://wilds.stanford.edu/leaderboard/#rxrx1"><img src="https://img.shields.io/badge/WILDS-RxRx1-purple.svg" height=22.5></a>
## Installation
This implementation is mainly dependent on two backends: [Restyle](https://https://github.com/yuval-alaluf/restyle-encoder) and [WILDS](https://github.com/p-lambda/wilds). This suggests that, if the dependencies for Restyle and Wilds are installed, then the environment of our code is correctly configured.
**Prerequisites**
This implementation has been successfully tested under the following configurations,
meanwhile the version range in the parentheses could also work:
- Ubuntu 20.04 (>=18.04)
- Nvidia driver 470.86 (>=450.xx)
- CUDA 11.3 (>=11.0)
- Python 3.9 (>=3.7)
- Miniconda
- Docker
- Nvidia-Docker2
After the prerequisites are satisfied, you could either build the docker image
or install conda dependencies.
**Docker Installation**
Assume Docker and Nvidia-Docker2 toolkit are correctly installed, build the Docker image as follows
```
cd /Path/To/IID_representation_learning/
docker build -t iid .
```
**Conda Installation**
Assume a local Conda environment is installed and activated,
assume CUDA is installed to the /usr/local/cuda folder (Please do not install CUDA locally as suggested by PyTorch Conda installation, this may cause errors when StyleGAN calls ninja package.),
install the dependencies as follows
```
pip install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip install wilds matplotlib opencv-python ninja
```
You could also try creating a conda environment from [environment.yml](environment.yml).
## Data Preparation
To run the experiments investigated in the paper, we need to download the RxRx1 dataset and some pretrained models
1. Download RxRx1
```
git clone https://github.com/p-lambda/wilds.git
cd wilds/
python wilds/download_datasets.py --root_dir /Path/To/Data --datasets rxrx1
```
2. Create [restyle/pretrained_models/](restyle/pretrained_models/) folder and download the following models to this folder
- [MOCO](https://drive.google.com/file/d/1LUvNGzcGpQHS0K9vdSmk4_0RVQSU9zxE/view?usp=sharing)
- [StyleGAN](https://drive.google.com/file/d/1iY4mKzInyNGBOY8z1P2FtnfCx966DSfa/view?usp=sharing)
- [Restyle auto-encoder](https://drive.google.com/file/d/1B_uNnrhhxWHW571-N0eD02lRmVnkgzAN/view?usp=sharing)
## Run the Experiments
In case of using Docker image, you could first launch the Docker image
**Launch the Docker Image**
```
sudo docker run -it \
# this folder stores the pretrained weights of some standard backbones
# that may be used during training
-v /Path/To/.cache/torch/hub/checkpoints:/root/.cache/torch/hub/checkpoints/ \
-v /Path/To/IID_representation_learning:/root/IID_representation_learning \
-v /Path/To/Data:/root/Data \
--gpus '"device=0"' iid
```
**The Training of Molecular Prediction**
```
cd /Path/To/IID_representation_learning/
python main.py -m train \
-e 150 \
--seed 0 \
--lr cosine,1.5e-4,90,6e-5,150,0 \
--backbone resnet50 \
--data_type rxrx1 \
--classes 1139 \
--split_scheme official \
--batch_size 24 \
--eval_batch_size 64 \
--data /Path/To/Data/ \
--save /Path/To/Save/ \
--checkpoint_path restyle/pretrained_models/ --save-model --loss-coef 0.15 --noise --style
```
**The Training of IID representation (Restyle auto-encoder)**
First, add the data path string '/Path/to/Training/Data' to `dataset_paths['wilds']` in [restyle/configs/paths_config.py](https://github.com/CTPLab/IID_representation_learning/blob/b0003b563cfcb9fe69147fff878ce6cd7f8ebea2/restyle/configs/paths_config.py#L17), then run
```
cd /Path/To/IID_representation_learning/restyle
python scripts/train_restyle_psp.py \
--dataset_type=rxrx1 \
--split_scheme=official \
--encoder_type=ResNetBackboneEncoder \
--exp_dir=/Path/To/Output \
--workers=8 \
--batch_size=8 \
--test_batch_size=8 \
--test_workers=8 \
--max_steps=100000 \
--val_interval=5000 \
--image_interval=5000 \
--save_interval=10000 \
--start_from_latent_avg \
--lpips_lambda=0.2 \
--l2_lambda=5 \
--w_norm_lambda=0 \
--id_lambda=0 \
--moco_lambda=0.2 \
--input_nc=6 \
--n_iters_per_batch=1 \
--output_size=256 \
--stylegan_weights=pretrained_models/rxrx1_100000.pt
```
**The Training of StyleGAN**
See https://github.com/rosinality/stylegan2-pytorch for more details about creating the lmdb datasets with 256X256 resolution (such as RxRx1) and running the training script.
## Visualization
**The Image Synthesis of StyleGAN**
```
cd /Path/To/IID_representation_learning/
python main.py -m synth \
--data_type rxrx1 \
--classes 1139 \
--split_scheme official \
--batch_size 32 \
--data /Path/To/Data/ \
--save /Path/To/Save/ \
--checkpoint_path restyle/pretrained_models/
```
<p align="center">
<img src="visual/fake.jpg" width="800px"/>
<br>
Nonexistent fluorescence images synthesized by StyleGAN learned with RxRx1 training
data.
</p>
**The Reconstruction of Restyle Auto-encoder**
```
cd /Path/To/IID_representation_learning/
python main.py -m recon \
--data_type rxrx1 \
--classes 1139 \
--split_scheme official \
--batch_size 16 \
--eval_batch_size 16 \
--data /Path/To/Data/ \
--save /Path/To/Save/ \
--checkpoint_path restyle/pretrained_models/
```
<p align="center">
<img src="visual/recon.png" width="800px"/>
<br>
The visual comparison between ground-truth (red bounding
box) and reconstructed RxRx1 images. After running the above implementation, additional post-processing steps are requried to normalize the
images along each channel and zoom in on a small region for better visualization.
</p>
## Acknowledgments
This implementation is built upon [Restyle](https://https://github.com/yuval-alaluf/restyle-encoder) and [WILDS](https://github.com/p-lambda/wilds) projects.
Besides, our code borrows from [kaggle-rcic-1st](https://github.com/maciej-sypetkowski/kaggle-rcic-1st). We would like to convey our gratitudes to all the authors working on those projects.
| 9,009 | 43.60396 | 726 | md |
IID_representation_learning | IID_representation_learning-master/args.py | import random
from argparse import ArgumentParser
from pathlib import Path
def lr_type(x):
x = x.split(',')
return x[0], list(map(float, x[1:]))
def parse_args():
parser = ArgumentParser()
# basic training hyper-parameters
parser.add_argument('--seed',
type=int,
default=0,
help='global seed (for weight initialization, data sampling, etc.). '
'If not specified it will be randomized (and printed on the log)')
parser.add_argument('-m', '--mode',
default='train',
choices=('train', 'evaluate', 'recon', 'synth'))
parser.add_argument('-e', '--epochs',
default=150,
type=int)
parser.add_argument('--lr',
type=lr_type,
default=('cosine', [1.5e-4]),
help='learning rate values and schedule given in format: schedule,value1,epoch1,value2,epoch2,...,value{n}. '
'in epoch range [0, epoch1) initial_lr=value1, in [epoch1, epoch2) initial_lr=value2, ..., '
'in [epoch{n-1}, total_epochs) initial_lr=value{n}, '
'in every range the same learning schedule is used. Possible schedules: cosine, const')
parser.add_argument('--backbone',
default='resnet50')
# data related hyper-parameters
parser.add_argument('--data',
type=Path,
help='path to the data root.')
parser.add_argument('--data_type',
type=str,
choices=['rxrx1', 'scrc'],
help='experiments to run')
parser.add_argument('--split_scheme',
type=str,
choices=['official', '012', '120', '201'],
help='official for rxrx1, the rests for scrc')
parser.add_argument('--classes',
type=int,
help='number of classes predicting by the network')
parser.add_argument('--batch_size',
type=int,
default=24)
parser.add_argument('--eval_batch_size',
type=int,
default=32)
parser.add_argument('--num-data-workers',
type=int,
default=10,
help='number of data loader workers')
# model related hyper-parameters
parser.add_argument('--save',
type=str,
help='path for the checkpoint with best accuracy. '
'Checkpoint for each epoch will be saved with suffix .<number of epoch>')
parser.add_argument('--save-model',
action='store_true',
help='if true, save trained model')
parser.add_argument('--checkpoint_path',
default=None,
type=str,
help='Path to ReStyle model checkpoint')
parser.add_argument('--load',
type=str,
help='path to the checkpoint which will be loaded for prediction or fine-tuning')
# other relevant hyper-parameters
parser.add_argument('--noise',
action='store_true',
help='if true, then inject the noise latent to the model')
parser.add_argument('--style',
action='store_true',
help='if true, then inject the style latent to the model')
parser.add_argument('--noise-drop',
type=float,
default=0.5,
help='noise dropout probability')
parser.add_argument('--style-drop',
type=float,
default=0.5,
help='style dropout probability')
parser.add_argument('--cutmix',
type=float,
default=1,
help='parameter for beta distribution. 0 means no cutmix')
parser.add_argument('--loss-coef',
type=float,
default=0.2,
help='the loss coefficient balancing the CrossEntropy and ArcFace loss')
parser.add_argument('--embedding-size',
type=int,
default=1024)
parser.add_argument('--bn-mom',
type=float,
default=0.05)
parser.add_argument('--weight-decay',
type=float,
default=1e-5)
parser.add_argument('--gradient-accumulation',
type=int,
default=2,
help='number of iterations for gradient accumulation')
parser.add_argument('--pw-aug',
type=lambda x: tuple(map(float, x.split(','))),
default=(0.1, 0.1),
help='pixel-wise augmentation in format (scale std, bias std). scale will be sampled from N(1, scale_std) '
'and bias from N(0, bias_std) for each channel independently')
parser.add_argument('--scale-aug',
type=float,
default=0.5,
help='zoom augmentation. Scale will be sampled from uniform(scale, 1). '
'Scale is a scale for edge (preserving aspect)')
parser.add_argument('--start-epoch',
type=int,
default=0)
parser.add_argument('--pred-suffix',
default='',
help='suffix for prediction output. '
'Predictions output will be stored in <loaded checkpoint path>.output<pred suffix>')
parser.add_argument('--disp-batches',
type=int,
default=50,
help='frequency (in iterations) of printing statistics of training / inference '
'(e.g., accuracy, loss, speed)')
args = parser.parse_args()
assert args.save is not None
if args.mode == 'predict':
assert args.load is not None
if args.seed is None:
args.seed = random.randint(0, 10 ** 9)
return args
| 6,484 | 43.115646 | 133 | py |
IID_representation_learning | IID_representation_learning-master/dataset.py | import cv2
import numpy as np
import random
import torch
import torchvision.transforms.functional as F
from torchvision import transforms
from wilds import get_dataset
from wilds.common.data_loaders import get_train_loader, get_eval_loader
def initialize_transform(args, is_training):
""" Initialize the transformation functions for
rxrx1 and scrc.
Args:
args: critical parameters specified in args.py
is_train: whether is training or evaluation
"""
if args.data_type == 'rxrx1':
return initialize_rxrx1_transform(args, is_training)
elif args.data_type == 'scrc':
return initialize_scrc_transform(is_training)
else:
raise ValueError(f"{args.data_type} not recognized")
def initialize_rxrx1_transform(args, is_training):
""" Initialize the rxrx1 transformation.
Args:
args: critical parameters specified in args.py
is_train: whether is training or evaluation
"""
def trn_transform(image):
image = np.asarray(image.convert('RGB'))
if random.random() < 0.5:
image = image[:, ::-1, :]
if random.random() < 0.5:
image = image[::-1, :, :]
if random.random() < 0.5:
image = image.transpose([1, 0, 2])
image = np.ascontiguousarray(image)
if args.scale_aug != 1:
size = random.randint(round(256 * args.scale_aug), 256)
x = random.randint(0, 256 - size)
y = random.randint(0, 256 - size)
image = image[x:x + size, y:y + size]
image = cv2.resize(image, (256, 256),
interpolation=cv2.INTER_NEAREST)
return image
if is_training:
transforms_ls = [
transforms.Lambda(lambda x: trn_transform(x)),
transforms.ToTensor()]
else:
transforms_ls = [
transforms.ToTensor()]
transform = transforms.Compose(transforms_ls)
return transform
def initialize_scrc_transform(is_training):
""" Initialize the scrc transformation.
Args:
is_train: whether is training or evaluation
"""
angles = [0, 90, 180, 270]
def random_rotation(x: torch.Tensor) -> torch.Tensor:
angle = angles[torch.randint(low=0, high=len(angles), size=(1,))]
if angle > 0:
x = F.rotate(x, angle)
return x
if is_training:
transforms_ls = [
transforms.Lambda(lambda x: random_rotation(x)),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
]
else:
transforms_ls = [
transforms.ToTensor(),
]
transform = transforms.Compose(transforms_ls)
return transform
def get_dataloader(args):
""" Get wilds dataloader.
rxrx1: get train, val, test(ood_test), id_test
dataloader splitted the wilds official split scheme
scrc0,1,2: get train, val, test(ood_test)
dataloader splitted with the cutomized wilds scrc0,1,2 split scheme
Args:
args: critical parameters specified in args.py
"""
dataset = get_dataset(dataset=args.data_type,
root_dir=args.data,
split_scheme=args.split_scheme)
trn_data = dataset.get_subset('train',
transform=initialize_transform(args, True))
val_data = dataset.get_subset('val',
transform=initialize_transform(args, False))
tst_data = dataset.get_subset('test',
transform=initialize_transform(args, False))
trn_loader = get_train_loader('standard',
trn_data,
batch_size=args.batch_size,
**{'drop_last': True,
'num_workers': args.num_data_workers,
'worker_init_fn': worker_init_fn,
'pin_memory': True})
val_loader = get_eval_loader('standard',
val_data,
batch_size=args.eval_batch_size,
**{'drop_last': False,
'num_workers': args.num_data_workers,
'worker_init_fn': worker_init_fn,
'pin_memory': True})
tst_loader = get_eval_loader('standard',
tst_data,
batch_size=args.eval_batch_size,
**{'drop_last': False,
'num_workers': args.num_data_workers,
'worker_init_fn': worker_init_fn,
'pin_memory': True})
dt_loader = [trn_loader, val_loader, tst_loader]
if args.data_type == 'rxrx1':
id_tst_data = dataset.get_subset('id_test',
transform=initialize_transform(args, False))
id_tst_loader = get_eval_loader('standard',
id_tst_data,
batch_size=args.eval_batch_size,
**{'drop_last': False,
'num_workers': args.num_data_workers,
'worker_init_fn': worker_init_fn,
'pin_memory': True})
dt_loader.append(id_tst_loader)
return dt_loader
def worker_init_fn(worker_id):
np.random.seed(random.randint(0, 10 ** 9) + worker_id)
| 5,692 | 35.261146 | 85 | py |
IID_representation_learning | IID_representation_learning-master/environment.yml | name: iid
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=4.5=1_gnu
- blas=1.0=mkl
- bottleneck=1.3.2=py39hdd57654_1
- brotli=1.0.9=he6710b0_2
- ca-certificates=2021.10.26=h06a4308_2
- certifi=2021.10.8=py39h06a4308_0
- cudatoolkit=11.3.1=h2bc3f7f_2
- cycler=0.11.0=pyhd3eb1b0_0
- dbus=1.13.18=hb2f20db_0
- expat=2.4.1=h2531618_2
- fontconfig=2.13.1=h6c09931_0
- fonttools=4.25.0=pyhd3eb1b0_0
- freetype=2.11.0=h70c0345_0
- giflib=5.2.1=h7b6447c_0
- glib=2.69.1=h5202010_0
- gst-plugins-base=1.14.0=h8213a91_2
- gstreamer=1.14.0=h28cd5cc_2
- icu=58.2=he6710b0_3
- intel-openmp=2021.4.0=h06a4308_3561
- jpeg=9d=h7f8727e_0
- kiwisolver=1.3.1=py39h2531618_0
- lcms2=2.12=h3be6417_0
- ld_impl_linux-64=2.35.1=h7274673_9
- libffi=3.3=he6710b0_2
- libgcc-ng=9.3.0=h5101ec6_17
- libgomp=9.3.0=h5101ec6_17
- libpng=1.6.37=hbc83047_0
- libstdcxx-ng=9.3.0=hd4cf53a_17
- libtiff=4.2.0=h85742a9_0
- libuuid=1.0.3=h7f8727e_2
- libwebp=1.2.0=h89dd481_0
- libwebp-base=1.2.0=h27cfd23_0
- libxcb=1.14=h7b6447c_0
- libxml2=2.9.12=h03d6c58_0
- lz4-c=1.9.3=h295c915_1
- matplotlib=3.5.0=py39h06a4308_0
- matplotlib-base=3.5.0=py39h3ed280b_0
- mkl=2021.4.0=h06a4308_640
- mkl-service=2.4.0=py39h7f8727e_0
- mkl_fft=1.3.1=py39hd3c417c_0
- mkl_random=1.2.2=py39h51133e4_0
- munkres=1.1.4=py_0
- ncurses=6.3=h7f8727e_2
- numexpr=2.8.1=py39h6abb31d_0
- numpy=1.21.2=py39h20f2e39_0
- numpy-base=1.21.2=py39h79a1101_0
- olefile=0.46=pyhd3eb1b0_0
- openssl=1.1.1l=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pandas=1.3.4=py39h8c16a72_0
- pcre=8.45=h295c915_0
- pillow=8.4.0=py39h5aabda8_0
- pip=21.2.4=py39h06a4308_0
- plotly=5.1.0=pyhd3eb1b0_0
- psutil=5.8.0=py39h27cfd23_1
- pyparsing=3.0.4=pyhd3eb1b0_0
- pyqt=5.9.2=py39h2531618_6
- python=3.9.7=h12debd9_1
- python-dateutil=2.8.2=pyhd3eb1b0_0
- pytz=2021.3=pyhd3eb1b0_0
- qt=5.9.7=h5867ecd_1
- readline=8.1=h27cfd23_0
- setuptools=58.0.4=py39h06a4308_0
- sip=4.19.13=py39h2531618_0
- six=1.15.0=py39h06a4308_0
- sqlite=3.37.0=hc218d9a_0
- tenacity=8.0.1=py39h06a4308_0
- tk=8.6.11=h1ccaba5_0
- tornado=6.1=py39h27cfd23_0
- tzdata=2021e=hda174b7_0
- wheel=0.37.0=pyhd3eb1b0_1
- xz=5.2.5=h7b6447c_0
- zlib=1.2.11=h7f8727e_4
- zstd=1.4.9=haebb681_0
- pip:
- absl-py==1.0.0
- argon2-cffi==21.3.0
- argon2-cffi-bindings==21.2.0
- attrs==21.4.0
- autopep8==1.6.0
- backcall==0.2.0
- bleach==4.1.0
- cachetools==4.2.4
- cffi==1.15.0
- charset-normalizer==2.0.9
- colorlover==0.3.0
- cufflinks==0.17.3
- debugpy==1.5.1
- decorator==5.1.0
- defusedxml==0.7.1
- entrypoints==0.3
- google-auth==2.3.3
- google-auth-oauthlib==0.4.6
- googledrivedownloader==0.4
- grpcio==1.43.0
- idna==3.3
- importlib-metadata==4.10.0
- ipykernel==6.6.0
- ipython==7.30.1
- ipython-genutils==0.2.0
- ipywidgets==7.6.5
- isodate==0.6.1
- jedi==0.18.1
- jinja2==3.0.3
- joblib==1.1.0
- jsonschema==4.3.2
- jupyter-client==7.1.0
- jupyter-core==4.9.1
- jupyterlab-pygments==0.1.2
- jupyterlab-widgets==1.0.2
- littleutils==0.2.2
- markdown==3.3.6
- markupsafe==2.0.1
- matplotlib-inline==0.1.3
- mistune==0.8.4
- nbclient==0.5.9
- nbconvert==6.3.0
- nbformat==5.1.3
- nest-asyncio==1.5.4
- networkx==2.6.3
- ninja==1.10.2.3
- notebook==6.4.6
- oauthlib==3.1.1
- ogb==1.3.2
- opencv-python==4.5.5.62
- outdated==0.2.1
- pandocfilters==1.5.0
- parso==0.8.3
- pexpect==4.8.0
- pickleshare==0.7.5
- prometheus-client==0.12.0
- prompt-toolkit==3.0.24
- protobuf==3.19.1
- ptyprocess==0.7.0
- pyasn1==0.4.8
- pyasn1-modules==0.2.8
- pycodestyle==2.8.0
- pycparser==2.21
- pygments==2.10.0
- pyrsistent==0.18.0
- pyyaml==6.0
- pyzmq==22.3.0
- rdflib==6.1.1
- requests==2.27.0
- requests-oauthlib==1.3.0
- rsa==4.8
- scikit-learn==1.0.2
- scipy==1.7.3
- send2trash==1.8.0
- tensorboard==2.7.0
- tensorboard-data-server==0.6.1
- tensorboard-plugin-wit==1.8.0
- terminado==0.12.1
- testpath==0.5.0
- threadpoolctl==3.0.0
- toml==0.10.2
- torch==1.10.1+cu113
- torch-geometric==2.0.3
- torch-scatter==2.0.9
- torchaudio==0.10.1+cu113
- torchvision==0.11.2+cu113
- tqdm==4.62.3
- traitlets==5.1.1
- typing-extensions==4.0.1
- urllib3==1.26.7
- wcwidth==0.2.5
- webencodings==0.5.1
- werkzeug==2.0.2
- widgetsnbextension==3.5.2
- wilds==2.0.0
- yacs==0.1.8
- zipp==3.7.0
prefix: ~/miniconda3/envs/iid
| 4,753 | 25.558659 | 41 | yml |
IID_representation_learning | IID_representation_learning-master/main.py | #!/usr/bin/env python3
import logging
import csv
import time
import torch
import torchvision.utils as tv_utils
import numpy as np
from argparse import Namespace
from pathlib import Path
import dataset as dataset
from args import parse_args
from restyle.models.psp import pSp
from model import ModelAndLoss
from util import transform_input, get_learning_rate, setup_logging, setup_determinism, compute_avg_img
@torch.no_grad()
def infer(args,
data_loader,
model,
restyle,
avg_img,
csvwriter=None):
""" The model inference during the training
Args:
args: critical parameters specified in args.py
data_loader: the val, test (ood_test) or id_test data loader
called via wilds api
model: the molecular prediction model
restyle: the trained Restyle auto-encoder
avg_img: the average image that appends to the input image of
Restyle auto-encoder
csvwriter: the csvwriter buffer for recording the results
line by line, the saved csv is compatible to wilds evaluation
"""
model.eval()
tic = time.time()
# the dict storing the data numbers for each group type
grp_num = dict()
# the dict storing the correct predictions for each group type
grp_cor = dict()
# the total correct predictions
correct = 0.
# the total amount of data
total = 0.
for i, (X, Y, meta) in enumerate(data_loader):
X = X.cuda()
X = transform_input(args, X, Y,
is_train=False,
restyle=restyle,
avg_img=avg_img)[0]
y = model.eval_forward(X).cpu()
correct += (y.argmax(dim=-1) == Y).sum().numpy()
total += Y.shape[0]
# record the wilds compatible predicted class
# line by line
if csvwriter is not None:
csv_res = np.expand_dims(y.argmax(dim=-1).numpy(), axis=1)
csvwriter.writerows(csv_res.tolist())
# record the stratified results based on cell type for rxrx1
# and tumor regions for scrc
groups = meta[:, 0] if args.data_type == 'rxrx1' else Y
for id, grp in enumerate(groups):
grp = int(grp.numpy())
if grp not in grp_num:
grp_num[grp] = 0
if grp not in grp_cor:
grp_cor[grp] = 0
grp_num[grp] += 1
grp_cor[grp] += (y[id].argmax() == Y[id]).numpy()
if (i + 1) % args.disp_batches == 0:
logging.info('Infer Iter: {:4d} -> speed: {:6.1f}'.format(
i + 1, args.disp_batches * args.eval_batch_size / (time.time() - tic)))
tic = time.time()
msg = 'Eval: acc: '
tot_num = 0
tot_cor = 0
for grp in sorted(grp_num.keys()):
num = grp_num[grp]
cor = grp_cor[grp]
tot_num += num
tot_cor += cor
msg += '{}: {:6f}| '.format(grp, cor / num)
acc = tot_cor / tot_num
acc1 = correct / total
# acc and acc1 should be identical
# tot_num and total should be identical
# just for sanity check
logging.info(
msg + '({:.2%}), ({:.2%}), {}, {}'.format(acc, acc1, tot_num, total))
return acc
def train(args,
data_loader,
model,
restyle,
avg_img):
""" The model inference during the training
Args:
args: critical parameters specified in args.py
data_loader: the train, val, test (ood_test) or id_test data loader
called via wilds api
model: the molecular prediction model
restyle: the trained Restyle auto-encoder
avg_img: the average image that appends to the input image of
Restyle auto-encoder
"""
# split the data_loader list
train_loader, val_loader, test_loader = data_loader[0], data_loader[1], data_loader[2]
msg = 'Data size for Train: {}, Val: {}, Test: {}'.format(len(train_loader),
len(val_loader),
len(test_loader))
if args.data_type == 'rxrx1':
id_test_loader = data_loader[3]
msg += ' ID_Test: {}'.format(len(id_test_loader))
logging.info(msg)
optimizer = torch.optim.Adam(model.parameters(),
lr=0,
weight_decay=args.weight_decay)
if args.load is not None:
best_acc = infer(args,
val_loader,
model,
restyle,
avg_img)
else:
best_acc = 0
acc_test = 0
for epoch in range(args.start_epoch, args.epochs):
logging.info('Train: epoch {}'.format(epoch))
model.train()
optimizer.zero_grad()
cum_loss = 0
cum_acc = 0
cum_count = 0
tic = time.time()
# train the model for one epoch
for i, (X, Y, meta) in enumerate(train_loader):
# update the learning rate for each step
lr = get_learning_rate(args.lr,
args.epochs,
epoch + i / len(train_loader))
for g in optimizer.param_groups:
g['lr'] = lr
X = X.cuda()
Y = Y.cuda()
X, Y = transform_input(args, X, Y,
is_train=True,
restyle=restyle,
avg_img=avg_img)
loss, acc = model.train_forward(X, Y)
loss.backward()
if (i + 1) % args.gradient_accumulation == 0:
optimizer.step()
optimizer.zero_grad()
cum_count += 1
cum_loss += loss.item()
cum_acc += acc
if (i + 1) % args.disp_batches == 0:
logging.info('Epoch: {:3d} Iter: {:4d} -> speed: {:6.1f} lr: {:.9f} loss: {:.6f} acc: {:.6f}'.format(
epoch, i + 1, cum_count * args.batch_size /
(time.time() - tic), optimizer.param_groups[0]['lr'],
cum_loss / cum_count, cum_acc / cum_count))
cum_loss = 0
cum_acc = 0
cum_count = 0
tic = time.time()
# run the inference stage
acc = infer(args,
val_loader,
model,
restyle,
avg_img)
if acc > best_acc:
best_acc = acc
logging.info('Saving best to {} with score {}'.
format(args.save_dir, best_acc))
if args.save_model:
torch.save(model.state_dict(),
str(Path(args.save_dir) / 'best_{}.pth'.format(epoch)))
acc_test = infer(args,
test_loader,
model,
restyle,
avg_img)
logging.info('Test score {}'.format(acc_test))
if args.data_type == 'rxrx1':
acc_id_test = infer(args,
id_test_loader,
model,
restyle,
avg_img)
logging.info('Id_Test score {}'.format(acc_id_test))
best_msg = 'Best val acc {:.2%} test acc {:.2%}'.format(
best_acc, acc_test)
if args.data_type == 'rxrx1':
best_msg += ' id_test acc {:.2%}'.format(acc_id_test)
logging.info(best_msg)
@torch.no_grad()
def evaluate(args,
data_loader,
model,
restyle,
avg_img):
""" Evaluate the trained model, output the overall prediction
accuracy and generate the csv files that are compatbile to wilds evaluation.
Args:
args: critical parameters specified in args.py
data_loader: the val, test (ood_test) or id_test data loader
called via wilds api
model: the trained molecular prediction model
restyle: the trained Restyle auto-encoder
avg_img: the average image that appends to the input image of
Restyle auto-encoder
"""
# split the data_loader list
_, val_loader, test_loader = data_loader[0], data_loader[1], data_loader[2]
data_msg = 'Data size for Val: {}, Test: {}'.format(len(val_loader),
len(test_loader))
if args.data_type == 'rxrx1':
id_test_loader = data_loader[3]
data_msg += ' ID_Test: {}'.format(len(id_test_loader))
print(data_msg)
# record the overall prediction accuracies,
# create the csv file for wilds evaluation
# for val, test or id_test data
csv_list = ['val', 'test']
if args.data_type == 'rxrx1':
csv_list += ['id_test']
best_msg = 'Best '
for csv_id, csv_nm in enumerate(csv_list):
file_name = '{}_split:{}_seed:{}_epoch:best_pred.csv'.format(
args.data_type,
csv_nm,
args.seed)
with open(str(args.save_dir / file_name), 'w') as csvfile:
csvwriter = csv.writer(csvfile)
acc = infer(args,
data_loader[1 + csv_id],
model,
restyle,
avg_img,
csvwriter)
best_msg += '{} acc {:.2%}: '.format(csv_nm, acc)
print(best_msg)
@torch.no_grad()
def recon(save_dir,
data_loader,
restyle,
avg_img):
""" Reconstruct the input image with Restyle auto-encoder.
Args:
save_dir: the folder path storing the fake image
data_loader: the train, val, test (ood_test) or id_test data loader
called via wilds api
restyle: the trained Restyle auto-encoder
avg_img: the average image that appends to the input image of
Restyle auto-encoder
"""
for dt_id, dt_loader in enumerate(data_loader):
for (X, _, _) in dt_loader:
X = X[:, :3].cuda()
avg = avg_img.unsqueeze(0)
avg = avg.repeat(X.shape[0], 1, 1, 1)
avg = avg.float().to(X)
# concatenate the average image to input
X_inp = torch.cat([(X - 0.5) / 0.5, avg], dim=1)
# output styles (codes) and noises
codes, noises = restyle.encoder(X_inp)
# the same latent_avg generated by
# restyle.decoder.mean_latent(int(1e5))[0],
# which is also used for generate avg_img.
latent_avg = restyle.latent_avg.repeat(codes.shape[0], 1, 1)
# X_out is the reconstructed image
X_out = restyle.decoder([codes + latent_avg.to(codes)],
noise=noises,
input_is_latent=True)[0]
# Since the input image is normalized by (image - 0.5) / 0.5,
# now we need to convert the pixel interval back to [0, 1]
X_out = (X_out + 1) / 2
X_out[X_out < 0] = 0
X_out[X_out > 1] = 1
# Visually compare the reconstructed and gt images side by side
X_merge = torch.zeros([X.shape[0] * 2,
X.shape[1],
X.shape[2],
X.shape[3]]).to(X)
bb_col = [1, 0, 0]
bb_len = 4
# add red bbox to gt image
for i in range(3):
X[:, i, :bb_len, :] = bb_col[i]
X[:, i, -bb_len:, :] = bb_col[i]
X[:, i, :, :bb_len] = bb_col[i]
X[:, i, :, -bb_len:] = bb_col[i]
X_merge[::2] = X
X_merge[1::2] = X_out
filename = Path(save_dir) / \
'{}.jpg'.format(dt_id)
tv_utils.save_image(X_merge.cpu().float(),
str(filename),
nrow=8,
padding=2)
print(str(filename))
break
@torch.no_grad()
def synth(save_dir, batch_size, restyle):
""" Synthesize fake images with StyleGAN decoder,
where the input are random gaussian noise.
Args:
save_dir: the folder path storing the fake image
restyle: the trained Restyle auto-encoder
"""
latent = torch.randn(batch_size, 512).cuda()
fake = restyle.decoder([latent])[0]
fake = (fake + 1) / 2
fake[fake < 0] = 0
fake[fake > 1] = 1
filename = Path(save_dir) / 'fake.jpg'
tv_utils.save_image(fake.cpu().float(),
str(filename),
nrow=8,
padding=2)
def main(args):
""" The main function running the experiments
reported in the paper.
if args.mode == 'train', then train the molecular predictor
with and without IID representation integration.
elif args.mode == 'evaluate', run the model evaluation
and generate the wilds compatible csv results, which
can be used for leaderboard submission.
elif args.mode == 'recon', save the image reconstruction results
achieved by Restyle auto-encoder
elif args.mode == 'synth', save the images synthesized with
StyleGAN decoder.
Args:
args: critical parameters specified in args.py.
"""
# load the data via wilds api
data_loader = dataset.get_dataloader(args)
# initialize the restyle model parameters and weights
ckpt_path = Path(args.checkpoint_path) / \
'{}_{}_iteration_90000.pt'.format(args.data_type, args.split_scheme)
restyle_ckpt = torch.load(str(ckpt_path), map_location='cpu')
restyle_opts = restyle_ckpt['opts']
restyle_opts.update({'checkpoint_path': str(ckpt_path)})
restyle_opts = Namespace(**restyle_opts)
logging.info('Restyle auto-encoder opts:\n{}'.format(str(restyle_opts)))
# load the restyle model parameters and weights
# switch the restyle model to evaluation mode, i.e.,
# freezing the weight during molecular prediction training
affine = True if args.mode in ('recon', 'synth') else False
restyle = pSp(restyle_opts, affine).cuda().eval()
logging.info('Restyle auto-encoder with loaded weights:\n{}'.
format(str(restyle)))
# initialize the molecular prediction model
model = ModelAndLoss(args,
restyle_opts.output_size,
restyle.decoder.style_dim).cuda()
logging.info('Model:\n{}'.format(str(model)))
if args.load is not None:
logging.info('Loading model from {}'.format(args.load))
model.load_state_dict(torch.load(str(args.load)))
avg_img = compute_avg_img(restyle)
if args.mode == 'train':
train(args, data_loader, model, restyle, avg_img)
elif args.mode == 'evaluate':
evaluate(args, data_loader, model, restyle, avg_img)
elif args.mode == 'recon':
recon(args.save_dir, data_loader, restyle, avg_img)
elif args.mode == 'synth':
synth(args.save_dir, args.batch_size, restyle)
else:
assert 0
if __name__ == '__main__':
args = parse_args()
setup_determinism(args.seed)
setup_logging(args)
main(args)
| 15,475 | 35.414118 | 125 | py |
IID_representation_learning | IID_representation_learning-master/model.py | import math
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
class NoiseInjection(nn.Module):
""" The injection of morph (noise of StyleGAN) representation
to the backbone layers with different resolution
Args:
lat_chn: the channel dimension of the morph (noise) represention
drop: the dropout ratio or do not use dropout if False
"""
def __init__(self, lat_chn, drop=False):
super().__init__()
self.lat_chn = lat_chn
self.weight = nn.Parameter(torch.zeros(lat_chn))
self.dropout = None if drop == 1 else nn.Dropout(p=drop, inplace=True)
def forward(self, image, noise=None):
if noise is None:
return image
else:
noise = self.weight * noise
if self.dropout is not None:
noise = self.dropout(noise)
return image + noise
class StyleInjection(nn.Module):
""" The injection of stain (style of StyleGAN) representation
for latent representation concatenation
Args:
inp_chn: the channel dimension of the stain (style) represention
drop: the dropout ratio or do not use dropout if False
"""
def __init__(self, inp_chn, drop=False):
super().__init__()
self.conv = nn.Conv1d(inp_chn, 1, 3, 1, 1)
self.bn = nn.BatchNorm1d(1)
self.leak = nn.LeakyReLU()
self.dropout = None if drop == 1 else nn.Dropout(p=drop, inplace=True)
def forward(self, style):
style = self.conv(style)
style = self.bn(style)
style = self.leak(style)
if self.dropout is not None:
style = self.dropout(style)
return style
class Model(nn.Module):
""" The training model specification including
backbones, morph (noise) and stain (style) injection,
etc.
Args:
args: critical parameters specified in args.py
img_size: the input image size, this is used for
computing the stain (style) channel dim,
by default is 256.
style_dim: the spatial dimension of stain represention,
by default is 512
"""
def __init__(self, args, img_size=256, style_dim=512):
super().__init__()
# Configure the four backbones investigated in the paper.
# Since we want to inject morph to the layer with different resolution,
# then the corresponding layers need to be decoupled as follows.
backbone = args.backbone
if backbone.startswith('densenet'):
pretrained_backbone = getattr(
torchvision.models, backbone)(pretrained=True)
features_num = pretrained_backbone.features.norm5.num_features
noise_dim = [64, 64, 128, 256, 512]
layer0 = nn.Conv2d(3, 64, 7, 2, 3, bias=False)
layer1 = nn.Sequential(pretrained_backbone.features.norm0,
pretrained_backbone.features.relu0,
pretrained_backbone.features.pool0)
layer2 = nn.Sequential(pretrained_backbone.features.denseblock1,
pretrained_backbone.features.transition1)
layer3 = nn.Sequential(pretrained_backbone.features.denseblock2,
pretrained_backbone.features.transition2)
layer4 = nn.Sequential(pretrained_backbone.features.denseblock3,
pretrained_backbone.features.transition3)
layer5 = nn.Sequential(pretrained_backbone.features.denseblock4,
pretrained_backbone.features.norm5,
nn.ReLU(inplace=True))
elif backbone.startswith('resnet'):
pretrained_backbone = getattr(
torchvision.models, backbone)(pretrained=True)
features_num = pretrained_backbone.fc.in_features
noise_dim = [64, 64, 512, 1024, 2048]
layer0 = nn.Conv2d(3, 64, 7, 2, 3, bias=False)
layer1 = nn.Sequential(pretrained_backbone.bn1,
pretrained_backbone.relu,
pretrained_backbone.maxpool)
layer2 = nn.Sequential(pretrained_backbone.layer1,
pretrained_backbone.layer2)
layer3 = pretrained_backbone.layer3
layer4 = pretrained_backbone.layer4
layer5 = None
elif backbone.startswith('mobilenet'):
pretrained_backbone = getattr(
torchvision.models, backbone)(pretrained=True)
features_num = pretrained_backbone.features[-1][0].out_channels
noise_dim = [32, 24, 32, 64, 160]
first_conv = nn.Conv2d(3, 32, 3, 2, 1, bias=False)
pretrained_backbone.features[0][0] = first_conv
layer0 = pretrained_backbone.features[:1]
layer1 = pretrained_backbone.features[1:3]
layer2 = pretrained_backbone.features[3:5]
layer3 = pretrained_backbone.features[5:8]
layer4 = pretrained_backbone.features[8:15]
layer5 = pretrained_backbone.features[15:]
elif backbone.startswith('mnasnet'):
pretrained_backbone = getattr(
torchvision.models, backbone)(pretrained=True)
features_num = pretrained_backbone.classifier[1].in_features
noise_dim = [32, 24, 40, 80, 192]
first_conv = nn.Conv2d(3, 32, 3, 2, 1, bias=False)
pretrained_backbone = pretrained_backbone.layers
pretrained_backbone[0] = first_conv
layer0 = pretrained_backbone[:1]
layer1 = pretrained_backbone[1:9]
layer2 = pretrained_backbone[9:10]
layer3 = pretrained_backbone[10:11]
layer4 = pretrained_backbone[11:13]
layer5 = pretrained_backbone[13:]
else:
raise ValueError('wrong backbone')
self.features = [layer0,
layer1,
layer2,
layer3,
layer4]
self.features = nn.ModuleList(self.features)
if layer5 is not None:
self.features.append(layer5)
# Prepare the list of morph (noise) injection layers
self.noises = nn.ModuleList()
for _ in noise_dim:
noise = NoiseInjection(1, args.noise_drop)
self.noises.append(noise)
# Prepare the stain (style) injection layer
self.style = None
if args.style:
# style_chn is 14 because image_size is 256
style_chn = int(math.log(img_size, 2)) * 2 - 2
self.style = StyleInjection(style_chn, args.style_drop)
features_num += style_dim
self.neck = nn.Sequential(
nn.BatchNorm1d(features_num),
nn.Linear(features_num, args.embedding_size, bias=False),
nn.ReLU(inplace=True),
nn.BatchNorm1d(args.embedding_size),
nn.Linear(args.embedding_size, args.embedding_size, bias=False),
nn.BatchNorm1d(args.embedding_size),
)
# This is meant for Arcface loss
self.arc_margin_product = ArcMarginProduct(
args.embedding_size, args.classes)
# This is meant for CrossEntropy loss
self.crs_linear = nn.Linear(args.embedding_size, args.classes)
for m in self.modules():
if isinstance(m, nn.BatchNorm1d) or isinstance(m, nn.BatchNorm2d):
m.momentum = args.bn_mom
def embed(self, x):
x_lat = x[1:]
x = x[0]
for f_id, _ in enumerate(self.features):
x = self.features[f_id](x)
if f_id < len(self.noises):
x = self.noises[f_id](x, x_lat[f_id])
x = F.adaptive_avg_pool2d(x, (1, 1))
x = x.view(x.size(0), -1)
if self.style is not None:
x_sty = self.style(x_lat[-1])
x = torch.cat([x, x_sty.view(x_sty.shape[0], -1)], dim=1)
embedding = self.neck(x)
return embedding
class ModelAndLoss(nn.Module):
""" Initialize the model, ArcFace and CrossEntropy loss.
Args:
args: critical parameters specified in args.py
img_size: the input image size, this is used for
computing the stain (style) channel dim,
by default is 256.
style_dim: the spatial dimension of stain represention,
by default is 512
Both image_size and style_dim are relevant to
Restyle auto-encoder configurations.
"""
def __init__(self, args, img_size, style_dim):
super().__init__()
self.args = args
self.model = Model(args, img_size, style_dim)
self.crit_arcface = ArcFaceLoss()
self.crit_entropy = DenseCrossEntropy()
self.coef = self.args.loss_coef
def train_forward(self, x, y):
embedding = self.model.embed(x)
arc_logits = self.model.arc_margin_product(embedding)
arc_loss = self.crit_arcface(arc_logits, y)
crs_logits = self.model.crs_linear(embedding)
crs_loss = self.crit_entropy(crs_logits, y)
loss = crs_loss * (1 - self.coef) + arc_loss * self.coef
acc = (crs_logits.max(1)[1] == y.max(1)[1]).float().mean().item()
return loss, acc
def eval_forward(self, x):
embedding = self.model.embed(x)
crs_logits = self.model.crs_linear(embedding)
return crs_logits
class DenseCrossEntropy(nn.Module):
""" The CrossEntropy loss that takes the one-hot
vector of the gt label as the input, should be equivalent to the
standard CrossEntropy implementation. The one-hot vector
is meant for the ArcFaceLoss and CutMix augmentation
Args:
x: the output of the model.
target: the one-hot ground-truth label
"""
def forward(self, x, target):
x = x.float()
target = target.float()
logprobs = torch.nn.functional.log_softmax(x, dim=-1)
loss = -logprobs * target
loss = loss.sum(-1)
return loss.mean()
class ArcFaceLoss(nn.modules.Module):
""" ArcFaceLoss, see the Fig.2 and Eq.3 in
https://arxiv.org/pdf/1801.07698.pdf
Args:
s: the scale factor on the output for computing
CrossEntropy
m: the margin penalty on the target (ground-truth label)
"""
def __init__(self, s=30.0, m=0.5):
super().__init__()
self.crit = DenseCrossEntropy()
self.s = s
self.cos_m = math.cos(m)
self.sin_m = math.sin(m)
self.th = math.cos(math.pi - m)
self.mm = math.sin(math.pi - m) * m
def forward(self, logits, labels):
logits = logits.float()
cosine = logits
sine = torch.sqrt(1.0 - torch.pow(cosine, 2))
# phi = cos(phi_logits + m)
phi = cosine * self.cos_m - sine * self.sin_m
# compute the phi for the gt label dimension
phi = torch.where(cosine > self.th, phi, cosine - self.mm)
output = (labels * phi) + ((1.0 - labels) * cosine)
output *= self.s
loss = self.crit(output, labels)
return loss / 2
class ArcMarginProduct(nn.Module):
""" Process the latent vectors to output the cosine vector
for the follow-up ArcFaceLoss computation.
Args:
in_features: the column dimension of the weights,
which is identical to the dim of latent vectors.
out_features: the row dimension of the weights,
which is identical to the number of classes.
"""
def __init__(self, in_features, out_features):
super().__init__()
self.weight = nn.Parameter(
torch.FloatTensor(out_features, in_features))
self.reset_parameters()
def reset_parameters(self):
stdv = 1. / math.sqrt(self.weight.size(1))
self.weight.data.uniform_(-stdv, stdv)
def forward(self, features):
cosine = F.linear(F.normalize(features), F.normalize(self.weight))
return cosine
| 12,143 | 34.612903 | 79 | py |
IID_representation_learning | IID_representation_learning-master/util.py | import math
import random
import torch
import sys
import logging
import numpy as np
from pathlib import Path
def setup_logging(args):
""" configure the logging document that records the
critical information during training and create
args.save_dir parameter used for saving visual and training
results.
Args:
args: arguments that are implemented in args.py file
and determined in the training command,
such as data_type, split_scheme, etc.
"""
save_msg = '{}_{}_{}_cutmix{}_batch{}_seed{}_coef{}'
save_msg = save_msg.format(args.data_type,
args.split_scheme,
args.backbone,
args.cutmix,
args.batch_size,
args.seed,
args.loss_coef)
if args.noise:
save_msg += '_noise_drop{}'.format(args.noise_drop)
if args.style:
save_msg += '_style_drop{}'.format(args.style_drop)
args.save_dir = Path(args.save) / args.backbone / save_msg
args.save_dir.mkdir(parents=True, exist_ok=True)
head = '{asctime}:{levelname}: {message}'
handlers = [logging.StreamHandler(sys.stderr)]
handlers.append(logging.FileHandler(str(args.save_dir / 'log'),
mode='w'))
logging.basicConfig(level=logging.INFO,
format=head,
style='{', handlers=handlers)
logging.info('Start with arguments {}'.format(args))
def setup_determinism(seed):
"""
Args:
seed: the seed for reproducible randomization.
"""
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)
def compute_avg_img(restyle):
""" Compuate the average image that is used
to append to the input image. The code snippet
is copied from coach_restyle_psp.py
Args:
restyle: the trained restyle encoder
and stylgan decoder
"""
restyle.latent_avg = restyle.decoder.mean_latent(int(1e5))[0]
restyle.latent_avg = restyle.latent_avg.detach()
avg_img = restyle(restyle.latent_avg.unsqueeze(0),
input_code=True,
randomize_noise=False,
return_latents=False,
average_code=True)[0]
return avg_img.detach()
def get_learning_rate(lr_schedule,
tot_epoch,
cur_epoch):
""" Compuate learning rate based on the initialized learning schedule,
e.g., cosine, 1.5e-4,90,6e-5,150,0 -> ('cosine', [1.5e-4,90,6e-5,150,0]).
Args:
lr_schedule: the learning schedule specified in args.py
tot_epoch: the total epoch
cur_epoch: the current (float) epoch
"""
# cosine
lr_mtd = lr_schedule[0]
# 90, 150
ep_list = lr_schedule[1][1::2]
# 1.5e-4,6e-5,0
lr_list = lr_schedule[1][::2]
assert len(ep_list) + 1 == len(lr_list)
for start, end, lr in zip([0] + ep_list,
ep_list + [tot_epoch],
lr_list):
if start <= cur_epoch < end:
if lr_mtd == 'cosine':
return lr * (math.cos((cur_epoch - start) / (end - start) * math.pi) + 1) / 2
elif lr_mtd == 'const':
return lr
else:
raise TypeError('Invalid learning method {}'.format(lr_mtd))
raise TypeError('Invalid learning schedule {}'.format(lr_schedule))
@torch.no_grad()
def transform_input(args, X, Y,
is_train=False,
**aug_kargs):
""" The customized data transform function including
processing the iid latent vectors (morph and stain),
normalizing the rxrx1 input with adding additional gaussian noise,
cutmix argumentation, etc.
Args:
args: critical parameters specified in args.py
X: input image
Y: input label
is_train: whether is training or evaluation
**aug_kargs: other parameters not in args.py, e.g.,
average image, restyle.
"""
# the one-hot vector is meant for CutMix augmentation and ArcFace loss
Y = torch.nn.functional.one_hot(Y, args.classes).float()
# output the stain (style) and morph (noise) latent vectors
if args.noise or args.style:
avg = aug_kargs['avg_img'].detach()
avg = avg.unsqueeze(0)
avg = avg.repeat(X.shape[0], 1, 1, 1)
avg = avg.float().to(X)
X_in = torch.cat([(X - 0.5) / 0.5, avg], dim=1)
codes, noises = aug_kargs['restyle'].encoder(X_in)
X_lat = []
if args.noise:
for i in range(5):
x_lat = noises[2*i + 1]
assert torch.all(x_lat == noises[2*i + 2])
X_lat = [x_lat] + X_lat
else:
X_lat = [None] * 5
if args.style:
X_lat.append(codes)
# normalize rxrx1 input image
if args.data_type == 'rxrx1':
mean = X.mean(dim=(2, 3)).unsqueeze(-1).unsqueeze(-1)
std = X.std(dim=(2, 3)).unsqueeze(-1).unsqueeze(-1)
std[std == 0.] = 1.
X = (X - mean.detach()) / std.detach()
if not is_train:
return [X] + X_lat, Y
# add small gaussian noise for rxrx1
if args.data_type == 'rxrx1':
a = np.random.normal(1, args.pw_aug[0], (X.shape[0], X.shape[1], 1, 1))
b = np.random.normal(0, args.pw_aug[1], (X.shape[0], X.shape[1], 1, 1))
a = torch.tensor(a, dtype=torch.float32)
b = torch.tensor(b, dtype=torch.float32)
X = X * a.detach().to(X) + b.detach().to(X)
# cutmix augmentation
if args.cutmix != 0:
perm = torch.randperm(X.shape[0]).cuda()
img_height, img_width = X.size()[2:]
lambd = np.random.beta(args.cutmix, args.cutmix)
column = np.random.uniform(0, img_width)
row = np.random.uniform(0, img_height)
height = (1 - lambd) ** 0.5 * img_height
width = (1 - lambd) ** 0.5 * img_width
r1 = round(max(0, row - height / 2))
r2 = round(min(img_height, row + height / 2))
c1 = round(max(0, column - width / 2))
c2 = round(min(img_width, column + width / 2))
if r1 < r2 and c1 < c2:
X[:, :, r1:r2, c1:c2] = X[perm, :, r1:r2, c1:c2]
lambd = 1 - (r2 - r1) * (c2 - c1) / (img_height * img_width)
Y = Y * lambd + Y[perm] * (1 - lambd)
return [X] + X_lat, Y
| 6,566 | 32.850515 | 93 | py |
IID_representation_learning | IID_representation_learning-master/restyle/__init__.py | import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
| 82 | 19.75 | 60 | py |
IID_representation_learning | IID_representation_learning-master/restyle/configs/__init__.py | 0 | 0 | 0 | py |
|
IID_representation_learning | IID_representation_learning-master/restyle/configs/data_configs.py | from configs import transforms_config
from configs.paths_config import dataset_paths
DATASETS = {
'ffhq_encode': {
'transforms': transforms_config.EncodeTransforms,
'train_source_root': dataset_paths['ffhq'],
'train_target_root': dataset_paths['ffhq'],
'test_source_root': dataset_paths['celeba_test'],
'test_target_root': dataset_paths['celeba_test']
},
"cars_encode": {
'transforms': transforms_config.CarsEncodeTransforms,
'train_source_root': dataset_paths['cars_train'],
'train_target_root': dataset_paths['cars_train'],
'test_source_root': dataset_paths['cars_test'],
'test_target_root': dataset_paths['cars_test']
},
"church_encode": {
'transforms': transforms_config.EncodeTransforms,
'train_source_root': dataset_paths['church_train'],
'train_target_root': dataset_paths['church_train'],
'test_source_root': dataset_paths['church_test'],
'test_target_root': dataset_paths['church_test']
},
"horse_encode": {
'transforms': transforms_config.EncodeTransforms,
'train_source_root': dataset_paths['horse_train'],
'train_target_root': dataset_paths['horse_train'],
'test_source_root': dataset_paths['horse_test'],
'test_target_root': dataset_paths['horse_test']
},
"afhq_wild_encode": {
'transforms': transforms_config.EncodeTransforms,
'train_source_root': dataset_paths['afhq_wild_train'],
'train_target_root': dataset_paths['afhq_wild_train'],
'test_source_root': dataset_paths['afhq_wild_test'],
'test_target_root': dataset_paths['afhq_wild_test']
},
"toonify": {
'transforms': transforms_config.EncodeTransforms,
'train_source_root': dataset_paths['ffhq'],
'train_target_root': dataset_paths['ffhq'],
'test_source_root': dataset_paths['celeba_test'],
'test_target_root': dataset_paths['celeba_test']
},
'scrc': {
'transforms': transforms_config.MedTransforms,
'train_source_root': dataset_paths['wilds'],
'train_target_root': dataset_paths['wilds'],
'test_source_root': dataset_paths['wilds'],
'test_target_root': dataset_paths['wilds'],
},
'rxrx1': {
'transforms': transforms_config.MedTransforms,
'train_source_root': dataset_paths['wilds'],
'train_target_root': dataset_paths['wilds'],
'test_source_root': dataset_paths['wilds'],
'test_target_root': dataset_paths['wilds'],
}
} | 2,575 | 40.548387 | 62 | py |
IID_representation_learning | IID_representation_learning-master/restyle/configs/paths_config.py | dataset_paths = {
'ffhq': '',
'celeba_test': '',
'cars_train': '',
'cars_test': '',
'church_train': '',
'church_test': '',
'horse_train': '',
'horse_test': '',
'afhq_wild_train': '',
'afhq_wild_test': '',
'wilds': ''
}
model_paths = {
'ir_se50': 'pretrained_models/model_ir_se50.pth',
'resnet34': 'pretrained_models/resnet34-333f7ec4.pth',
'stylegan_ffhq': 'pretrained_models/stylegan2-ffhq-config-f.pt',
'stylegan_cars': 'pretrained_models/stylegan2-car-config-f.pt',
'stylegan_church': 'pretrained_models/stylegan2-church-config-f.pt',
'stylegan_horse': 'pretrained_models/stylegan2-horse-config-f.pt',
'stylegan_ada_wild': 'pretrained_models/afhqwild.pt',
'stylegan_toonify': 'pretrained_models/ffhq_cartoon_blended.pt',
'shape_predictor': 'pretrained_models/shape_predictor_68_face_landmarks.dat',
'circular_face': 'pretrained_models/CurricularFace_Backbone.pth',
'mtcnn_pnet': 'pretrained_models/mtcnn/pnet.npy',
'mtcnn_rnet': 'pretrained_models/mtcnn/rnet.npy',
'mtcnn_onet': 'pretrained_models/mtcnn/onet.npy',
'moco': 'pretrained_models/moco_v2_800ep_pretrain.pth.tar'
}
| 1,111 | 29.054054 | 78 | py |
IID_representation_learning | IID_representation_learning-master/restyle/configs/transforms_config.py | from abc import abstractmethod
import torchvision.transforms as transforms
import torch
class TransformsConfig(object):
def __init__(self, opts):
self.opts = opts
@abstractmethod
def get_transforms(self):
pass
class MedTransforms(TransformsConfig):
def __init__(self, opts):
super(MedTransforms, self).__init__(opts)
def get_transforms(self):
angles = [0, 90, 180, 270]
def random_rotation(x):
angle = angles[torch.randint(low=0, high=len(angles), size=(1,))]
if angle > 0:
x = transforms.functional.rotate(x, angle)
return x
t_random_rotation = transforms.Lambda(lambda x: random_rotation(x))
transforms_dict = {
'transform_gt_train': transforms.Compose([
t_random_rotation,
transforms.RandomHorizontalFlip(0.5),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
'transform_source': None,
'transform_test': transforms.Compose([
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
'transform_inference': transforms.Compose([
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
}
return transforms_dict
class EncodeTransforms(TransformsConfig):
def __init__(self, opts):
super(EncodeTransforms, self).__init__(opts)
def get_transforms(self):
transforms_dict = {
'transform_gt_train': transforms.Compose([
transforms.Resize((256, 256)),
transforms.RandomHorizontalFlip(0.5),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
'transform_source': None,
'transform_test': transforms.Compose([
transforms.Resize((256, 256)),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
'transform_inference': transforms.Compose([
transforms.Resize((256, 256)),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])])
}
return transforms_dict
class CarsEncodeTransforms(TransformsConfig):
def __init__(self, opts):
super(CarsEncodeTransforms, self).__init__(opts)
def get_transforms(self):
transforms_dict = {
'transform_gt_train': transforms.Compose([
transforms.Resize((192, 256)),
transforms.RandomHorizontalFlip(0.5),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
'transform_source': None,
'transform_test': transforms.Compose([
transforms.Resize((192, 256)),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]),
'transform_inference': transforms.Compose([
transforms.Resize((192, 256)),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])])
}
return transforms_dict
| 3,351 | 33.916667 | 77 | py |
IID_representation_learning | IID_representation_learning-master/restyle/criteria/__init__.py | 0 | 0 | 0 | py |
|
IID_representation_learning | IID_representation_learning-master/restyle/criteria/id_loss.py | import torch
from torch import nn
from configs.paths_config import model_paths
from models.encoders.model_irse import Backbone
class IDLoss(nn.Module):
def __init__(self):
super(IDLoss, self).__init__()
print('Loading ResNet ArcFace')
self.facenet = Backbone(input_size=112, num_layers=50, drop_ratio=0.6, mode='ir_se')
self.facenet.load_state_dict(torch.load(model_paths['ir_se50']))
self.face_pool = torch.nn.AdaptiveAvgPool2d((112, 112))
self.facenet.eval()
def extract_feats(self, x):
x = x[:, :, 35:223, 32:220] # Crop interesting region
x = self.face_pool(x)
x_feats = self.facenet(x)
return x_feats
def forward(self, y_hat, y, x):
n_samples = x.shape[0]
x_feats = self.extract_feats(x)
y_feats = self.extract_feats(y) # Otherwise use the feature from there
y_hat_feats = self.extract_feats(y_hat)
y_feats = y_feats.detach()
loss = 0
sim_improvement = 0
id_logs = []
count = 0
for i in range(n_samples):
diff_target = y_hat_feats[i].dot(y_feats[i])
diff_input = y_hat_feats[i].dot(x_feats[i])
diff_views = y_feats[i].dot(x_feats[i])
id_logs.append({'diff_target': float(diff_target),
'diff_input': float(diff_input),
'diff_views': float(diff_views)})
loss += 1 - diff_target
id_diff = float(diff_target) - float(diff_views)
sim_improvement += id_diff
count += 1
return loss / count, sim_improvement / count, id_logs
| 1,661 | 35.933333 | 92 | py |
IID_representation_learning | IID_representation_learning-master/restyle/criteria/moco_loss.py | import torch
from torch import nn
import torch.nn.functional as F
from configs.paths_config import model_paths
class MocoLoss(nn.Module):
def __init__(self):
super(MocoLoss, self).__init__()
print("Loading MOCO model from path: {}".format(model_paths["moco"]))
self.model = self.__load_model()
self.model.cuda()
self.model.eval()
@staticmethod
def __load_model():
import torchvision.models as models
model = models.__dict__["resnet50"]()
# freeze all layers but the last fc
for name, param in model.named_parameters():
if name not in ['fc.weight', 'fc.bias']:
param.requires_grad = False
checkpoint = torch.load(model_paths['moco'], map_location="cpu")
state_dict = checkpoint['state_dict']
# rename moco pre-trained keys
for k in list(state_dict.keys()):
# retain only encoder_q up to before the embedding layer
if k.startswith('module.encoder_q') and not k.startswith('module.encoder_q.fc'):
# remove prefix
state_dict[k[len("module.encoder_q."):]] = state_dict[k]
# delete renamed or unused k
del state_dict[k]
msg = model.load_state_dict(state_dict, strict=False)
assert set(msg.missing_keys) == {"fc.weight", "fc.bias"}
# remove output layer
model = nn.Sequential(*list(model.children())[:-1]).cuda()
return model
def extract_feats(self, x):
x = F.interpolate(x, size=224)
x_feats = self.model(x)
x_feats = nn.functional.normalize(x_feats, dim=1)
x_feats = x_feats.squeeze()
return x_feats
def forward(self, y_hat, y, x):
n_samples = x.shape[0]
x_feats = self.extract_feats(x)
y_feats = self.extract_feats(y)
y_hat_feats = self.extract_feats(y_hat)
y_feats = y_feats.detach()
loss = 0
sim_improvement = 0
sim_logs = []
count = 0
for i in range(n_samples):
diff_target = y_hat_feats[i].dot(y_feats[i])
diff_input = y_hat_feats[i].dot(x_feats[i])
diff_views = y_feats[i].dot(x_feats[i])
sim_logs.append({'diff_target': float(diff_target),
'diff_input': float(diff_input),
'diff_views': float(diff_views)})
loss += 1 - diff_target
sim_diff = float(diff_target) - float(diff_views)
sim_improvement += sim_diff
count += 1
return loss / count, sim_improvement / count, sim_logs
| 2,638 | 36.7 | 92 | py |
IID_representation_learning | IID_representation_learning-master/restyle/criteria/w_norm.py | import torch
from torch import nn
class WNormLoss(nn.Module):
def __init__(self, start_from_latent_avg=True):
super(WNormLoss, self).__init__()
self.start_from_latent_avg = start_from_latent_avg
def forward(self, latent, latent_avg=None):
if self.start_from_latent_avg:
latent = latent - latent_avg
return torch.sum(latent.norm(2, dim=(1, 2))) / latent.shape[0]
| 379 | 24.333333 | 64 | py |
IID_representation_learning | IID_representation_learning-master/restyle/criteria/lpips/__init__.py | 0 | 0 | 0 | py |
|
IID_representation_learning | IID_representation_learning-master/restyle/criteria/lpips/lpips.py | import torch
import torch.nn as nn
from criteria.lpips.networks import get_network, LinLayers
from criteria.lpips.utils import get_state_dict
class LPIPS(nn.Module):
r"""Creates a criterion that measures
Learned Perceptual Image Patch Similarity (LPIPS).
Arguments:
net_type (str): the network type to compare the features:
'alex' | 'squeeze' | 'vgg'. Default: 'alex'.
version (str): the version of LPIPS. Default: 0.1.
"""
def __init__(self, net_type: str = 'alex', version: str = '0.1'):
assert version in ['0.1'], 'v0.1 is only supported now'
super(LPIPS, self).__init__()
# pretrained network
self.net = get_network(net_type).to("cuda")
# linear layers
self.lin = LinLayers(self.net.n_channels_list).to("cuda")
self.lin.load_state_dict(get_state_dict(net_type, version))
def forward(self, x: torch.Tensor, y: torch.Tensor):
feat_x, feat_y = self.net(x), self.net(y)
diff = [(fx - fy) ** 2 for fx, fy in zip(feat_x, feat_y)]
res = [l(d).mean((2, 3), True) for d, l in zip(diff, self.lin)]
return torch.sum(torch.cat(res, 0)) / x.shape[0]
| 1,203 | 32.444444 | 71 | py |
IID_representation_learning | IID_representation_learning-master/restyle/criteria/lpips/networks.py | from typing import Sequence
from itertools import chain
import torch
import torch.nn as nn
from torchvision import models
from criteria.lpips.utils import normalize_activation
def get_network(net_type: str):
if net_type == 'alex':
return AlexNet()
elif net_type == 'squeeze':
return SqueezeNet()
elif net_type == 'vgg':
return VGG16()
else:
raise NotImplementedError('choose net_type from [alex, squeeze, vgg].')
class LinLayers(nn.ModuleList):
def __init__(self, n_channels_list: Sequence[int]):
super(LinLayers, self).__init__([
nn.Sequential(
nn.Identity(),
nn.Conv2d(nc, 1, 1, 1, 0, bias=False)
) for nc in n_channels_list
])
for param in self.parameters():
param.requires_grad = False
class BaseNet(nn.Module):
def __init__(self):
super(BaseNet, self).__init__()
# register buffer
self.register_buffer(
'mean', torch.Tensor([-.030, -.088, -.188])[None, :, None, None])
self.register_buffer(
'std', torch.Tensor([.458, .448, .450])[None, :, None, None])
def set_requires_grad(self, state: bool):
for param in chain(self.parameters(), self.buffers()):
param.requires_grad = state
def z_score(self, x: torch.Tensor):
return (x - self.mean) / self.std
def forward(self, x: torch.Tensor):
x = self.z_score(x)
output = []
for i, (_, layer) in enumerate(self.layers._modules.items(), 1):
x = layer(x)
if i in self.target_layers:
output.append(normalize_activation(x))
if len(output) == len(self.target_layers):
break
return output
class SqueezeNet(BaseNet):
def __init__(self):
super(SqueezeNet, self).__init__()
self.layers = models.squeezenet1_1(True).features
self.target_layers = [2, 5, 8, 10, 11, 12, 13]
self.n_channels_list = [64, 128, 256, 384, 384, 512, 512]
self.set_requires_grad(False)
class AlexNet(BaseNet):
def __init__(self):
super(AlexNet, self).__init__()
self.layers = models.alexnet(True).features
self.target_layers = [2, 5, 8, 10, 12]
self.n_channels_list = [64, 192, 384, 256, 256]
self.set_requires_grad(False)
class VGG16(BaseNet):
def __init__(self):
super(VGG16, self).__init__()
self.layers = models.vgg16(True).features
self.target_layers = [4, 9, 16, 23, 30]
self.n_channels_list = [64, 128, 256, 512, 512]
self.set_requires_grad(False) | 2,667 | 26.791667 | 79 | py |
IID_representation_learning | IID_representation_learning-master/restyle/criteria/lpips/utils.py | from collections import OrderedDict
import torch
def normalize_activation(x, eps=1e-10):
norm_factor = torch.sqrt(torch.sum(x ** 2, dim=1, keepdim=True))
return x / (norm_factor + eps)
def get_state_dict(net_type: str = 'alex', version: str = '0.1'):
# build url
url = 'https://raw.githubusercontent.com/richzhang/PerceptualSimilarity/' \
+ f'master/lpips/weights/v{version}/{net_type}.pth'
# download
old_state_dict = torch.hub.load_state_dict_from_url(
url, progress=True,
map_location=None if torch.cuda.is_available() else torch.device('cpu')
)
# rename keys
new_state_dict = OrderedDict()
for key, val in old_state_dict.items():
new_key = key
new_key = new_key.replace('lin', '')
new_key = new_key.replace('model.', '')
new_state_dict[new_key] = val
return new_state_dict
| 885 | 27.580645 | 79 | py |
IID_representation_learning | IID_representation_learning-master/restyle/datasets/__init__.py | 0 | 0 | 0 | py |
|
IID_representation_learning | IID_representation_learning-master/restyle/datasets/gt_res_dataset.py | import os
from torch.utils.data import Dataset
from PIL import Image
class GTResDataset(Dataset):
def __init__(self, root_path, gt_dir=None, transform=None, transform_train=None):
self.pairs = []
for f in os.listdir(root_path):
image_path = os.path.join(root_path, f)
gt_path = os.path.join(gt_dir, f)
if f.endswith(".jpg") or f.endswith(".png") or f.endswith(".jpeg"):
self.pairs.append([image_path, gt_path, None])
self.transform = transform
self.transform_train = transform_train
def __len__(self):
return len(self.pairs)
def __getitem__(self, index):
from_path, to_path, _ = self.pairs[index]
from_im = Image.open(from_path).convert('RGB')
to_im = Image.open(to_path).convert('RGB')
if self.transform:
to_im = self.transform(to_im)
from_im = self.transform(from_im)
return from_im, to_im
| 839 | 27.965517 | 82 | py |
IID_representation_learning | IID_representation_learning-master/restyle/datasets/images_dataset.py | from torch.utils.data import Dataset
from PIL import Image
from utils import data_utils
class ImagesDataset(Dataset):
def __init__(self, source_root, target_root, opts, target_transform=None, source_transform=None):
self.source_paths = sorted(data_utils.make_dataset(source_root))
self.target_paths = sorted(data_utils.make_dataset(target_root))
self.source_transform = source_transform
self.target_transform = target_transform
self.opts = opts
def __len__(self):
return len(self.source_paths)
def __getitem__(self, index):
from_path = self.source_paths[index]
to_path = self.target_paths[index]
from_im = Image.open(from_path).convert('RGB')
to_im = Image.open(to_path).convert('RGB')
if self.target_transform:
to_im = self.target_transform(to_im)
if self.source_transform:
from_im = self.source_transform(from_im)
else:
from_im = to_im
return from_im, to_im
| 909 | 25.764706 | 98 | py |
IID_representation_learning | IID_representation_learning-master/restyle/datasets/inference_dataset.py | from torch.utils.data import Dataset
from PIL import Image
from utils import data_utils
class InferenceDataset(Dataset):
def __init__(self, root, opts, transform=None):
self.paths = sorted(data_utils.make_dataset(root))
self.transform = transform
self.opts = opts
def __len__(self):
return len(self.paths)
def __getitem__(self, index):
from_path = self.paths[index]
from_im = Image.open(from_path).convert('RGB')
if self.transform:
from_im = self.transform(from_im)
return from_im
| 508 | 22.136364 | 52 | py |
IID_representation_learning | IID_representation_learning-master/restyle/editing/__init__.py | 0 | 0 | 0 | py |
|
IID_representation_learning | IID_representation_learning-master/restyle/editing/inference_editing.py | import os
from argparse import Namespace
from tqdm import tqdm
import time
import numpy as np
import torch
from PIL import Image
from torch.utils.data import DataLoader
import sys
sys.path.append(".")
sys.path.append("..")
from configs import data_configs
from datasets.inference_dataset import InferenceDataset
from editing.latent_editor import LatentEditor
from models.e4e import e4e
from options.test_options import TestOptions
from utils.common import tensor2im
from utils.inference_utils import get_average_image, run_on_batch
def run():
"""
This script can be used to perform inversion and editing. Please note that this script supports editing using
only the ReStyle-e4e model and currently supports editing using three edit directions found using InterFaceGAN
(age, smile, and pose) on the faces domain.
For performing the edits please provide the arguments `--edit_directions` and `--factor_ranges`. For example,
setting these values to be `--edit_directions=age,smile,pose` and `--factor_ranges=5,5,5` will use a lambda range
between -5 and 5 for each of the attributes. These should be comma-separated lists of the same length. You may
get better results by playing around with the factor ranges for each edit.
"""
test_opts = TestOptions().parse()
out_path_results = os.path.join(test_opts.exp_dir, 'editing_results')
out_path_coupled = os.path.join(test_opts.exp_dir, 'editing_coupled')
os.makedirs(out_path_results, exist_ok=True)
os.makedirs(out_path_coupled, exist_ok=True)
# update test options with options used during training
ckpt = torch.load(test_opts.checkpoint_path, map_location='cpu')
opts = ckpt['opts']
opts.update(vars(test_opts))
opts = Namespace(**opts)
net = e4e(opts)
net.eval()
net.cuda()
print('Loading dataset for {}'.format(opts.dataset_type))
if opts.dataset_type != "ffhq_encode":
raise ValueError("Editing script only supports edits on the faces domain!")
dataset_args = data_configs.DATASETS[opts.dataset_type]
transforms_dict = dataset_args['transforms'](opts).get_transforms()
dataset = InferenceDataset(root=opts.data_path,
transform=transforms_dict['transform_inference'],
opts=opts)
dataloader = DataLoader(dataset,
batch_size=opts.test_batch_size,
shuffle=False,
num_workers=int(opts.test_workers),
drop_last=False)
if opts.n_images is None:
opts.n_images = len(dataset)
latent_editor = LatentEditor(net.decoder)
opts.edit_directions = opts.edit_directions.split(',')
opts.factor_ranges = [int(factor) for factor in opts.factor_ranges.split(',')]
if len(opts.edit_directions) != len(opts.factor_ranges):
raise ValueError("Invalid edit directions and factor ranges. Please provide a single factor range for each"
f"edit direction. Given: {opts.edit_directions} and {opts.factor_ranges}")
avg_image = get_average_image(net, opts)
global_i = 0
global_time = []
for input_batch in tqdm(dataloader):
if global_i >= opts.n_images:
break
with torch.no_grad():
input_cuda = input_batch.cuda().float()
tic = time.time()
result_batch = edit_batch(input_cuda, net, avg_image, latent_editor, opts)
toc = time.time()
global_time.append(toc - tic)
resize_amount = (256, 256) if opts.resize_outputs else (opts.output_size, opts.output_size)
for i in range(input_batch.shape[0]):
im_path = dataset.paths[global_i]
results = result_batch[i]
inversion = results.pop('inversion')
input_im = tensor2im(input_batch[i])
all_edit_results = []
for edit_name, edit_res in results.items():
res = np.array(input_im.resize(resize_amount)) # set the input image
res = np.concatenate([res, np.array(inversion.resize(resize_amount))], axis=1) # set the inversion
for result in edit_res:
res = np.concatenate([res, np.array(result.resize(resize_amount))], axis=1)
res_im = Image.fromarray(res)
all_edit_results.append(res_im)
edit_save_dir = os.path.join(out_path_results, edit_name)
os.makedirs(edit_save_dir, exist_ok=True)
res_im.save(os.path.join(edit_save_dir, os.path.basename(im_path)))
# save final concatenated result if all factor ranges are equal
if opts.factor_ranges.count(opts.factor_ranges[0]) == len(opts.factor_ranges):
coupled_res = np.concatenate(all_edit_results, axis=0)
im_save_path = os.path.join(out_path_coupled, os.path.basename(im_path))
Image.fromarray(coupled_res).save(im_save_path)
global_i += 1
stats_path = os.path.join(opts.exp_dir, 'stats.txt')
result_str = 'Runtime {:.4f}+-{:.4f}'.format(np.mean(global_time), np.std(global_time))
print(result_str)
with open(stats_path, 'w') as f:
f.write(result_str)
def edit_batch(inputs, net, avg_image, latent_editor, opts):
y_hat, latents = get_inversions_on_batch(inputs, net, avg_image, opts)
# store all results for each sample, split by the edit direction
results = {idx: {'inversion': tensor2im(y_hat[idx])} for idx in range(len(inputs))}
for edit_direction, factor_range in zip(opts.edit_directions, opts.factor_ranges):
edit_res = latent_editor.apply_interfacegan(latents=latents,
direction=edit_direction,
factor_range=(-1 * factor_range, factor_range))
# store the results for each sample
for idx, sample_res in edit_res.items():
results[idx][edit_direction] = sample_res
return results
def get_inversions_on_batch(inputs, net, avg_image, opts):
result_batch, result_latents = run_on_batch(inputs, net, opts, avg_image)
# we'll take the final inversion as the inversion to edit
y_hat = [result_batch[idx][-1] for idx in range(len(result_batch))]
latents = [torch.from_numpy(result_latents[idx][-1]).cuda() for idx in range(len(result_batch))]
return y_hat, torch.stack(latents)
if __name__ == '__main__':
run() | 6,526 | 42.805369 | 117 | py |
IID_representation_learning | IID_representation_learning-master/restyle/editing/latent_editor.py | import torch
from utils.common import tensor2im
class LatentEditor(object):
def __init__(self, stylegan_generator):
self.generator = stylegan_generator
self.interfacegan_directions = {
'age': torch.load('editing/interfacegan_directions/age.pt').cuda(),
'smile': torch.load('editing/interfacegan_directions/smile.pt').cuda(),
'pose': torch.load('editing/interfacegan_directions/pose.pt').cuda()
}
def apply_interfacegan(self, latents, direction, factor=1, factor_range=None):
edit_latents = []
direction = self.interfacegan_directions[direction]
if factor_range is not None: # Apply a range of editing factors. for example, (-5, 5)
for f in range(*factor_range):
edit_latent = latents + f * direction
edit_latents.append(edit_latent)
edit_latents = torch.stack(edit_latents).transpose(0, 1)
else:
edit_latents = latents + factor * direction
return self._latents_to_image(edit_latents)
def _latents_to_image(self, all_latents):
sample_results = {}
with torch.no_grad():
for idx, sample_latents in enumerate(all_latents):
images, _ = self.generator([sample_latents], randomize_noise=False, input_is_latent=True)
sample_results[idx] = [tensor2im(image) for image in images]
return sample_results
| 1,446 | 41.558824 | 105 | py |
IID_representation_learning | IID_representation_learning-master/restyle/models/__init__.py | 0 | 0 | 0 | py |
|
IID_representation_learning | IID_representation_learning-master/restyle/models/e4e.py | """
This file defines the core research contribution
"""
import math
import torch
from torch import nn
from models.stylegan2.model import Generator
from configs.paths_config import model_paths
from models.encoders import restyle_e4e_encoders
from utils.model_utils import RESNET_MAPPING
class e4e(nn.Module):
def __init__(self, opts):
super(e4e, self).__init__()
self.set_opts(opts)
self.n_styles = int(math.log(self.opts.output_size, 2)) * 2 - 2
# Define architecture
self.encoder = self.set_encoder()
self.decoder = Generator(self.opts.output_size, 512, 8, channel_multiplier=2)
self.face_pool = torch.nn.AdaptiveAvgPool2d((256, 256))
# Load weights if needed
self.load_weights()
def set_encoder(self):
if self.opts.encoder_type == 'ProgressiveBackboneEncoder':
encoder = restyle_e4e_encoders.ProgressiveBackboneEncoder(50, 'ir_se', self.n_styles, self.opts)
elif self.opts.encoder_type == 'ResNetProgressiveBackboneEncoder':
encoder = restyle_e4e_encoders.ResNetProgressiveBackboneEncoder(self.n_styles, self.opts)
else:
raise Exception(f'{self.opts.encoder_type} is not a valid encoders')
return encoder
def load_weights(self):
if self.opts.checkpoint_path is not None:
print(f'Loading ReStyle e4e from checkpoint: {self.opts.checkpoint_path}')
ckpt = torch.load(self.opts.checkpoint_path, map_location='cpu')
self.encoder.load_state_dict(self.__get_keys(ckpt, 'encoder'), strict=False)
self.decoder.load_state_dict(self.__get_keys(ckpt, 'decoder'), strict=True)
self.__load_latent_avg(ckpt)
else:
encoder_ckpt = self.__get_encoder_checkpoint()
self.encoder.load_state_dict(encoder_ckpt, strict=False)
print(f'Loading decoder weights from pretrained path: {self.opts.stylegan_weights}')
ckpt = torch.load(self.opts.stylegan_weights)
self.decoder.load_state_dict(ckpt['g_ema'], strict=True)
self.__load_latent_avg(ckpt, repeat=self.n_styles)
def forward(self, x, latent=None, resize=True, latent_mask=None, input_code=False, randomize_noise=True,
inject_latent=None, return_latents=False, alpha=None, average_code=False, input_is_full=False):
if input_code:
codes = x
else:
codes = self.encoder(x)
# residual step
if x.shape[1] == 6 and latent is not None:
# learn error with respect to previous iteration
codes = codes + latent
else:
# first iteration is with respect to the avg latent code
codes = codes + self.latent_avg.repeat(codes.shape[0], 1, 1)
if latent_mask is not None:
for i in latent_mask:
if inject_latent is not None:
if alpha is not None:
codes[:, i] = alpha * inject_latent[:, i] + (1 - alpha) * codes[:, i]
else:
codes[:, i] = inject_latent[:, i]
else:
codes[:, i] = 0
if average_code:
input_is_latent = True
else:
input_is_latent = (not input_code) or (input_is_full)
images, result_latent = self.decoder([codes],
input_is_latent=input_is_latent,
randomize_noise=randomize_noise,
return_latents=return_latents)
if resize:
images = self.face_pool(images)
if return_latents:
return images, result_latent
else:
return images
def set_opts(self, opts):
self.opts = opts
def __load_latent_avg(self, ckpt, repeat=None):
if 'latent_avg' in ckpt:
self.latent_avg = ckpt['latent_avg'].to(self.opts.device)
if repeat is not None:
self.latent_avg = self.latent_avg.repeat(repeat, 1)
else:
self.latent_avg = None
def __get_encoder_checkpoint(self):
if "ffhq" in self.opts.dataset_type:
print('Loading encoders weights from irse50!')
encoder_ckpt = torch.load(model_paths['ir_se50'])
# Transfer the RGB input of the irse50 network to the first 3 input channels of pSp's encoder
if self.opts.input_nc != 3:
shape = encoder_ckpt['input_layer.0.weight'].shape
altered_input_layer = torch.randn(shape[0], self.opts.input_nc, shape[2], shape[3], dtype=torch.float32)
altered_input_layer[:, :3, :, :] = encoder_ckpt['input_layer.0.weight']
encoder_ckpt['input_layer.0.weight'] = altered_input_layer
return encoder_ckpt
else:
print('Loading encoders weights from resnet34!')
encoder_ckpt = torch.load(model_paths['resnet34'])
# Transfer the RGB input of the resnet34 network to the first 3 input channels of pSp's encoder
if self.opts.input_nc != 3:
shape = encoder_ckpt['conv1.weight'].shape
altered_input_layer = torch.randn(shape[0], self.opts.input_nc, shape[2], shape[3], dtype=torch.float32)
altered_input_layer[:, :3, :, :] = encoder_ckpt['conv1.weight']
encoder_ckpt['conv1.weight'] = altered_input_layer
mapped_encoder_ckpt = dict(encoder_ckpt)
for p, v in encoder_ckpt.items():
for original_name, psp_name in RESNET_MAPPING.items():
if original_name in p:
mapped_encoder_ckpt[p.replace(original_name, psp_name)] = v
mapped_encoder_ckpt.pop(p)
return encoder_ckpt
@staticmethod
def __get_keys(d, name):
if 'state_dict' in d:
d = d['state_dict']
d_filt = {k[len(name) + 1:]: v for k, v in d.items() if k[:len(name)] == name}
return d_filt
| 6,131 | 43.434783 | 120 | py |
IID_representation_learning | IID_representation_learning-master/restyle/models/psp.py | """
This file defines the core research contribution
"""
import math
import torch
from torch import nn
from models.stylegan2.model import Generator
from configs.paths_config import model_paths
from models.encoders import fpn_encoders, restyle_psp_encoders
from utils.model_utils import RESNET_MAPPING
from utils.data_utils import linspace
class pSp(nn.Module):
def __init__(self, opts, affine=True):
super(pSp, self).__init__()
self.set_opts(opts)
self.n_styles = int(math.log(self.opts.output_size, 2)) * 2 - 2
# Define architecture
self.encoder = self.set_encoder(affine)
self.decoder = Generator(
self.opts.output_size, 512, 8, channel_multiplier=2)
self.face_pool = torch.nn.AdaptiveAvgPool2d((256, 256))
# Load weights if needed
self.load_weights()
def set_encoder(self, affine):
if self.opts.encoder_type == 'GradualStyleEncoder':
encoder = fpn_encoders.GradualStyleEncoder(
50, 'ir_se', self.n_styles, self.opts)
elif self.opts.encoder_type == 'ResNetGradualStyleEncoder':
encoder = fpn_encoders.ResNetGradualStyleEncoder(
self.n_styles, self.opts)
elif self.opts.encoder_type == 'BackboneEncoder':
encoder = restyle_psp_encoders.BackboneEncoder(
50, 'ir_se', self.n_styles, self.opts)
elif self.opts.encoder_type == 'ResNetBackboneEncoder':
encoder = restyle_psp_encoders.ResNetBackboneEncoder(
self.n_styles, self.opts, affine)
else:
raise Exception(
f'{self.opts.encoder_type} is not a valid encoders')
return encoder
def load_weights(self):
if self.opts.checkpoint_path is not None:
print(
f'Loading ReStyle pSp from checkpoint: {self.opts.checkpoint_path}')
ckpt = torch.load(self.opts.checkpoint_path, map_location='cpu')
self.encoder.load_state_dict(
self.__get_keys(ckpt, 'encoder'), strict=False)
self.decoder.load_state_dict(
self.__get_keys(ckpt, 'decoder'), strict=True)
self.__load_latent_avg(ckpt)
else:
ckpt = torch.load(self.opts.stylegan_weights)
self.decoder.load_state_dict(ckpt['g_ema'], strict=True)
self.__load_latent_avg(ckpt, repeat=self.n_styles)
def forward(self, x, latent=None, resize=True, latent_mask=None, input_code=False, randomize_noise=True,
inject_latent=None, return_latents=False, alpha=None, average_code=False, input_is_full=False):
noises = None
if input_code:
codes = x
else:
codes, noises = self.encoder(x)
# residual step
if x.shape[1] == 6 and latent is not None:
# learn error with respect to previous iteration
codes = codes + latent
else:
# first iteration is with respect to the avg latent code
codes = codes + self.latent_avg.repeat(codes.shape[0], 1, 1)
if latent_mask is not None:
for i in latent_mask:
if inject_latent is not None:
if alpha is not None:
codes[:, i] = alpha * inject_latent[:, i] + \
(1 - alpha) * codes[:, i]
else:
codes[:, i] = inject_latent[:, i]
else:
codes[:, i] = 0
if average_code:
input_is_latent = True
else:
input_is_latent = (not input_code) or (input_is_full)
images, result_latent = self.decoder([codes],
input_is_latent=input_is_latent,
noise=noises,
randomize_noise=randomize_noise,
return_latents=return_latents)
if resize:
images = self.face_pool(images)
if return_latents:
return images, result_latent
else:
return images
def set_opts(self, opts):
self.opts = opts
def __load_latent_avg(self, ckpt, repeat=None):
if 'latent_avg' in ckpt:
self.latent_avg = ckpt['latent_avg'].to(self.opts.device)
if repeat is not None:
self.latent_avg = self.latent_avg.repeat(repeat, 1)
else:
self.latent_avg = None
def __get_encoder_checkpoint(self):
if "ffhq" in self.opts.dataset_type:
print('Loading encoders weights from irse50!')
encoder_ckpt = torch.load(model_paths['ir_se50'])
# Transfer the RGB input of the irse50 network to the first 3 input channels of pSp's encoder
if self.opts.input_nc != 3:
shape = encoder_ckpt['input_layer.0.weight'].shape
altered_input_layer = torch.randn(
shape[0], self.opts.input_nc, shape[2], shape[3], dtype=torch.float32)
altered_input_layer[:, :3, :,
:] = encoder_ckpt['input_layer.0.weight']
encoder_ckpt['input_layer.0.weight'] = altered_input_layer
return encoder_ckpt
else:
print('Loading encoders weights from resnet34!')
encoder_ckpt = torch.load(model_paths['resnet34'])
# Transfer the RGB input of the resnet34 network to the first 3 input channels of pSp's encoder
if self.opts.input_nc != 3:
shape = encoder_ckpt['conv1.weight'].shape
altered_input_layer = torch.randn(
shape[0], self.opts.input_nc, shape[2], shape[3], dtype=torch.float32)
altered_input_layer[:, :3, :, :] = encoder_ckpt['conv1.weight']
encoder_ckpt['conv1.weight'] = altered_input_layer
mapped_encoder_ckpt = dict(encoder_ckpt)
for p, v in encoder_ckpt.items():
for original_name, psp_name in RESNET_MAPPING.items():
if original_name in p:
mapped_encoder_ckpt[p.replace(
original_name, psp_name)] = v
mapped_encoder_ckpt.pop(p)
return encoder_ckpt
@staticmethod
def __get_keys(d, name):
if 'state_dict' in d:
d = d['state_dict']
d_filt = {k[len(name) + 1:]: v for k, v in d.items()
if k[:len(name)] == name}
return d_filt
| 6,653 | 41.382166 | 111 | py |
IID_representation_learning | IID_representation_learning-master/restyle/models/e4e_modules/__init__.py | 0 | 0 | 0 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.