<jupyter_start><jupyter_text>State of veteran employment, 2020\[_In case you’re unable to see the atoti visualizations in GitHub, try viewing the notebook in [nbviewer](https://nbviewer.org/github/atoti/notebooks/blob/master/notebooks/veteran-emp/main.ipynb)._] In March of 2021, a memo was released by the US Bureau of Labor Statistics summarizing the state of veteran employment during 2020.  The data, sourced from a survey, explored labor statistics through the lens gender, age, race, and veteran service period.  It explored relationships between employment and disability.  The [released memo](https://www.bls.gov/news.release/pdf/vet.pdf) was a thorough (read, dense) 26 pages, full of text and tables. We explore this dataset in this notebook.  We selected a few  highlights from the memo and summarize those key takeaways via visuals.  We also use those visuals and others to construct a dashboard.   Getting Started<jupyter_code>import atoti as tt
session = tt.create_session(config={"user_content_storage": "./content", "port": 9090})<jupyter_output><empty_output><jupyter_text>We will use a subset of the underlying data summarized in the aforementioned memo.  All tables related to the data set are available [here](https://www.bls.gov/news.release/vet.nr0.htm) on the [US Bureau of Labor Statistics website](https://www.bls.gov/). We'll create a dashboard from the ensuing visuals, hence set our session config to store our content metadata.  This will allow us to save and return to our dashboard later on.<jupyter_code>veteran_data = session.read_csv(
    "s3://data.atoti.io/notebooks/veteran-emp/veteran-data.csv"
)
veteran_data.head()
cube = session.create_cube(veteran_data, mode="no_measures")
h, l, m = cube.hierarchies, cube.levels, cube.measures<jupyter_output><empty_output><jupyter_text>Adusting levels and hierarchies Two of the levels in our cube have an inherent relationship between them: *period of service* is very much so related to *Veteran status*--a nonveteran won't have a classification of *period of service*.  We can add the *period of service* level to our Veteran Status hierarchy, and delete the *period of service* hierarchy.<jupyter_code>h["Veteran status"] = [l["Veteran status"], l["period of service"]]
del h["period of service"]
h<jupyter_output><empty_output><jupyter_text>Adjusting measures Two things to note in our underlying data:* it provides percents, which do not make sense to sum or mean, and* there are certain stats which are referenced but not included as a column--such as *Civilian labor force*, defined as the *Civilian noninstutional population* minus the *not in labor force* populationTo address this, we'll delete the unnecessary percent columns, and add this additional metric.<jupyter_code>veteran_data.columns
veteran_data["sex"].data_type
for column_name in [
    column_name
    for column_name in veteran_data.columns
    if veteran_data[column_name].data_type.java_type != "string"
]:

    cube.measures[f"{column_name}.SUM"] = tt.agg.sum(veteran_data[column_name])
m
m["Civilian labor force"] = (
    m["Civilian noninstitutional population.SUM"] - m["Not in labor force.SUM"]
)<jupyter_output><empty_output><jupyter_text>Getting a feel for the breakdowns<jupyter_code>session.visualize("Understanding the relative size of service group populations")
session.visualize("Breakdown of employment")
session.visualize("Breakdown of employment - by 100%")
session.visualize("Age based breakdown for nonveterans vs veterans")
session.visualize(
    "Size of civilian noninstitutional population by age, split by veteran status"
)<jupyter_output><empty_output><jupyter_text>Visualizing a few key points While there are many statistics highlighted in the memo, we'll visualize the following points:* The rate of unemployment for male veterans was 6.5 percent, little different from the rate of 6.7 percent for female veterans.* Among the 581,000 unemployed veterans in 2020, 54 percent were ages 25 to 54, 41 percent were age 55 and over, and 5 percent were ages 18 to 24.* In 2020, 18.5 million men and women were veterans, accounting for about 7 percent of the civilian noninstitutional population age 18 and over* Of all veterans, 1 in 10 were women.<jupyter_code>session.visualize("Visualizing male vs female veteran unemployment")
session.visualize("Visualizing the age breakdown of unemployeed vets")
session.visualize(
    "Visualizing the veteran segment of the civilian noninstitutional population"
)
session.visualize("Visualizing the proportion of veterans who are women")<jupyter_output><empty_output><jupyter_text>From here, we can right publish these visuals, plus any others we liked from our exploration, and create a dashboard.  We can access our dashboard via the below:<jupyter_code>session.link(path="/#/dashboard/11d")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08018185575532134, 'fraction_numerical': 0.013845835916511676, 'mean_word_length': 5.685082872928176, 'pattern_counts': {'":': 2, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 4, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '74053', 'license': 'Apache-2.0', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1327, 'n_words': 556, 'path': 'notebooks/veteran-emp/main.ipynb', 'repo_name': 'joohiang/notebooks', 'size': '4839'}