-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(afrl): add typescript to transform a csv * fix(typescript): restore afrl project * doc(typescript): index.md and readme.md * fix(_config.yml): exclude node_modules * feat(typescript/afrl): add short description * changed AFRL TypeScript page wording --------- Co-authored-by: nh916 <[email protected]>
- Loading branch information
Showing
48 changed files
with
7,391 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
layout: default | ||
title: AFRL README.md | ||
published: false | ||
--- | ||
|
||
# TypeScript ingestion scripts for CRIPT | ||
|
||
This folder is a unique npm package shared between all ingestion scripts. Browse the `./src` folder. | ||
# `npm i` | ||
|
||
Will install this npm package and dependencies. | ||
|
||
# This project contains several ingestion scripts | ||
|
||
Note: scripts are still WIP. | ||
|
||
- `afrl`: see [readme](src/afrl/README.md) | ||
- `rcbc`: see [readme](src/rcbc/README.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 80 additions & 2 deletions
82
...typescript_scripts/AFRL/package-lock.json → scripts/typescript/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# AFRL CSV to JSON | ||
## How to use? | ||
|
||
from project root, run `npm run afrl` | ||
|
||
Will run the AFRL CSV to JSON script and produce multiple JSON in the `out/afrl` folder from the CSV file present in `src/afrl/data` folder. | ||
|
||
After a run, check the *.errors.json file to be sure you do not skip important data. | ||
Then, you can upload the data to CRIPT using curl: | ||
|
||
``` | ||
curl -X POST -H "Content-Type: application/json" -d "@./out/afrl/afrl-transformed.min.json" <host>/project/ --header "authorization: Bearer <token>" | ||
``` | ||
|
||
## How it works? | ||
|
||
Step by step of what the script does on a macro level (for more details look at the source code). | ||
|
||
- Load the data (`src/data/*.csv`) as an `Array<AFRLData>`. | ||
- For each CSV line (or object), we create 3 `Material`s (a mixture, a solvent, and a polymer) with some `Property`, `Condition` and `Citation` (`doi` is stored in a `Reference`) on it. | ||
- Each type of material is registered in a dedicated `Inventory`. | ||
- Inventories are store in a single `Collection` which is in a single `Project`. | ||
- The `Project` is serialized as a single JSON (in two version, one minified and an other human-readable). | ||
- If some data cannot be transformed, logs are added to the *.errors.json file. | ||
|
||
|
||
## History | ||
|
||
This script was using Python originally (see [here](../../../python_sdk_scripts/AFRL/)), last commit was from December 2022. I figured out the python version was existing **after** starting this task, that's why I started using typescript. However, I couldn't use Python (no much experience and culture) and the PythonSDK (still in development), so I decided to continue this way. | ||
|
||
Berenger. |
Oops, something went wrong.