| Type: | Package | 
| Title: | Portuguese 'NHS' Hospitals | 
| Version: | 0.1.0 | 
| Description: | A data set of the Portuguese 'NHS' hospitals. | 
| License: | CC0 | 
| URL: | https://github.com/nhs-pt/hospitals | 
| BugReports: | https://github.com/nhs-pt/hospitals/issues | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| RoxygenNote: | 7.1.2 | 
| Imports: | magrittr, stringr, tibble | 
| Depends: | R (≥ 2.10) | 
| Suggests: | testthat (≥ 3.0.0) | 
| Config/testthat/edition: | 3 | 
| NeedsCompilation: | no | 
| Packaged: | 2021-11-25 12:00:01 UTC; rmagno | 
| Author: | Ramiro Magno | 
| Maintainer: | Ramiro Magno <ramiro.magno@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2021-11-26 08:20:02 UTC | 
hospitals: Portuguese 'NHS' Hospitals
Description
A data set of the Portuguese 'NHS' hospitals.
Author(s)
Maintainer: Ramiro Magno ramiro.magno@gmail.com (ORCID)
Other contributors:
- CINTESIS [copyright holder, funder] 
See Also
Useful links:
Pipe operator
Description
See magrittr::%>% for details.
Usage
lhs %>% rhs
Arguments
| lhs | A value or the magrittr placeholder. | 
| rhs | A function call using the magrittr semantics. | 
Value
The result of calling 'rhs(lhs)'.
Get hospital attribute
Description
get_hospital_attribute retrieves one of the variables of hospitals
as indicated in x. Hospitals in x can be specified by the: (i) hospital
identifier, (ii) acronym, or the (iii) shortened or (iv) full version of the
hospital name.
Usage
get_hospital_attribute(x, key = "hospital_id", value = "hospital_short_name")
Arguments
| x | A character vector of values that refer to hospitals, can be either
the hospital identifier (e.g.  | 
| key | A string indicating the type of values in  | 
| value | A string indicating the hospital attribute to be returned, can
be any of the columns of  | 
Value
A character vector of hospital attributes.
Examples
# Get the short name of a hospital
# (same as get_hospital_attribute('h0001', value = 'hospital_short_name'))
get_hospital_attribute('h0001')
# Or get instead the full name
get_hospital_attribute('h0001', value = 'hospital_full_name')
# Map the hospital short name to its full name
get_hospital_attribute('IPO de Lisboa', key = 'hospital_short_name', value = 'hospital_full_name')
Portuguese NHS hospitals
Description
A dataset of the Portuguese National Health Service hospitals.
Usage
hospitals
Format
A data frame with 16 variables:
- hospital_id
- A surrogate identifier created by this R package to identify unambiguously each hospital institution. 
- hospital_acronym
- The acronym or initialism of the hospital name. 
- hospital_legal_status
- Legal entity status: either an administrative public sector (SPA) entity, a corporate public entity (EPE) or a public-private partnership (PPP) entity. The legal status of SPA and EPE entities can be found in Decree-law 18/2017. For information about the legal status of the PPP entities see Decree-law 23/2020. The Portuguese government may also establish contracts with hospitals owned by social enterprises, namely Private Institutions of Social Solidarity (IPSS). In this case, these hospitals become effectively part of the National Health Service. There are three types of contracts that can be established with IPSS which are regulated by the Decree-law 138/2013: Management Agreement (IPSS-MA), Cooperative Agreement (IPSS-CA) and Convention (IPSS-CN). 
- hospital_integration
- The integration level of the hospital institution: a single hospital unit ( - 'H'); Centro Hospitalar (- 'CH'), comprising two or more individual Hospital units (a case of horizontal integration); and Unidade Local de Saúde (- 'ULS'), comprising both Hospital entities and primary care health centres (a case of vertical integration).
- hospital_group
- One of the groups defined by Ordinance 82/2014: I, II, III, IV-a, IV-b or IV-c. This classification is based on the hospital catchment area and the scope of medical specialities provided. Broadly speaking, group I includes local hospitals, group II corresponds to regional hospitals, and group III to central hospitals. Group IV corresponds to specialised hospitals: IV-a, oncology institutes; IV-b, physical medicine and rehabilitation hospitals; and IV-c, psychiatry and mental health hospitals. 
- hospital_short_name
- An abbreviated version of the hospital name. 
- hospital_full_name
- The name of the hospital. 
- hospital_region_full_name
- The name of the Portuguese health region. 
- hospital_region_short_name
- A shortened version of - hospital_region_full_name.
- hospital_vatin
- VAT identification number (VATIN). In Portuguese, Número de Identificação de Pessoa Colectiva (NIPC). 
- hospital_latitude
- Latitude of the location of the hospital entity expressed in decimal degrees. 
- hospital_longitude
- Longitude of the location of the hospital entity expressed in decimal degrees. 
- hospital_region_colour
- Colour associated with the - region. These colours are assigned by this package and are provided as a convenience colour palette for plotting in R.
- hospital_bh_group
- One of the groups defined by the project Benchmarking of Hospitals. Source: BH | Grupos e Instituições. 
- hospital_bh_group_colour
- Colour associated with the - bh_group. These colours are assigned by this package and are provided as a convenience colour palette for plotting in R.
- hospital_regex
- A regular expression that can be used to identify hospitals from their names, even when the names are not exactly as in - hospital_full_name.
Details
The concept of hospital here adopted is that of a legal entity
providing hospital services. Depending on the organisational structure of the
entity, it may be a single hospital unit (H), several hospital units that
have been merged into one Hospital Centre (CH), or a merge of hospital units
and health centres into the so called Unidades Locais de Saúde (ULS);
the column hospital_integration indicates which case is which.
Source
The set of hospitals included in this dataset was created by manual inspection of the hospital institutions referred in https://www.sns.gov.pt/institucional/entidades-de-saude/, namely those under the sections: Serviço Nacional de Saúde—Setor Público Empresarial, Serviço Nacional de Saúde—Setor Público Administrativo, Hospitais em parceria público-privada (PPP) and Hospitais geridos pelas Misericórdias.
Here are the sources per variable (column) in the dataset:
- hospital_id
- Own work. 
- hospital_acronym
- Own work. 
- hospital_legal_status
- Obtained from https://www.sns.gov.pt/institucional/entidades-de-saude/ as the hospitals were grouped according to its legal status. In the case of the partnerships with IPSS, the information on the precise type of contract was obtained from inspection of the contracts themselves. In all cases they are Cooperative Agreements (IPSS-CA): - Hospital Luciano de Castro, Anadia
- data-raw/source/Acordo_Cooperacao_Hospital_Jose_Luciano_Castro_-Anadia1.pdf 
- Hospital São José, Fafe
- Hospital de São Paulo, Serpa
- data-raw/source/Acordo_Cooperacao_-Hospital_Sao_Paulo_Serpa.pdf 
 
- hospital_integration
- The classification in Hospital unit (H), Hospital Centre (CH) or Unidade Local de Saúde (ULS) could be easily inferred from the name of the hospitals. Hospital Centres always start with Centro Hospitalar (CH), and ULS hospitals always start with Unidade Local de Saúde (ULS). The remaining hospitals are therefore single Hospital (H) units. 
- hospital_group
- 
- Hospitals mentioned in Ordinance 82/2014
- For the majority of the hospitals this grouping was obtained from the ordinance where these are first defined, i.e., the table annexed to Ordinance 82/2014. 
- Instituto de Oftalmologia Dr. Gama Pinto
- The hospital Instituto de Oftalmologia Dr. Gama Pinto was not assigned to any group in the Ordinance 82/2014. But given that this hospital is exclusively specialised in ophthalmology, we have decided to assign it generically to group IV (for specialised hospitals), following the criteria given in Ordinance 82/2014. 
- Hospital Dr. Francisco Zagalo, Ovar
- The hospital Hospital Dr. Francisco Zagalo, Ovar was not assigned to any group in the Ordinance 82/2014. It was included in group I however in a work by Luís Pereira, which we followed, see Table 15 in the Appendix 1, page 71 of data-raw/source/Pereira.Unpublished.2019.pdf. 
- Hospital Luciano de Castro, Anadia
- The hospital Hospital Luciano de Castro, Anadia was not assigned to any group in the Ordinance 82/2014. It was included in group I however in a work by Luís Pereira, which we followed, see Table 15 in the Appendix 1, page 71 of data-raw/source/Pereira.Unpublished.2019.pdf. 
 
- hospital_short_name
- Own work. 
- hospital_full_name
- Obtained from https://www.sns.gov.pt/institucional/entidades-de-saude/. 
- hospital_region_full_name
- Obtained from Decree-law 11/93. 
- hospital_region_short_name
- Own work. 
- hospital_vatin
- From the search engine https://codigopostal.ciberforma.pt/ and from data-raw/source/Infarmed_lista_hospitais.pdf. 
- hospital_latitudeand- hospital_longitude
- By searching each hospital in Google Maps and retrieving its coordinates. 
- hospital_region_colour
- Own work. 
- hospital_bh_group
- 
The ACSS groups defined in the project Hospitals' Benchmarking were collected from these sources: - ACSS Hospitals' Benchmarking website
- Relatório de Benchmarking | hospitais EPE e PPP
- Termos de Referência para contratualização de cuidados desaúde no SNS para 2021
- Page 25 of data-raw/source/ACSS.TechReport.2020.pdf 
 
- hospital_bh_group_colour
- Own work. 
- hospital_regex
- Own work. 
Examples
hospitals
Normalise hospital names
Description
normalise tries to match provided hospital names to the Portuguese NHS
hospitals, i.e. to those hospitals included in the data set
hospitals, thus allowing conversion to standard
hospital names. By default, it returns the shortened version of the hospital
name: column hospital_short_name in hospitals. Use
the return argument to return a different variable, see below for possible
values.
Usage
normalise(
  nm,
  return = c("hospital_short_name", "hospital_full_name", "hospital_id",
    "hospital_acronym"),
  unmatched_as_na = TRUE
)
normalize(
  nm,
  return = c("hospital_short_name", "hospital_full_name", "hospital_id",
    "hospital_acronym"),
  unmatched_as_na = TRUE
)
Arguments
| nm | A character vector of hospital names. | 
| return | A string indicating the hospital attribute to be returned:
either  | 
| unmatched_as_na | A logical indicating whether unmatched hospital names
are returned as  | 
Details
The method behind normalise for matching hospital names is based on an
heuristic that uses a minimal set of keywords to identify the hospital. This
is implemented by using regular expressions. The regular expressions are
provided in data set hospitals, column
hospital_regex. Moreover, the method is case insensitive and is pretty
tolerant to variations in the name as long as one of the critical keywords is
found in the name. Note however that the regular expressions have been
designed such that matches are mutually exclusive. So the same hospital name
will never match more than one hospital of the data set
hospitals.
normalise is aware of deprecated hospital names, and will map those old
designations to the new hospital names, e.g., Hospital do Alto Ave is
correctly mapped to Hospital da Senhora da Oliveira, Guimarães, EPE.
normalise is lenient with typos associated with accented characters, so,
e.g., both expressions 'Hospital de São João' and 'Hospital de Sao Joao' will
correctly match to the same hospital: CHU de São João.
Value
A character vector.
Examples
# Match hospital with a single keyword
normalise('Matosinhos')
# The same, but return now the full name
normalise('Matosinhos', 'hospital_full_name')
# Get instead the hospital identifier
normalise('Matosinhos', 'hospital_id')
# Or even just the acronym (useful for labelling in plots)
normalise('Matosinhos', 'hospital_acronym')
# Find hospitals from their old names
# "Hospital do Alto Ave" is the old name for 'Hospital da Senhora da Oliveira, Guimarães, EPE'
normalise('Hospital do Alto Ave', 'hospital_full_name')
# `normalise()` is vectorised over `nm`
normalise(nm = c('medio tejo', 'oeste', 'guarda'))