Skip to content

Commit 7ddd6be

Browse files
Kshemaahnatmorrell
andauthored
CLI Documentation for Users (#66)
Co-authored-by: Kshemaahna <[email protected]> Co-authored-by: Tom Morrell <[email protected]>
1 parent efecc4c commit 7ddd6be

22 files changed

+442
-1
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ keywords:
2525
- metadata
2626
- software
2727
- InvenioRDM
28-
date-released: 2025-03-13
28+
date-released: 2025-04-07

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ This returns the custom DOI of the record if it is successful.
7777
Only test your application on the test repository (`data.caltechlibrary.dev`). Testing the API on the public
7878
repository will generate junk records that are annoying to delete.
7979

80+
## Using the Command Line Interface
81+
82+
If you would like to interact with the CaltechDATA API using the Command line Interface (CLI), please refer to the documentation linked here:
83+
https://caltechlibrary.github.io/caltechdata_api/caltechdata_api/cli-documentation-for-users

caltechdata_api/Docs/CLI.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# CaltechDATA Command Line Interface (CLI) Documentation for Users
2+
3+
## Contents
4+
5+
1. Introduction
6+
7+
2. [Setup and Installation](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#setup-and-installation)
8+
9+
2.1 [For Mac OS Users](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#for-mac-os-users)
10+
11+
2.2 [For Windows Users](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#for-windows-users)
12+
13+
2.3 [Windows Subsystem for Linux](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#windows-subsystem-for-linux-users)
14+
15+
3. [Interacting with the CaltechDATA CLI](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#interacting-with-the-caltechdata-cli)
16+
17+
3.1 [CaltechDATA and the Test Instance of the Repository: Which Should I Use?]()
18+
19+
3.2 [For Mac OS Users](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#for-macos-users)
20+
21+
3.3 [For Windows and Windows Subsystem for Linux Users](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#for-windows-users-1)
22+
23+
4. [Additional Steps](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#additional-steps)
24+
25+
5. [Troubleshooting](https://github.com/Kshemaahna/research-data-assistants/blob/main/api-documentation/CLI-documentation-for-users.md#troubleshooting)
26+
27+
6. [Contact Us](https://github.com/Kshemaahna/research-data-assistants/edit/main/api-documentation/CLI-documentation-for-users.md#contact-us)
28+
29+
## Introduction
30+
The CaltechData API repository houses the codebase for accessing, uploading, and editing research data and metadata from Caltech's collections through a program or CLI. This API provides developers with endpoints to interact with datasets and retrieve relevant information.
31+
32+
## Setup and Installation:
33+
Requirements for a successful setup: you must have Python 3.6 or a later version installed on your system.
34+
35+
### For Mac OS Users:
36+
#### Step 1:
37+
Open the Terminal
38+
39+
#### Step 2:
40+
Install the Caltechdata_api Library via pip using the command shown:
41+
42+
`pip install caltechdata_api`
43+
44+
### For Windows Users:
45+
46+
#### Step 1:
47+
Go to https://github.com/caltechlibrary/caltechdata_api.git and click the green button that says "<> Code". Then choose the option that says "Download ZIP".
48+
49+
![alt text](<pictures-documentation/Screenshot 2024-12-03 095802 (1).png>)
50+
51+
#### Step 2:
52+
Extract the files from the downloaded zip file to a new folder (we recommend this folder be on the desktop and that you name this folder something easy to recall).
53+
54+
![alt text](<pictures-documentation/Screenshot 2024-12-03 100551 (1).png>)
55+
56+
#### Step 3:
57+
In the next few steps, we shall change the directory to the folder called "caltechdata_api" inside the folder you extracted from the downloaded ZIP file. To do this, go to the file you saved either on the file manager or on its location (this would be the desktop if you saved it there). Open the folder called "caltechdata_api_main" and then right click on the folder inside it called "caltechdata_api" and choose the option that says "copy as path".
58+
59+
![alt text](<pictures-documentation/Screenshot 2024-12-03 102205 (1).png>)
60+
61+
Above: Open the file on file manager as shown.
62+
63+
![alt text](<pictures-documentation/Screenshot 2024-12-03 102022 (1).png>)
64+
65+
Above: Go into the folder caltechdata_api_main.
66+
67+
![alt text](<pictures-documentation/Screenshot 2024-12-03 102033 (1).png>)
68+
69+
Above: Right click on the folder called caltechdata_api and choose the option that says copy as path.
70+
71+
#### Step 4:
72+
Open a the Windows PowerShell or a code editor (we recommend using VSCode if you choose to use a code editor) and then open its Terminal.
73+
74+
![alt text](<pictures-documentation/Screenshot 2024-12-03 101040 (1).png>)
75+
Above: Using Visual Studio Code (VSCode)
76+
77+
![alt text](<pictures-documentation/Screenshot 2024-12-16 085423 (1).png>)
78+
Above: Using Windows PowerShell
79+
80+
#### Step 5:
81+
Open the dropdown menu near the "+" icon on the top right hand corner of the terminal and choose the option that says "Git Bash". You can skip this step and go directly to the next step if you are using the Windows Powershell.
82+
83+
![alt text](<pictures-documentation/Screenshot 2024-12-03 101159 (1).png>)
84+
85+
#### Step 6:
86+
Type in the command as shown:
87+
88+
```cd <paste the file path you copied here>```
89+
90+
For example, it could look like this:
91+
92+
```cd "C:\Users\kshem\Desktop\Demonstration\caltechdata_api-main\caltechdata_api"```
93+
94+
![alt text](<pictures-documentation/Screenshot 2024-12-03 103050 (1).png>)
95+
Above: Using Visual Studio Code (VSCode)
96+
97+
![alt text](<pictures-documentation//Screenshot 2024-12-16 121453 (1).png>)
98+
Above: Using Windows PowerShell
99+
100+
### Windows Subsystem for Linux Users:
101+
The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu) and use Linux applications, utilities, and Bash command-line tools directly on Windows. [1](https://learn.microsoft.com/en-us/windows/wsl/). In order to interact with the CaltechDATA CLI, you may use a BASH terminal on WSL.
102+
103+
#### Step 1:
104+
Install the Windows Subsystem for Linux (WSL).
105+
106+
```wsl --install```
107+
108+
#### Step 2:
109+
Open the Terminal. Click the arrow on the top left near the tab open and choose "BASH".
110+
111+
### Step 3:
112+
Then, as in step 6, Type in the command as shown:
113+
114+
```cd <paste the file path you copied here>```
115+
116+
For example, it could look like this:
117+
118+
```cd "C:\Users\kshem\Desktop\Demonstration\caltechdata_api-main\caltechdata_api"```.
119+
120+
## Interacting with the CaltechDATA CLI
121+
The CaltechDATA Command Line Interface (CLI) helps you interact with the CaltechDATA repository to upload research data, link your data with your publications, and assign a permanent DOI to your dataset so that others can reference the dataset. You can access the datasets you create or edit at https://data.caltech.edu/.
122+
123+
### The Test Instance or the CaltechDATA Repository
124+
If you would like to create and edit a test record of your datset before uploading it to the CaltechDATA Repository and generating a permanent DOI, you can also use the CaltechDATA Command Line Interface (CLI) to interact with the test instance of the CaltechDATA Repository that you can access at https://data.caltechlibrary.dev/.
125+
126+
We recommend using the CLI to interact with the test instance if you are not ready to generate a permanent DOI but would like to experiment to avoid creating junk records on the original CaltechDATA Repository. In general, users create and edit datasets in the same way regardless of whether the dataset exists on the original CaltechDATA Repository or the test instance.
127+
128+
Now we shall outline the steps to interact with the CLI.
129+
130+
### For MacOS Users
131+
Run the command shown in order to interact with the CaltechDATA Repository:
132+
133+
```caltechdata_api```
134+
135+
Run the command shown to interact with the test instance of the CaltechDATA Repository:
136+
137+
```caltechdata_api -test```
138+
139+
### For Windows Users and Windows Subsystem for Linux Users:
140+
#### Step 1:
141+
To interact with the CaltechDATA Repository, type in this command as shown to open and run the CaltechDATA Command Line Interface (CLI):
142+
143+
```python cli.py```
144+
145+
![alt text](<pictures-documentation/Screenshot 2024-12-03 103511 (1).png>)
146+
Above: Using Visual Studio Code (VSCode)
147+
148+
![alt text](<pictures-documentation/Screenshot 2024-12-16 121512 (1).png>)
149+
Above: Using Windows PowerShell
150+
151+
To interact with the test instance of the CaltechDATA Repository, type in this command as shown to open and run the CaltechDATA Command Line Interface (CLI):
152+
153+
```python cli.py -test```
154+
155+
![alt text](<pictures-documentation/Screenshot 2024-12-16 090338 (1).png>)
156+
Above: Using Visual Studio Code (VSCode)
157+
158+
![alt text](<pictures-documentation/Screenshot 2024-12-16 091234 (1).png>)
159+
Above: Using Windows PowerShell
160+
161+
#### Step 2:
162+
Although the CLI setup is complete, there is one additional step required before you can begin interacting with the CLI.
163+
164+
Note that the terminal is now present in the "caltechdata_api" folder or directory and can only access the files there. Please save the files you would like to upload in this particular folder. To check if your files are in this folder and thus, visible to the terminal you can run the following command to display the files in the current directory:
165+
166+
```dir```
167+
168+
![alt text](<pictures-documentation/Screenshot 2024-12-03 115919 (1).png>)
169+
Above: Adding your files to the directory
170+
171+
![alt text](<pictures-documentation/Screenshot 2024-12-03 120012 (1).png>)
172+
Above: Using Visual Studio Code (VSCode)
173+
174+
![alt text](<pictures-documentation/Screenshot 2024-12-16 121606 (1).png>)
175+
Above: Using Windows PowerShell
176+
177+
## Additional Steps:
178+
179+
### Creating A Token:
180+
In order to create or edit datasets you'll need to create a token. In order to this, you'll need to open the platform you are uploading your dataset to (the original CaltechDATA Repository or the test instance of it) and log in. Then follow these steps:
181+
182+
#### Step 1:
183+
On the top right click the person icon and choose "Applications" from the dropdown menu that appears.
184+
185+
#### Step 2:
186+
Click the option that says "New Token" and name your token.
187+
188+
### What Files You'll Need to Create A New Dataset:
189+
In order to create a new dataset, you will need a:
190+
191+
1) File containing your dataset (csv or json file)
192+
2) A metadata file (json file)
193+
194+
We use a customised version of Datacite 4.3 Schema which you can download here https://github.com/datacite/schema/blob/master/source/json/kernel-4.3/datacite_4.3_schema.json. Otherwise you can use your own.
195+
196+
## Troubleshooting
197+
#### My ORCID doesn't work:
198+
Input the ORCID without any hyphens.
199+
200+
#### What is my unique identifier/record id?
201+
Your record id is the last part of the DOI link your dataset is linked to. It is the part that comes after the last forward slash. For example: if your DOI link is https://doi.org/10.33569/5t2wh-1e586, then your record id is 5t2wh-1e586.
202+
203+
## Contact Us
204+
For further questions, email [email protected] or visit the FAQs at https://libanswers.caltech.edu/search/?t=0&adv=1&topics=CaltechDATA.

0 commit comments

Comments
 (0)