Luna SaludReferencia de la APILuna Salud

Obtener notas clínicas del paciente

GET/patient-charts

Recupera el expediente clínico del paciente: las notas clínicas y los registros estructurados documentados para el paciente. Limitado a tu organización.

Ejemplos de código

Node.js

const fetch = require('node-fetch');

async function llamarApi() {
  const claveApi = 'YOUR_API_KEY';
  const patientId = 'su-patientId';

const queryString = new URLSearchParams({
    patientId: patientId
  }).toString();

  const url = `https://account.lunahealth.app/api/patient-charts` + (queryString ? `?${queryString}` : '');
  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${claveApi}`,
        'Content-Type': 'application/json'
      }
    });
    
    if (!response.ok) {
      throw new Error(`API error: ${response.status}`);
    }
    
    const data = await response.json();
    console.log(data);
    return data;
  } catch (error) {
    console.error('Error al llamar a la API:', error);
    throw error;
  }
}

llamarApi();

Python

import requests

def llamarApi():
    claveApi = 'YOUR_API_KEY'
    
    url = 'https://account.lunahealth.app/api/patient-charts'
    
    headers = {
        'Authorization': f'Bearer {claveApi}',
        'Content-Type': 'application/json'
    }
    
    params = {
    'patientId': 'su-patientId'
    }
    
    try:
        response = requests.get(
            url,
            headers=headers,
            params=params
        )
        response.raise_for_status()
        
        data = response.json()
        print(data)
        return data
    except requests.exceptions.RequestException as e:
        print(f'Error al llamar a la API: {e}')
        raise

llamarApi()

Parámetros

NombreUbicaciónTipoRequeridoDescripción
patientIdquerystringSíID del paciente para filtrar los resultados

Respuestas

EstadoDescripción
200Respuesta exitosa
400Datos de entrada no válidos
401Autorización no proporcionada
403Acceso insuficiente
404No encontrado
500Error interno del servidor

200 — Respuesta exitosa

Campos de la respuesta

NombreTipoRequeridoDescripción
idstringSí—
typestringSí—
statusstringSí—
namestringSí—
descriptionstringnullSí—
created_atstringSí—
updated_atstringSí—
service_datetimestringSí—
signed_atstringnullSí—
completed_datestringnullSí—
itemsarray<object>Sí—
userobject | nullSí—
signed_byobject | nullSí—
created_byobjectSí—
templateobject | nullSí—

Ejemplo de respuesta

[
  {
    "id": "string",
    "type": "CHART",
    "status": "CANCELED",
    "name": "string",
    "description": null,
    "created_at": "string",
    "updated_at": "string",
    "service_datetime": "string",
    "signed_at": null,
    "completed_date": null,
    "items": [
      {
        "id": "string",
        "type": "CHIEF_COMPLAINT",
        "order": 0,
        "Note": {
          "id": "string",
          "label": null,
          "value": null
        },
        "NoteEditor": {
          "id": "string",
          "label": null,
          "value": null
        },
        "ShortText": {
          "id": "string",
          "label": null,
          "value": null
        },
        "TextBlock": {
          "id": "string",
          "label": null,
          "content": null
        },
        "SignaturePad": {
          "id": "string",
          "label": null
        },
        "ChiefComplaint": {
          "id": "string",
          "value": null
        },
        "Range": {
          "id": "string",
          "label": null,
          "value": null
        },
        "Dropdown": {
          "id": "string",
          "label": null,
          "value": null
        },
        "Heading": {
          "id": "string",
          "value": null
        },
        "FileEntity": {
          "id": "string"
        },
        "BodyChart": {
          "id": "string",
          "points": null,
          "signedUrl": null,
          "renderedSignedUrl": null
        },
        "FacialChart": {
          "id": "string",
          "points": null,
          "signedUrl": null,
          "renderedSignedUrl": null
        },
        "CheckBox": {
          "id": "string",
          "value": null
        },
        "Spine": {
          "id": "string",
          "value": null
        },
        "Sketch": {
          "id": "string"
        },
        "Vital": {
          "id": "string",
          "CustomVitals": []
        },
        "Allergy": {
          "id": "string",
          "name": "string",
          "status": "string",
          "reaction": null
        },
        "History": {
          "id": "string",
          "type": "string",
          "condition": "string"
        },
        "Problem": {
          "id": "string",
          "title": "string",
          "status": "string"
        },
        "Procedure": {
          "id": "string",
          "procedure_code": "string",
          "title": "string",
          "description": null,
          "date_performed": "string",
          "status": "string"
        },
        "SpeechToText": {
          "id": "string",
          "label": null,
          "value": null,
          "transcript": null,
          "summary": null,
          "language": null,
          "duration": null,
          "transcription_status": null
        },
        "ReviewOfSystems": {
          "id": "string",
          "type": "CARDIOVASCULAR",
          "findings": null,
          "is_normal": true
        },
        "PhysicalExamination": {
          "id": "string",
          "type": "GENERAL_APPEARANCE",
          "findings": null,
          "is_normal": true
        },
        "TreatmentPlan": {
          "id": "string",
          "therapeutic_indications": null,
          "indicated_procedures": null,
          "followup_plan": null,
          "status": "ACTIVE"
        },
        "Prognosis": {
          "id": "string",
          "expected_outcome": null,
          "potential_complications": null
        },
        "InsuranceHeader": {
          "id": "string",
          "report_number": null,
          "claim_number": null,
          "policy_number": null,
          "insured_name": null
        },
        "AccidentDetails": {
          "id": "string",
          "coverage_affected": null,
          "is_passenger": true,
          "is_driver": true,
          "vehicle_type": null,
          "trauma_type": null,
          "trauma_location": null,
          "trauma_mechanism": null
        },
        "HospitalizationInfo": {
          "id": "string",
          "hospital_name": null,
          "admission_date": null,
          "discharge_date": null,
          "stay_type": null,
          "stay_duration_days": null
        },
        "ReferralInfo": {
          "id": "string",
          "referred_by_physician": null,
          "referred_to_type": null,
          "referred_to_name": null,
          "recommends_transfer": null,
          "discharge_type": null,
          "treatment_status": null
        },
        "PhysicianSignatureBlock": {
          "id": "string",
          "physician_name": null,
          "specialty": null,
          "professional_license": null,
          "signed_at": null
        }
      }
    ],
    "user": {
      "id": "string",
      "first_name": null,
      "last_name": null,
      "email": null,
      "type": "STAFF"
    },
    "signed_by": {
      "id": "string",
      "first_name": null,
      "last_name": null,
      "email": null,
      "type": "STAFF"
    },
    "created_by": {
      "id": "string",
      "first_name": null,
      "last_name": null,
      "email": null,
      "type": "STAFF"
    },
    "template": {
      "id": "string",
      "name": "string",
      "description": null,
      "tags": [
        "string"
      ],
      "type": "CHART",
      "created_at": "string",
      "updated_at": "string"
    }
  }
]

400 — Datos de entrada no válidos

Campos de la respuesta

NombreTipoRequeridoDescripción
messagestringSíThe error message
codestringSíThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Ejemplo de respuesta

{
  "code": "BAD_REQUEST",
  "message": "Invalid input data",
  "issues": []
}

401 — Autorización no proporcionada

Campos de la respuesta

NombreTipoRequeridoDescripción
messagestringSíThe error message
codestringSíThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Ejemplo de respuesta

{
  "code": "UNAUTHORIZED",
  "message": "Authorization not provided",
  "issues": []
}

403 — Acceso insuficiente

Campos de la respuesta

NombreTipoRequeridoDescripción
messagestringSíThe error message
codestringSíThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Ejemplo de respuesta

{
  "code": "FORBIDDEN",
  "message": "Insufficient access",
  "issues": []
}

404 — No encontrado

Campos de la respuesta

NombreTipoRequeridoDescripción
messagestringSíThe error message
codestringSíThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Ejemplo de respuesta

{
  "code": "NOT_FOUND",
  "message": "Not found",
  "issues": []
}

500 — Error interno del servidor

Campos de la respuesta

NombreTipoRequeridoDescripción
messagestringSíThe error message
codestringSíThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Ejemplo de respuesta

{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}