def load_entities_from_oral_histories(): oral_histories = OralHistory.query.all() for oh in oral_histories: entity = Entity(name=full_name(oh)) entity.description = "Oral History ID: {}".format(oh.id) db.session.add(entity) db.session.commit()
def create_entity(node): entity = Entity(node['name']) entity.nickname = node['nickname'] if node['description']: entity.description = node['description'] entity.entitytype = node['type'] entity.influence = node['influence'] if entity.influence: entity.influence = entity.influence.capitalize() entity.employees = node['employees'] entity.url = node['url'] entity.twitter_handle = node['twitter_handle'] entity.followers = node['followers'] categorize(entity, node['categories']) add_finances(entity, node['revenue'], 'revenue') add_finances(entity, node['expenses'], 'expenses') #add_relations(entity, node['relations']) connect_key_people(entity, node['key_people']) db.add(entity) db.flush() add_location(entity, node['location']) old_to_new[node['ID']] = entity.id