A portal for viewing antimicrobial resistance (AMR) data
git clone https://github.com/Ensembl/amr-portal.git
cd amr-portal
- Install requirements
cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Create a .env File
# .env
DUCKDB_PATH=path/to/duckdb/file.duckdb
Or
export DUCKDB_PATH=path/to/duckdb/file.duckdb# make sure you're in the *root directory*
cd ..
uvicorn backend.main:app --reloadSwagger UI: http://localhost:8000/docs
For production use:
uvicorn backend.main:app --host 0.0.0.0 --port 8000 --workers 4For testing:
Create a .env.test file in the project root with the following content:
DUCKDB_PATH=path/to/test_data.duckdb
Then run:
TESTING=true pytest backend/curl -X 'GET' \
'http://localhost:8000/filters-config' \
-H 'accept: application/json'
curl -X 'POST' \
'http://localhost:8000/amr-records' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"selected_filters": [
{ "category": "phenotype-genus", "value": "Streptococcus" },
{ "category": "phenotype-Antibiotic_abbreviation", "value": "OXA" },
{ "category": "phenotype-Antibiotic_abbreviation", "value": "AMK" }
],
"view_id": 1,
"order_by": {
"category": "phenotype-collection_date",
"order": "DESC"
}
}'
curl -X 'POST' \
'http://localhost:8000/amr-records' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"selected_filters": [
{ "category": "genotype-Contig_id", "value": "CQKJ01000001.1" },
{ "category": "genotype-Contig_id", "value": "DAFBZU010000245.1" }
],
"view_id": 2,
"order_by": {
"category": "genotype-Contig_id",
"order": "DESC"
}
}'
curl -X 'POST' \
'http://localhost:8000/amr-records/download' \
-H 'Content-Type: application/json' \
-d '{
"selected_filters": [
{ "category": "phenotype-genus", "value": "Streptococcus" },
{ "category": "phenotype-Antibiotic_abbreviation", "value": "OXA" },
{ "category": "phenotype-Antibiotic_abbreviation", "value": "AMK" }
],
"view_id": 1,
"order_by": {
"category": "phenotype-collection_date",
"order": "DESC"
}
}'
curl -X 'POST' \
'http://localhost:8000/amr-records/download?scope=all&file_format=json' \
-H 'Content-Type: application/json' \
-d '{
"selected_filters": [
{ "category": "phenotype-genus", "value": "Streptococcus" }
],
"view_id": 1,
"order_by": {
"category": "phenotype-collection_date",
"order": "DESC"
}
}'
Prerequisite: need to have Node installed. As a rule of thumb, always use the latest LTS version of Node.
cd frontend
npm install
npm run dev
cd frontend
npm install
npm run build
This will create a dist directory containing a static html file and all the assets that it loads.
The frontend combines a static site built with Eleventy with islands of interactivity built with web components and Lit. For more details about the build setup, see frontend/eleventy.config.js, and the documentation in the docs/decisions directory.