hacs-api


Namehacs-api JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryFastAPI service for HACS (Healthcare Agent Communication Standard)
upload_time2025-07-09 14:52:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseApache-2.0
keywords agents api fastapi fhir healthcare
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # HACS API

FastAPI service for Healthcare Agent Communication Standard (HACS).

## Overview

`hacs-api` provides a production-ready REST API service built with FastAPI for managing HACS healthcare data. It offers comprehensive endpoints for patients, observations, encounters, and agent communications with built-in authentication, validation, and FHIR compliance.

## Key Features

### REST API Endpoints
- **Patients**: CRUD operations for patient management
- **Observations**: Clinical data and measurements
- **Encounters**: Healthcare visits and episodes
- **Agent Messages**: Inter-agent communications
- **Evidence**: Clinical evidence and guidelines

### Authentication & Security
- JWT-based authentication
- Role-based access control
- API key management
- Request rate limiting
- CORS support

### FHIR Compliance
- FHIR R5 compatible endpoints
- Standard resource formats
- FHIR search parameters
- Bulk data operations

## Installation

```bash
pip install hacs-api
```

## Quick Start

### Start the API Server
```bash
# Using the CLI
hacs-api

# Or using uvicorn directly
uvicorn hacs_api.main:app --host 0.0.0.0 --port 8000
```

### API Usage
```python
import requests

# Create a patient
patient_data = {
    "display_name": "John Doe",
    "birth_date": "1980-01-01",
    "gender": "male"
}

response = requests.post(
    "http://localhost:8000/api/v1/patients",
    json=patient_data,
    headers={"Authorization": "Bearer YOUR_TOKEN"}
)

patient = response.json()
patient_id = patient["id"]

# Get patient
response = requests.get(
    f"http://localhost:8000/api/v1/patients/{patient_id}",
    headers={"Authorization": "Bearer YOUR_TOKEN"}
)

# Create observation
observation_data = {
    "patient_id": patient_id,
    "observation_type": "blood_pressure",
    "value": {"systolic": 120, "diastolic": 80},
    "unit": "mmHg"
}

response = requests.post(
    "http://localhost:8000/api/v1/observations",
    json=observation_data,
    headers={"Authorization": "Bearer YOUR_TOKEN"}
)
```

## API Endpoints

### Patient Management
- `GET /api/v1/patients` - List patients
- `POST /api/v1/patients` - Create patient
- `GET /api/v1/patients/{id}` - Get patient
- `PUT /api/v1/patients/{id}` - Update patient
- `DELETE /api/v1/patients/{id}` - Delete patient

### Clinical Data
- `GET /api/v1/observations` - List observations
- `POST /api/v1/observations` - Create observation
- `GET /api/v1/patients/{id}/observations` - Get patient observations

### Agent Communications
- `GET /api/v1/messages` - List messages
- `POST /api/v1/messages` - Send message
- `GET /api/v1/messages/{id}` - Get message

## Configuration

### Environment Variables
```bash
# Database
DATABASE_URL=postgresql://user:pass@localhost/hacs

# Authentication
JWT_SECRET_KEY=your-secret-key
JWT_ALGORITHM=HS256
JWT_EXPIRATION_HOURS=24

# API Settings
API_V1_PREFIX=/api/v1
CORS_ORIGINS=["http://localhost:3000"]
```

### Docker Deployment
```dockerfile
FROM python:3.11-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
EXPOSE 8000

CMD ["uvicorn", "hacs_api.main:app", "--host", "0.0.0.0", "--port", "8000"]
```

## Authentication

### JWT Token Authentication
```python
import requests

# Login to get token
response = requests.post(
    "http://localhost:8000/api/v1/auth/login",
    json={"username": "user", "password": "pass"}
)
token = response.json()["access_token"]

# Use token in requests
headers = {"Authorization": f"Bearer {token}"}
```

## Documentation

- **Interactive API Docs**: `http://localhost:8000/docs`
- **ReDoc**: `http://localhost:8000/redoc`
- **OpenAPI Spec**: `http://localhost:8000/openapi.json`

For complete documentation, see the [HACS Documentation](https://github.com/solanovisitor/hacs/blob/main/docs/README.md).

## License

Licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/solanovisitor/hacs/blob/main/LICENSE) for details.

## Contributing

