schema
¶
Camptocamp.org schema for hut data.
Classes:
-
CamptocampLocale–Camptocamp locale data.
-
CamptocampGeometry–Camptocamp geometry data.
-
CamptocampArea–Camptocamp area data.
-
CamptocampDocument–Camptocamp document/hut data model.
-
CamptocampProperties–Properties saved together with the source data.
-
CamptocampHutSource–Data from camptocamp.org database.
-
CamptocampApiResponse–Response from camptocamp API.
-
CamptocampHut0Convert–Convert Camptocamp data to HutSchema.
Attributes:
-
logger–
Attributes¶
Classes¶
CamptocampLocale
¶
Camptocamp locale data.
Attributes:
-
version(int | None) – -
lang(str) – -
title(str) – -
summary(str | None) – -
description(str | None) – -
access(str | None) – -
access_period(str | None) –
Attributes¶
CamptocampGeometry
¶
CamptocampArea
¶
Camptocamp area data.
Attributes:
-
document_id(int) – -
version(int) – -
locales(list[CamptocampLocale]) – -
area_type(str) – -
available_langs(list[str] | None) – -
protected(bool) – -
type(str) –
Attributes¶
CamptocampDocument
¶
Camptocamp document/hut data model.
Methods:
-
get_id–Get the document ID as string.
-
get_name–Get the name from the first locale.
-
get_location–Extract location from geometry.
-
get_locale–Get locale for specific language.
-
get_image_ids–Get image document ids from the associated images.
Attributes:
-
model_config– -
document_id(int) – -
version(int) – -
locales(list[CamptocampLocale]) – -
geometry(CamptocampGeometry) – -
quality(str | None) – -
waypoint_type(str | None) – -
elevation(int | None) – -
available_langs(list[str] | None) – -
areas(list[CamptocampArea]) – -
protected(bool) – -
type(str | None) – -
capacity(int | None) – -
capacity_staffed(int | None) – -
phone(str | None) – -
phone_custodian(str | None) – -
url(str | None) – -
custodian(str | None) – -
custodianship(str | None) – -
matress_unstaffed(bool | None) – -
blanket_unstaffed(bool | None) – -
gas_unstaffed(bool | None) – -
heating_unstaffed(bool | None) – -
associations(dict[str, Any] | None) –
Attributes¶
model_config
class-attribute
instance-attribute
¶
areas
class-attribute
instance-attribute
¶
areas: list[CamptocampArea] = Field(default_factory=list)
Functions¶
CamptocampProperties
¶
CamptocampHutSource
¶
Data from camptocamp.org database.
Methods:
Attributes:
-
model_config– -
name(str) – -
location(LocationEleSchema | None) – -
source_id(str) – -
source_data(TSourceData_co | None) – -
source_properties(TProperties_co | None) – -
version(int) – -
created(datetime) – -
source_properties_schema(dict) –Returns JSON schema for the 'source_properties' fields.
-
source_name(str) –
Attributes¶
model_config
class-attribute
instance-attribute
¶
location
class-attribute
instance-attribute
¶
location: LocationEleSchema | None = Field(
None, description="Location of the hut."
)
source_id
class-attribute
instance-attribute
¶
source_data
class-attribute
instance-attribute
¶
source_properties
class-attribute
instance-attribute
¶
source_properties: TProperties_co | None = Field(
None, description="Additinal source data properties."
)
version
class-attribute
instance-attribute
¶
version: int = Field(
default=0,
description="Version of the service when this entry was created.",
)
created
class-attribute
instance-attribute
¶
created: datetime = Field(
default_factory=now,
description="Version of the service when this entry was created.",
)
source_properties_schema
property
¶
Returns JSON schema for the 'source_properties' fields.
Returns:
-
dict–JSON schema.
Functions¶
show
¶
show(
source_id: bool = True,
location: bool = True,
elevation: bool = True,
source_name: bool = True,
version: bool = False,
created: bool = False,
) -> str
Returns a formatted string with the hut information which can be printed.
Parameters:
-
(source_id¶bool, default:True) –Show source ID.
-
(location¶bool, default:True) –Show location.
-
(elevation¶bool, default:True) –Show elevation.
-
(source_name¶bool, default:True) –Show source name.
-
(version¶bool, default:False) –Show verions.
-
(created¶bool, default:False) –Show created date.
Returns:
-
str–Formatted string.
CamptocampApiResponse
¶
Response from camptocamp API.
Attributes:
-
documents(list[CamptocampDocument]) – -
total(int | None) –
Attributes¶
CamptocampHut0Convert
¶
Convert Camptocamp data to HutSchema.
Classes:
-
FieldNotImplementedError–Field is not implemented.
Methods:
-
get_hut–Convert to hut.
Attributes:
-
source_data(TSourceData) – -
include_photos(bool) – -
slug(str) – -
location(LocationEleSchema) – -
country_code(str | None) – -
comment(str) – -
is_active(bool) – -
is_bookable(bool) –Whether availability can be fetched for this hut through the
-
extras(dict[str, Any]) – -
name(TranslationSchema) –Get name with translations.
-
source_name(str) – -
description(TranslationSchema) –Get description with translations.
-
author(AuthorSchema | None) –Get author information.
-
source(SourceSchema | None) –Get source information.
-
license(LicenseSchema | None) –Get license information.
-
notes(list[TranslationSchema]) –Get notes including access and period information.
-
owner(OwnerSchema | None) –Get owner information.
-
photos(list[PhotoSchema]) –Get photos associated with this hut from camptocamp.org.
-
url(str) –Hut website if available (the camptocamp page link is in
source). -
capacity(CapacitySchema) –Get capacity information.
-
hut_type(HutTypeSchema) –Guess hut type based on waypoint_type and other info.
-
open_monthly(OpenMonthlySchema) –Opening months parsed from the (free text) access period.
-
is_public(bool) –Determine if hut is public.
-
contacts(list[ContactSchema]) –Get contact information.
Attributes¶
source_data
class-attribute
instance-attribute
¶
is_bookable
property
¶
Whether availability can be fetched for this hut through the source service's online booking system.
Booking services override this (e.g. only huts with a booking structure); huts of sources without online booking are never bookable.
photos
property
¶
photos: list[PhotoSchema]
Get photos associated with this hut from camptocamp.org.
capacity
property
¶
capacity: CapacitySchema
Get capacity information.
Camptocamp's capacity is the unstaffed (winter room) number and
capacity_staffed the staffed one: only huts with a staffed capacity
have a second, smaller number for the closed season.
open_monthly
property
¶
open_monthly: OpenMonthlySchema
Opening months parsed from the (free text) access period.
Classes¶
FieldNotImplementedError
¶
FieldNotImplementedError(
obj: BaseHutConverterSchema, field: str
)
Field is not implemented.
Parameters:
-
(obj¶BaseHutConverterSchema) –Current object.
-
(field¶str) –Field which is not implementd.