Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha 2 bugs and things #91

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 46 additions & 111 deletions cli/Company.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,53 @@
### Company Command Line Interface (CLI)
Key capabilities of this tool:
- Report on either all company objects or by specific properties like *id*, *name*, *region*, *country*, and so on.
- Pick from one of four report output formats for company objects: *table* default, *json*, *csv*, or *xlsx*.
- Create one or more company objects from a specified json file.
- Delete a company object by specifying the company's id (Note: this is not yet implemented).
- Create a Microsoft DOCX formatted report for a specific company object as specified by the company's *id*.
# Companies
Company objects are central to Mediumroast for GitHub. [Interactions](./Interaction.md) and in the future Studies rely on Companies to function. After setup is run, via `mrcli setup`, two companies are present to work with. Additional companies can be added, updated, or removed; essentially, `company` is an `mrcli` sub-command that affords users Create, Read, Update and Delete capabilities. Each of the major functions for `mrcli company` are described in this document.

#### Print usage information to the console
Command: `mr_cli company --help`
##### Example output:
```
Usage: mr_cli company [options]
## Notice
Some of the command line options and switches may not yet be implemented; therefore, if a switch or option is not yet implemented the CLI will inform the user and then exit.

Command line interface for mediumroast.io Company objects.
# Help
Prints the usage for the `company` sub-command and exits.
## Command(s) run
- `mrcli company --help`
## Screenshot with output
<img width="1266" alt="companies_help" src="https://github.com/mediumroast/mediumroast_js/assets/10818650/6cd07f6f-02ad-4cac-8221-cb7af3307e26">

Options:
-V, --version output the version number
-c --conf_file <file> Path to the configuration file (default: "/Users/mihay42/.mediumroast/config.ini")
-r --rest_server <server> The URL of the target mediumroast.io server (default: "http://cherokee.from-ca.com:16767")
-a --api_key <key> The API key needed to talk to the mediumroast.io server
-u --user <user name> Your user name for the mediumroast.io server
-s --secret <user secret or password> Your user secret or password for the mediumroast.io server
-o --output <choose the output type to emit> Select output type: table, json, xls or csv. xls & csv will save to a file. (default: "table")
--find_by_name <name> Find an individual Interaction by name
--find_by_id <ID> Find an individual Interaction by ID
--find_by_x <JSON> Find object by an arbitrary attribute as specified by JSON (ex '{"zip_postal":"92131"}')
--create <file.json> Add objects to the backend by specifying a JSON file
--update <JSON> Update an object from the backend by specifying the object's id and value to update in JSON
--delete <ID> Delete an object from the backend by specifying the object's id
--report <ID> Create an MS word document for an object by specifying the object's id
--package An additional switch used with --report to generate a ZIP package that includes the interaction
-h, --help display help for command
```
# List company objects
Print out one or more Companies to the command line or an alternative output mechanism like a CSV file. Filtering can be applied to find Companies with specific attributes.

#### List all companies and output in table output
Command: `company`
##### Example output:
```
┌─────┬────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────┐
│ Id │ Name │ Description │
├─────┼────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ 2 │ Federos │ Federos is a provider of AI-optimized assurance, analytics, and automation… │
├─────┼────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ 3 │ Intraway │ With over 40 million subscribers successfully served in more than 20 count… │
├─────┼────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ 4 │ Incognito │ Our productized service orchestration platforms allow cable, fiber, and fi… │
├─────┼────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ 1 │ OpenVault │ OpenVault and OpenVault Europe GmbH are market-leading sources of broadban… │
└─────┴────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┘
```
## List all company objects in a table format
This is the default output when running `mrcli c` or `mrcli company` which prints a text table to STDOUT.
### Command(s) run
- `mrcli c`
- `mrcli company`
### Screenshot with output
<img width="1266" alt="companies_table" src="https://github.com/mediumroast/mediumroast_js/assets/10818650/af9d22d8-4161-4ae9-9c57-06b65769a54e">

## List all company objects in JSON format
Output a list of company objects in properly formatted JSON to STDOUT which can be viewed, redirected to a file, or piped to another command.
### Command(s) run
- `mrcli c --output=json`
- `mrcli company --output=json`
### Screenshot with output
<img width="1178" alt="companies_json" src="https://github.com/mediumroast/mediumroast_js/assets/10818650/22d46cd2-952f-4c3b-8e74-37bdceefee2a">

