Skip to content

Commit

Permalink
Improve README and CONTRIBUTING to make the project more accessible. (#…
Browse files Browse the repository at this point in the history
…632)

### Related issues

- Closes #600 

### Summary

- adds CONTRIBUTING.md for main repository, frontend, and backend
- changes README.md for main repository, frontend, and backend
- improves documentation and adds useability improvement for local
usage, development, and testing.

### Checks

- [ X ] All tests have passed (or issues created for failing tests)

Failing frontend is known issue.

---------

Co-authored-by: glass-ships <[email protected]>
  • Loading branch information
amc-corey-cox and glass-ships authored Mar 13, 2024
1 parent 25f4d33 commit af63421
Show file tree
Hide file tree
Showing 14 changed files with 749 additions and 253 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.12
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team representative, [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
109 changes: 109 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Welcome to the Monarch Initiative

The Monarch Initiative is an extensive knowledge graph and ecosystem of tools made for the benefit of clinicians, researchers, and scientists. The knowledge graph consists of millions of entities – genes, diseases, phenotypes, and many more – imported from dozens of sources. While we have a core development team, we welcome the contributions of the community to help us maintain and improve the knowledge graph and the tools that use it.

# Table of Contents

- [Useful Links](#important-links)
- [Community Guidelines](#community-guidelines)
- [Monarch App](#monarch-app)
- [Requirements](#requirements)
- [Backend Requirements](#backend-requirements)
- [Frontend Requirements](#frontend-requirements)
- [Other Requirements](#other-requirements)
- [Getting Started](#getting-started)
- [Makefile](#makefile)
- [Quick Start](#quick-start)
- [Testing and Development](#testing-and-development)
- [Backend](#backend)
- [Frontend](#frontend)
- [Deploying Monarch](#deploying-monarch)

# Useful Links

- [Monarch Documentation](https://monarch-initiative.github.io/monarch-documentation/) - In addition to the documentation here, we have a separate documentation site that is automatically generated from the codebase, which encompasses the entire Monarch Initiative ecosystem, as well as the release process and other important information.
- [Monarch Py Documentation](https://monarch-initiative.github.io/monarch-app/) - The Monarch Py documentation contains information on the Python library for interacting with the Monarch Initiative knowledge graph, as well as the FastAPI module that serves as the website's backend.
- [Monarch App Website](https://next.monarchinitiative.org/) - The Monarch Initiative website, a Vue web app using `monarch-py` as the backend.

# Community Guidelines

We welcome you to our community! We seek to provide a welcoming and safe development experience for everyone. Please read our [code of conduct](CODE_OF_CONDUCT.md) and reach out to us if you have any questions. We welcome your input!

# Monarch App

[![documentation](https://img.shields.io/badge/-Documentation-purple?logo=read-the-docs&logoColor=white&style=for-the-badge)](https://monarch-initiative.github.io/monarch-documentation/)

[**⭐️⭐️ View the website ⭐️⭐️**](https://next.monarchinitiative.org/)

The monarch-app repository is a monorepo that contains the projects necessary to build and run the web app at monarchinitiative.org and the appropriate tooling and developer resources to continue development. The frontend for the Monarch Initiative website is a javascript/typescript webapp developed using the Vue toolkit. The backend, also referred to as `monarch-py`, is a Python library for interacting with the Monarch Initiative knowledge graph. The `monarch-py` backend also includes an optional FastAPI module that serves as the website's backend and related services for enabling the frontend.

## Requirements

The Monarch Initiative website tool chain has a few requirements that you may need to install before we are ready to work on testing or development. Here is the list of requirements and what they are used for. If you are only working on a portion of the code-base you may not need all of the tools below.

### Backend Requirements

- Python - Most of us use Python version 3.10.12 for development and try to be compatible with versions 3.9-3.12.
- [Poetry](https://python-poetry.org/docs/#installation) - We use Poetry to manage dependencies in `monarch-py`
- [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation) (suggested) - I recommend using pyenv to manage your Python version within different projects

### Frontend Requirements

- [Bun](https://bun.sh/docs/installation) - Bun is used as a drop-in replacement for Node (non-browser JavaScript runtime environment) and Yarn (package manager). If you already have Node.js installed you Bun will not conflict with your Node.js environment and can be installed as a module. The frontend/CONTRIBUTING.md has simple instructions on how to install Bun.

### Other Requirements

- Docker - Image files used for development and testing for both frontend and backend (required for Solr)
- Rust (cargo) - Required for running the semsimian server locally

## Getting Started

To get started with development in monarch-app clone the repo and navigate to the directory.

```shell
git clone [email protected]:monarch-initiative/monarch-app.git
cd monarch-app
```

In order to maintain a clean system environment you may want to create a local python environment. I also recommend setting a local python version of 3.10 with pyenv. You can do both with the following commands.

```shell
pyenv install 3.10.12
pyenv local 3.10.12
python -m venv .venv
```

When the new virtual environment is created, you may want to do some peronal modifications to the envoronment. I edit the `activate` script to name the virtual environment more meaningfully and also install `poetry` locally (my preference, `activate` then run `pip install poetry`). After the virtual environment is set up you will want to start it before each development session by running `activate` (or in your IDE). To exit the environment run `deactivate`.

### Makefile

The monarch-app repo uses a Makefile system to facilitate and simplify some of the development setup and deployment tasks. For detailed information on the build targets and details of implementation please refer to the [Makefile](Makefile) in the monarch-app directory.

### Quick Start
For a quick-start, once the requirements above are met you can install and launch a working local version of the Monarch App with the following commands.

```shell
cd monarch-app
make install
monarch solr download
monarch solr start
cd frontend
bun run dev
```

Once these commands are run you should have a working version of the Monarch App running from your local system.
_Note_: You may have to resolve some permissions issues with solr in order to download and start monarch solr.

# Testing and Development

## Backend

For detailed information the backend please refer to the [README.md](./backend/README.md) and [CONTRIBUTING.md](./backend/CONTRIBUTING.md) file in the backend directory. Additional information can be find in the [documentation](https://monarch-app.monarchinitiative.org)

## Frontend

More detailed information on frontend development and run options can be found at the [frontend README.md](./frontend/README.md) and [CONTRIBUTING.md](./frontend/CONTRIBUTING.md) files in the frontend directory. Additional information can be found in the [documentation](https://monarch-app.monarchinitiative.org)

# Deploying to Monarch

For documentation on deploying to monarch please see the [Monarch documentation](https://monarch-initiative.github.io/monarch-documentation/release-process/) regarding the release process.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# Monarch App
# Welcome to the Monarch Initiative

The Monarch Initiative is an extensive knowledge graph and ecosystem of tools made for the benefit of clinicians, researchers, and scientists. The knowledge graph consists of millions of entities – genes, diseases, phenotypes, and many more – imported from dozens of sources.

We welcome the contributions of the community to help us maintain and improve the knowledge graph and the tools that use it. To help get started on contributing to the Monarch Initiative, please see our CONTRIBUTING.md file.

[![documentation](https://img.shields.io/badge/-Documentation-purple?logo=read-the-docs&logoColor=white&style=for-the-badge)](https://monarch-initiative.github.io/monarch-app/docs)
# Monarch App
[![documentation](https://img.shields.io/badge/-Documentation-purple?logo=read-the-docs&logoColor=white&style=for-the-badge)](https://monarch-initiative.github.io/monarch-documentation/)
![](https://github.com/monarch-initiative/monarch-app/actions/workflows/test-backend.yaml/badge.svg)
![](https://github.com/monarch-initiative/monarch-app/actions/workflows/test-frontend.yaml/badge.svg)
![](https://github.com/monarch-initiative/monarch-app/actions/workflows/deploy-documentation.yaml/badge.svg)
![](https://github.com/monarch-initiative/monarch-app/actions/workflows/build-image.yaml/badge.svg)

[**⭐️⭐️ View the website ⭐️⭐️**](https://next.monarchinitiative.org/)

This repository contains the source code for the Monarch Initiative website (a Vue webapp),
as well as `monarch-py`, a Python library for interacting with the Monarch Initiative knowledge graph,
which includes an optional FastAPI module that serves as the website's backend.
The monarch-app repo contains the source code for the Monarch Initiative website (a Vue webapp),
as well as `monarch-py`, a Python library for interacting with the Monarch Initiative knowledge graph. The `monarch-py` library also includes a FastAPI module that serves as the website's backend. Together, the frontend and backend make up the stack used to deply and run the Monarch Initiative website.

If you wish to run Monarch-App as a local web application, please install the requirements below and then follow on to the usage section to start the application. Refer to [Using Local Data](#using-local-data) to see how you can run the full Monarch website locally and use your own data store.

### For developers

To get started with this repo:
### For developers

```
git clone https://github.com/monarch-initiative/monarch-app
cd monarch-app
```
The monarch-app repository contains the code to run the Monarch Initiative website in the `frontend` and `backend` directories as well as documentation, helper scripts, Docker files and services to help set up a local environment for development and for deployment.

Then see `Makefile` or the individual `/frontend` and `/backend` folders for how you can install, develop, build, test, lint, or format the frontend or backend.
To start development, please refer to the CONTRIBUTING.md document with this README. If you are planning to only develop the frontend or backend of the application you can refer directly to the README and CONTRIBUTING files in each of those sections.
37 changes: 37 additions & 0 deletions backend/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Welcome to the Monarch Initiative

The Monarch Initiative is an extensive knowledge graph and ecosystem of tools made for the benefit of clinicians, researchers, and scientists. The knowledge graph consists of millions of entities – genes, diseases, phenotypes, and many more – imported from dozens of sources. While we have a core development team, we welcome the contributions of the community to help us maintain and improve the knowledge graph and the tools that use it.

This CONTRIBUTING.md is for the monarch-app backend, also refered to as monarch-py, usable as either a python module or a local CLI.

# Useful Links

- [Monarch Documentation](https://monarch-initiative.github.io/monarch-documentation/) - In addition to the documentation here, we have a separate documentation site that is automatically generated from the codebase, which encompasses the entire Monarch Initiative ecosystem, as well as the release process and other important information.
- [Monarch Py Documentation](https://monarch-initiative.github.io/monarch-app/) - The Monarch Py documentation contains information on the Python library for interacting with the Monarch Initiative knowledge graph, as well as the FastAPI module that serves as the website's backend.
- [Monarch App Website](https://next.monarchinitiative.org/) - The Monarch Initiative website, a Vue web app using `monarch-py` as the backend.

### Running the API:

#### Local development:

- Connect to and expose the SOLR database:
`gcloud compute ssh monarch-solr-dev -- -L 8983:localhost:8983`

- Start the uvicorn server:
`cd <path-to>/monarch-api && uvicorn main:app --reload`

#### GCP deployment:

- First, connect to the GCP SOLR machine:
`gcloud compute ssh monarch-api-dev -- -L 8000:localhost:8000`

- Then, start the uvicorn server:
`nohup uvicorn main:app --reload --host 0.0.0.0 &`

#### Building and using the Docker image:

- Build the docker image:
`docker build --rm --tag us-central1-docker.pkg.dev/monarch-initiative/monarch-api/monarch-api:{VERSION} . `

- Push the docker image:
`docker push us-central1-docker.pkg.dev/monarch-initiative/monarch-api/monarch-api:{VERSION}`
72 changes: 70 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,78 @@

[![documentation](https://img.shields.io/badge/-Documentation-purple?logo=read-the-docs&logoColor=white&style=for-the-badge)](https://monarch-initiative.github.io/monarch-app)

Monarch-Py is a Python library for interfacing with the Monarch Initiative Knowledge graph.
It can be used from CLI, as a module, or as a FastAPI app
Monarch-Py is a Python library for interfacing with the Monarch Initiative Knowledge graph. The monarch-py package can be used from CLI, as a module, or as a FastAPI app.

# Requirements

If you are running the whole monarch-app suite locally you will want to review the [README.md](../README.md) or [CONTRIBUTING.md](../CONTRIBUTING.md) files in the repository root for information on the requirements for monarch-app at large. If you intend to run just the backend for end-user usage or testing you will only need the following prerequisites.

- Python version 3.9+, version 3.10.12 recommended for development.
- [Poetry](https://python-poetry.org/docs/#installation) - For managing dependencies in monarch-py.
- [Docker](https://docs.docker.com/get-docker/) - For running the Solr instance locally.
- [Rust](https://www.rust-lang.org/tools/install) - For running the semsimian server locally.

For development of monarch-py, please refer to the [backend/CONTRUBUTING.md](CONTRIBUTING.md) for additional details.

# Usage

Basic installation can be performed using pip/pipx or your favorite package manager.

```
pip install monarch-py
```

The monarch-py module and CLI use the Monarch-KG using a Solr instance running locally.
This requires Docker to be installed and running on your computer.

```
monarch solr download
monarch solr start
```

This will download and then run the monarch Solr image locally on port 8983.
*Note* You may need to change permissions on the file in order to install and run the Solr container.

```
sudo chgrp -R 8983 ~/.data/monarch
sudo chmod -R g+w ~/.data/monarch
```

To check if Solr is running correctly on your computer you can check you can check using Docker or the monarch CLI.

Using Docker:

```
docker ps
```

For docker you should see output resembling this:

```
66da4aeed48e solr:8 "docker-entrypoint.s…" 3 weeks ago Up 5 days 0.0.0.0:8983->8983/tcp, :::8983->8983/tcp monarch_solr
```

Using the monarch CLI:

```
monarch solr status
```

For the monarch CLI you should see output similar to this:

```
Checking for Solr container...
Found monarch_solr container: 66da4aeed48e7f71241f85f31f1e3366f9255cb53b78f16b13fb79bcfb2b36f2
Container status: running
```

monarch-ingest creates it's own Solr docker instance which mounts its own data output from closurizer and makes it's own Solr artifact.

# Developers

For instructions on how to test monarch-py locally or how to start with developing please see the [CONTRIBUTING.md](../CONTRIBUTING.md) file in the root of the Monarch-App repository.
For instructions specific to monarch-py (the Monarch-App backend), see the [backend/CONTRIBUTING.md](./CONTRIBUTING.md) file.

## For Developers

Expand Down
Loading

0 comments on commit af63421

Please sign in to comment.