Documentation Standards
1. Code Docstrings
- •Style: Google Style Python Docstrings.
- •Requirement: All public functions, classes, and modules must have a docstring.
- •Language: Spanish for domain-specific descriptions (User facing), English for technical details (Developer facing).
- •Example (Mixed):
python
def calcular_supervivencia(pacientes: pd.DataFrame) -> float: """ Calcula la tasa de supervivencia de los pacientes ventilados. Args: pacientes (pd.DataFrame): DataFrame with patient data containing 'status' column. Returns: float: The survival rate between 0.0 and 1.0. """
- •Example (Mixed):
2. Inline Comments
- •Focus: Explain "Why", not "What".
- •Context: Critical for statistical formulas or SimPy simulation logic constraints.
- •Language: English preferred for internal logic.
3. Project Documentation
- •Location:
docs/documentation/ - •Updates: When adding significant features, update the relevant markdown file:
- •
SIMULATION.mdfor changes inuci/simulacion.py. - •
STATISTICS.mdfor new metrics inuci/stats.py. - •
UI_GUIDE.mdfor new Streamlit views.
- •
- •CHANGELOG: Add an entry to
docs/documentation/CHANGELOG.md(orCHANGELOG_ES.md) for versioned releases.
4. Readability
- •Use meaningful variable names (English) that describe the data content (e.g.,
df_patients_filteredinstead ofdf). - •Type hints are part of self-documentation. Use them extensively.