-
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.
Merge pull request #7 from C-Accel-CRIPT/feat/typescript
feat(scripts): add typescript folder
- Loading branch information
Showing
34 changed files
with
1,383 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
node_modules | ||
build | ||
out |
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,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"printWidth": 120 | ||
} |
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,13 @@ | ||
# AFRL transformation script | ||
|
||
The purpose of this node script is to convert AFRL dataset to a CRIPT compatible JSON. | ||
Related to: https://trello.com/c/4eTnhJrp/29-transform-the-afrl-dataset | ||
|
||
# `npm i` | ||
|
||
Will install this npm package and dependencies. | ||
|
||
# Scripts | ||
|
||
- `afrl`: see [readme](./src/afrl/README.md) | ||
- `rcbc`: see [readme](./src/rcbc/README.md) |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "cript-typescript", | ||
"version": "1.0.0", | ||
"description": "Set of typescript code to convert raw data (*.csv, *.ts) to CRIPT *.json format", | ||
"main": "index.js", | ||
"scripts": { | ||
"afrl": "npx ts-node src/afrl/index.ts", | ||
"rcbc": "npx ts-node src/rcbc/index.ts", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Bérenger Dalle-Cort, CRIPT, MIT", | ||
"license": "MIT", | ||
"dependencies": { | ||
"csvtojson": "^2.0.10", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.3" | ||
} | ||
} |
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,12 @@ | ||
import { IParameter, ICitation } from '.'; | ||
|
||
/** | ||
* "Algorithm consists of parameter and condition details used in the computation and computational_process. (...)"" | ||
* @see https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/6322994103e27d9176d5b10c/original/main-supporting-information.pdf#page=24 | ||
*/ | ||
export type IAlgorithm = { | ||
key: string; | ||
type: string; | ||
parameter: Array<IParameter>; | ||
citation: Array<ICitation>; | ||
}; |
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,22 @@ | ||
import { IReference } from "./IReference"; | ||
|
||
export type CitationType = | ||
'extracted_by_human' | | ||
'extracted_by_nlp' | | ||
'extracted_by_algorithm' | | ||
'derived_from' | | ||
'replicated' | | ||
'reference'; | ||
|
||
export interface ICitation { | ||
readonly node: ['Citation']; | ||
|
||
name: string; | ||
created_at: string; | ||
updated_at: string; | ||
model_version: string; | ||
reference: IReference; | ||
uuid: string; | ||
// type: string; | ||
type: CitationType; | ||
} |
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 @@ | ||
import { IExperiment, IInventory, IProject } from '.'; | ||
|
||
export interface ICollection { | ||
locked?: boolean; | ||
model_version?: string; | ||
name: string; | ||
notes?: string; | ||
readonly node: ['Collection']; | ||
public?: boolean; | ||
uid?: string; | ||
uuid?: string; | ||
experiment?: IExperiment[]; | ||
experiment_count?: number; | ||
inventory?: IInventory[]; | ||
project?: IProject[]; | ||
inventory_count?: number; | ||
created_at?: string; | ||
updated_at?: string; | ||
doi?: string; | ||
} |
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,26 @@ | ||
import { ICondition, IReference, IData, ISoftwareConfiguration, IExperiment, IIngredient, IProperty } from '.'; | ||
|
||
/** | ||
* "The computation node describes the transformation of data or the creation of a computational data set (...)" | ||
* @see https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/6322994103e27d9176d5b10c/original/main-supporting-information.pdf#page=11 | ||
*/ | ||
export interface IComputation { | ||
readonly node: ['Computation']; | ||
uid: string; | ||
uuid: string; | ||
citation?: IReference[]; | ||
condition?: ICondition[]; | ||
model_version: string; | ||
created_at: string; | ||
updated_at: string; | ||
input_data?: IData[]; | ||
output_data?: IData[]; | ||
locked: boolean; | ||
public: boolean; | ||
name: string; | ||
notes: string; | ||
prerequisite_computation?: IComputation; | ||
software_configuration?: ISoftwareConfiguration[]; | ||
type: string; | ||
experiment?: IExperiment[]; | ||
} |
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,27 @@ | ||
import { ICondition, IData, IReference, ISoftwareConfiguration, ICitation, IExperiment, IIngredient, IProperty } from '.'; | ||
|
||
/** | ||
* A computational_process is a simulation that processes or changes a virtual material. | ||
* @see https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/6322994103e27d9176d5b10c/original/main-supporting-information.pdf#page=13 | ||
*/ | ||
export interface IComputationProcess { | ||
readonly node: ['ComputationProcess']; | ||
uid: string; | ||
uuid: string; | ||
type: string; | ||
citation?: ICitation[]; | ||
condition?: ICondition[]; | ||
model_version: string; | ||
created_at: string; | ||
updated_at: string; | ||
input_data?: IData[]; | ||
output_data?: IData[]; | ||
locked: boolean; | ||
public: boolean; | ||
name: string; | ||
notes: string; | ||
software_configuration?: ISoftwareConfiguration[]; | ||
experiment?: IExperiment[]; | ||
ingredient?: IIngredient[]; | ||
property?: IProperty[]; | ||
} |
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,19 @@ | ||
import { IData } from '.'; | ||
|
||
export interface ICondition { | ||
readonly node: ['Condition']; | ||
data?: IData[]; | ||
created_at?: string; | ||
updated_at?: string; | ||
descriptor?: string; | ||
key: string; | ||
measurement_id?: number; | ||
model_version?: string; | ||
set_id?: number; | ||
type?: string; | ||
uncertainty?: string; | ||
uncertainty_type?: string; | ||
unit?: string; | ||
uuid?: string; | ||
value: string; | ||
} |
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,29 @@ | ||
import { IComputation, IExperiment, IFile, IMaterial, IProcess } from '.'; | ||
|
||
export interface IData { | ||
readonly node: ['Data']; | ||
name: string; | ||
notes?: string; | ||
type?: string; | ||
uid?: string; | ||
uuid?: string; | ||
file?: IFile[]; | ||
file_count?: number; | ||
experiment?: IExperiment[]; | ||
citation?: []; // ICitation or ReferencePost | ||
citation_count?: number; | ||
computation_process?: []; //IComputationProcess | ||
computation_process_count?: number; | ||
process?: IProcess[]; | ||
process_count?: number; | ||
computation?: IComputation[]; | ||
computation_count?: number; | ||
created_at?: string; | ||
updated_at?: string; | ||
locked?: boolean; | ||
public?: boolean; | ||
material?: IMaterial[]; | ||
material_count?: number; | ||
model_version?: string; | ||
sample_preparation?: string; | ||
} |
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,23 @@ | ||
import { ICitation } from "./ICitation" | ||
import { ICondition } from "./ICondition"; | ||
import { IFile } from "./IFile"; | ||
|
||
/** | ||
* "Equipment are physical instruments, tools, glassware, etc. used in a process (...)" | ||
* @see https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/6322994103e27d9176d5b10c/original/main-supporting-information.pdf#page=21 | ||
* | ||
* Typing is from from API's schema | ||
*/ | ||
export interface IEquipment { | ||
key: string | undefined; // Not returned bu API yet. (@see https://trello.com/c/ZAR47EVX/10-equipment-schema-key-property-is-missing) | ||
citation?: ICitation[]; | ||
condition?: ICondition[]; | ||
created_at: string; | ||
description: string; | ||
file?: IFile[]; | ||
model_version: string; | ||
node: ['Equipment']; | ||
uid: string; | ||
updated_at: string; | ||
uuid: string; | ||
} |
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,25 @@ | ||
import { ICollection, IComputation, IComputationProcess, IData, IMaterial, IProcess } from '.'; | ||
|
||
export interface IExperiment { | ||
computation_count?: number; | ||
computation?: IComputation[]; | ||
computation_process_count?: number; | ||
computation_process?: IComputationProcess[]; | ||
created_at?: string; | ||
data?: IData[]; | ||
data_count?: number; | ||
locked?: boolean; | ||
material?: IMaterial[]; // this field is not implemented on the new API, but was present in the legacy API and is used in this project. | ||
material_count?: number; // TODO: remove auestion mark once new API adds the field. | ||
model_version?: string; | ||
name?: string; | ||
notes?: string; | ||
process?: IProcess[]; | ||
process_count?: number; | ||
public?: boolean; | ||
uid?: string; | ||
updated_at?: string; | ||
uuid?: string; | ||
collection?: ICollection[]; | ||
readonly node: ['Experiment']; | ||
} |
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,8 @@ | ||
export interface IFile { | ||
name: string; | ||
notes: string; | ||
type: string; | ||
uid: string; | ||
uuid: string; | ||
readonly node: ['File']; | ||
} |
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,11 @@ | ||
|
||
/** | ||
* @deprecated because identifiers are regular properties on IMaterial node. | ||
* | ||
* The data model describe it differently: "Identifiers are a sub-object for the material node and are unique labels or descriptive information for a material (...)" | ||
* https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/6322994103e27d9176d5b10c/original/main-supporting-information.pdf#page=16 | ||
*/ | ||
export interface IIdentifier { | ||
key: string; | ||
value: string | number | string[] | number[]; | ||
} |
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,83 @@ | ||
import { IMaterial, IQuantity } from "."; | ||
|
||
/** | ||
* "Ingredients are links to material nodes with the associated quantities. (...)" | ||
* Data model says @see https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/6322994103e27d9176d5b10c/original/main-supporting-information.pdf#page=21 | ||
* backend reference: | ||
* "IngredientPost": { | ||
"$id": "IngredientPost", | ||
"additionalProperties": false, | ||
"properties": { | ||
"created_at": { | ||
"default": "now()", | ||
"format": "date-time", | ||
"readOnly": true, | ||
"type": "string" | ||
}, | ||
"keyword": { | ||
"enum": [ | ||
"monomer", | ||
"polymer", | ||
"initiator", | ||
"catalyst", | ||
"solvent", | ||
"cta", | ||
"quench", | ||
"reagent", | ||
"workup", | ||
"intermediate", | ||
"computation", | ||
"filler", | ||
"matrix", | ||
"inert_carrier_gas" | ||
], | ||
"item": { | ||
"type": "string" | ||
}, | ||
"type": "array" | ||
}, | ||
"material": { | ||
"$ref": "MaterialPost" | ||
}, | ||
"model_version": { | ||
"$ref": "ModelVersion" | ||
}, | ||
"node": { | ||
"const": "Ingredient", | ||
"type": "string" | ||
}, | ||
"quantity": { | ||
"item": { | ||
"$ref": "QuantityPost" | ||
}, | ||
"type": "array" | ||
}, | ||
"updated_at": { | ||
"default": "now()", | ||
"format": "date-time", | ||
"readOnly": true, | ||
"type": "string" | ||
}, | ||
"uuid": { | ||
"default": "uuid()", | ||
"readOnly": true, | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"node", | ||
"material" | ||
], | ||
"type": "object" | ||
} | ||
*/ | ||
export interface IIngredient { | ||
material?: IMaterial[]; | ||
quantity?: IQuantity[]; | ||
created_at?: string; | ||
keyword?: string[]; | ||
model_version?: string; | ||
node: ['Ingredient']; | ||
updated_at?: string; | ||
uuid?: string; | ||
} |
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,13 @@ | ||
import { ICollection, IMaterial } from '.'; | ||
|
||
export interface IInventory { | ||
name: string; | ||
notes?: string; | ||
material_count?: number; | ||
material?: IMaterial[]; | ||
public?: boolean; | ||
uid?: string; | ||
uuid?: string; | ||
collection?: ICollection[]; | ||
readonly node: ['Inventory']; | ||
} |
Oops, something went wrong.