## List all company objects and output to a CSV or XLSX
Company data can be output in either a CSV or XLSX files to enable consumption in common tools like Microsoft Excel. The resulting files will be stored in $HOME/Documents directory as `Mr_Companies.csv` or `Mr_Companies.xlsx` depending on your intended output.
### Command(s) run
- `mrcli c --output=csv`
- `mrcli c --output=xls`
### Screenshot of commands being run
<img width="1530" alt="companies_csv" src="https://github.com/mediumroast/mediumroast_js/assets/10818650/f135de7a-aba8-4ed0-9198-64ff50797d4c">
### Screenshot of CSV imported into MacOS numbers
<img width="1627" alt="companies_numbers" src="https://github.com/mediumroast/mediumroast_js/assets/10818650/6ab2266b-bacc-4cb0-9608-db8025866ccb">

## Filter company outputs
The CLI offers the ability to filter outputs by almost any company attribute. This is manifest by two switches on the company sub-command one specific to finding companies by name, `--find_by_name` and the other by an arbitrary attribute, `--find_by_x`. Note all output format options, like JSON, CSV, etc., are available when the outputs are filtered.
### Filter in a company by name
To zero in on a specific company using the find by name switch is provided.
### Command(s) run
- `mrcli c --find_by_name="Mediumroast, Inc."`
### Screenshot with output
<img width="1530" alt="companies_filter_by_name" src="https://github.com/mediumroast/mediumroast_js/assets/10818650/4d6d88eb-740f-4d4d-a16b-bea12be54330">

#### List a single company by the object id and output in JSON
Command: `company --find_by_id=1 --output=json`
##### Example output:
```
[
{
id: 1,
name: 'OpenVault',
industry: 'Services | Business Services | Computer Programming, Data Processing, And Other Computer Related Services',
role: 'Owner',
url: 'https://openvault.com',
logo_url: 'http://openvault.com/NEW-SITE-OV3/wp-content/uploads/2021/01/different-blue@3x.png',
street_address: '111 Town Square Place Suite 1180',
city: 'Jersey City',
state_province: 'New Jersey',
country: 'USA',
region: 'AMER',
phone: '+1-201-677-8480',
icon: 'http://openvault.com/NEW-SITE-OV3/wp-content/uploads/2021/01/different-blue@3x.png',
description: 'OpenVault and OpenVault Europe GmbH are market-leading sources of broadband technology solutions and data-driven insights into worldwide broadband consumption patterns. The companies’ cloud- based, SaaS solutions and tools help service providers optimize network performance, increase revenue and improve subscriber satisfaction. OpenVault and OpenVault Europe aggregate and analyze the resulting market data to provide unparalleled granular views of consumer usage that can be used to anticipate residential and business broadband trends.',
cik: 'Unknown',
linked_interactions: {
'201004290000-OpenVault Competitive Study-OpenVault': '1',
'201512030000-OpenVault Competitive Study-OpenVault': '2',
'201606060000-OpenVault Competitive Study-OpenVault': '3',
'201607060000-OpenVault Competitive Study-OpenVault': '7',
'201702030000-OpenVault Competitive Study-OpenVault': '8',
...
'202106240000-OpenVault Competitive Study-OpenVault': '20',
'202106300000-OpenVault Competitive Study-OpenVault': '35'
},
linked_studies: {
'OpenVault Competitive Study': '03d20485a74f3a5371b379597eee194d57e635ff56d1c1b5a79b85bc87ae2b54'
},
stock_symbol: 'Unknown',
recent10k_url: 'Unknown',
recent10q_url: 'Unknown',
zip_postal: '07310',
latitude: 40.71748000000008,
longitude: -74.04384999999996,
topics: {
'care |': 8.941359041754604,
'consumption levels': 10.441359041754604,
'customer care': 20.202859052173412,
'customer support': 10.253453034755818,
'data growth': 9.972406038255212,
'data usage': 11.753453034755818,
'live streaming': 9.096030365208183,
'streaming market': 8.941359041754604,
'traditional pay- tv': 9.479648278867261,
'video streaming': 11.472406038255212,
'| open vault': 30.269000062512852
},
comparison: { '2': [Object], '3': [Object], '4': [Object] },
summary: 'Unknown',
abstract: 'Unknown'
}
]
```
#### List all companies and output in CSV format
Command: `mr_cli company --output=csv`

Notice: This command saves the file to your environment's *HOME/Documents* directory called *Mr_Companies.csv*.

##### Screenshot of the resulting CSV file in Apple Numbers
*UPDATE ME*
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"axios": "^0.25.0",
"better-docs": "^2.7.2",
"chalk": "^5.0.0",
"node-geocoder": "^4.3.0",
"rollup": "^2.66.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
Expand Down Expand Up @@ -69,7 +70,6 @@
"inquirer": "^9.1.2",
"mediumroast_js": "^0.3.6",
"node-fetch": "^3.2.10",
"node-geocoder": "^4.2.0",
"octokit": "^3.1.2",
"open": "^9.1.0",
"ora": "^6.1.2",
Expand Down
Loading