---
title: "Polymer Additive Manufacturing JSON-LD"
author: "Hein Htet Aung, Roger H. French, Laura S. Bruckman"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Polymer Additive Manufacturing JSON-LD}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

Polymer AM JSON-LD Description
-----------------------------------
In Polymer Additive Manufacturing (AM) JSON-LD template, the sample information (sample id) is related to printing parameters to produce the part, the build geometry of the part, material properties of the part and the characterization techniques (in-situ and ex-situ) performed on the part. 

More detailed structure is shown in the schema diagram below.

Creating JSON-LD for Polymer AM  in R
------------------------------------------
```{r, message=FALSE, eval=FALSE}
library(FAIRmaterials)

# An example data frame for polymer AM
polymerAM_data <- data.frame(
  'sampleID' = c('sa12345', 'sa24682'),
  'printMethod' = c('FDM', 'FDM'),
  'manufacturer' = c('A', 'B'),
  'material' = c('ABS', 'PLA'),
  'surfaceRoughness' = c(10, 5),
  'flowRate' = c(8, 12)
)

# This will generate json-ld files for the example data.
polymer_output <- fairify_data(polymerAM_data, domain = 'PolymerAM', saveLocal = TRUE)
```

Creating JSON-LD for Polymer AM  in Python
------------------------------------------

```{python, eval = FALSE, message = FALSE, python.reticulate = FALSE}
from fairmaterials.fairify_data import *
import pandas as pd

# Create an example data frame for Polymer AM
data = pd.DataFrame(
  'sampleID' = ['sa12345', 'sa24682'],
  'printMethod' = ['FDM', 'FDM'],
  'manufacturer' = ['A', 'B'],
  'material' = ['ABS', 'PLA'],
  'surfaceRoughness' = [10, 5],
  'flowRate' = c[8, 12]
)

# This will generate JSON-LD file for the example data
output <- fairify_data(data, domain = 'PolymerAM')
```


Polymer AM schema diagram
--------------------------

```{r, out.width="1200px", echo=FALSE, fig.cap="Polymer AM schema diagram"}
knitr::include_graphics("polymerAdditiveManufacturing.png")
```

Acknowledgment
--------------------------
This material is based upon work supported by the Department of Energy (National Nuclear Security Administration) under Award Number(s) DE-NA0004104.