See [Contributing Guidelines](https://github.com/solanovisitor/hacs/blob/main/docs/contributing/guidelines.md) for information on how to contribute to HACS API.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hacs-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Solano Todeschini <solano.todeschini@gmail.com>",
    "keywords": "agents, api, fastapi, fhir, healthcare",
    "author": null,
    "author_email": "Solano Todeschini <solano.todeschini@gmail.com>",
    "download_url": null,
    "platform": null,
    "description": "# HACS API\n\nFastAPI service for Healthcare Agent Communication Standard (HACS).\n\n## Overview\n\n`hacs-api` provides a production-ready REST API service built with FastAPI for managing HACS healthcare data. It offers comprehensive endpoints for patients, observations, encounters, and agent communications with built-in authentication, validation, and FHIR compliance.\n\n## Key Features\n\n### REST API Endpoints\n- **Patients**: CRUD operations for patient management\n- **Observations**: Clinical data and measurements\n- **Encounters**: Healthcare visits and episodes\n- **Agent Messages**: Inter-agent communications\n- **Evidence**: Clinical evidence and guidelines\n\n### Authentication & Security\n- JWT-based authentication\n- Role-based access control\n- API key management\n- Request rate limiting\n- CORS support\n\n### FHIR Compliance\n- FHIR R5 compatible endpoints\n- Standard resource formats\n- FHIR search parameters\n- Bulk data operations\n\n## Installation\n\n```bash\npip install hacs-api\n```\n\n## Quick Start\n\n### Start the API Server\n```bash\n# Using the CLI\nhacs-api\n\n# Or using uvicorn directly\nuvicorn hacs_api.main:app --host 0.0.0.0 --port 8000\n```\n\n### API Usage\n```python\nimport requests\n\n# Create a patient\npatient_data = {\n    \"display_name\": \"John Doe\",\n    \"birth_date\": \"1980-01-01\",\n    \"gender\": \"male\"\n}\n\nresponse = requests.post(\n    \"http://localhost:8000/api/v1/patients\",\n    json=patient_data,\n    headers={\"Authorization\": \"Bearer YOUR_TOKEN\"}\n)\n\npatient = response.json()\npatient_id = patient[\"id\"]\n\n# Get patient\nresponse = requests.get(\n    f\"http://localhost:8000/api/v1/patients/{patient_id}\",\n    headers={\"Authorization\": \"Bearer YOUR_TOKEN\"}\n)\n\n# Create observation\nobservation_data = {\n    \"patient_id\": patient_id,\n    \"observation_type\": \"blood_pressure\",\n    \"value\": {\"systolic\": 120, \"diastolic\": 80},\n    \"unit\": \"mmHg\"\n}\n\nresponse = requests.post(\n    \"http://localhost:8000/api/v1/observations\",\n    json=observation_data,\n    headers={\"Authorization\": \"Bearer YOUR_TOKEN\"}\n)\n```\n\n## API Endpoints\n\n### Patient Management\n- `GET /api/v1/patients` - List patients\n- `POST /api/v1/patients` - Create patient\n- `GET /api/v1/patients/{id}` - Get patient\n- `PUT /api/v1/patients/{id}` - Update patient\n- `DELETE /api/v1/patients/{id}` - Delete patient\n\n### Clinical Data\n- `GET /api/v1/observations` - List observations\n- `POST /api/v1/observations` - Create observation\n- `GET /api/v1/patients/{id}/observations` - Get patient observations\n\n### Agent Communications\n- `GET /api/v1/messages` - List messages\n- `POST /api/v1/messages` - Send message\n- `GET /api/v1/messages/{id}` - Get message\n\n## Configuration\n\n### Environment Variables\n```bash\n# Database\nDATABASE_URL=postgresql://user:pass@localhost/hacs\n\n# Authentication\nJWT_SECRET_KEY=your-secret-key\nJWT_ALGORITHM=HS256\nJWT_EXPIRATION_HOURS=24\n\n# API Settings\nAPI_V1_PREFIX=/api/v1\nCORS_ORIGINS=[\"http://localhost:3000\"]\n```\n\n### Docker Deployment\n```dockerfile\nFROM python:3.11-slim\n\nWORKDIR /app\nCOPY requirements.txt .\nRUN pip install -r requirements.txt\n\nCOPY . .\nEXPOSE 8000\n\nCMD [\"uvicorn\", \"hacs_api.main:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]\n```\n\n## Authentication\n\n### JWT Token Authentication\n```python\nimport requests\n\n# Login to get token\nresponse = requests.post(\n    \"http://localhost:8000/api/v1/auth/login\",\n    json={\"username\": \"user\", \"password\": \"pass\"}\n)\ntoken = response.json()[\"access_token\"]\n\n# Use token in requests\nheaders = {\"Authorization\": f\"Bearer {token}\"}\n```\n\n## Documentation\n\n- **Interactive API Docs**: `http://localhost:8000/docs`\n- **ReDoc**: `http://localhost:8000/redoc`\n- **OpenAPI Spec**: `http://localhost:8000/openapi.json`\n\nFor complete documentation, see the [HACS Documentation](https://github.com/solanovisitor/hacs/blob/main/docs/README.md).\n\n## License\n\nLicensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/solanovisitor/hacs/blob/main/LICENSE) for details.\n\n## Contributing\n\nSee [Contributing Guidelines](https://github.com/solanovisitor/hacs/blob/main/docs/contributing/guidelines.md) for information on how to contribute to HACS API.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "FastAPI service for HACS (Healthcare Agent Communication Standard)",
    "version": "0.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/solanovisitor/hacs/issues",
        "Changelog": "https://github.com/solanovisitor/hacs/blob/main/docs/reference/changelog.md",
        "Documentation": "https://github.com/solanovisitor/hacs/blob/main/docs/README.md",
        "Homepage": "https://github.com/solanovisitor/hacs",
        "Repository": "https://github.com/solanovisitor/hacs"
    },
    "split_keywords": [
        "agents",
        " api",
        " fastapi",
        " fhir",
        " healthcare"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d7c4493ab9e6e1da5ac44d830919878f3e1aa2a96b0979415ff1ac743feafca1",
                "md5": "d93d6b38af578896059570a1e98e34e4",
                "sha256": "9f69b94c42f7bbe3ce28b8e1701bd1199e23f1948deb26858e52e78338aa4126"
            },
            "downloads": -1,
            "filename": "hacs_api-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d93d6b38af578896059570a1e98e34e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 5622,
            "upload_time": "2025-07-09T14:52:22",
            "upload_time_iso_8601": "2025-07-09T14:52:22.407156Z",
            "url": "https://files.pythonhosted.org/packages/d7/c4/493ab9e6e1da5ac44d830919878f3e1aa2a96b0979415ff1ac743feafca1/hacs_api-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-09 14:52:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "solanovisitor",
    "github_project": "hacs",
    "github_not_found": true,
    "lcname": "hacs-api"
}
        
Elapsed time: 1.12953s