Skip to content

Commit

Permalink
docs(pages): add pages docs for unit, vervar, & var
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanaidilp committed Apr 27, 2024
1 parent 2d78f32 commit b4ceb9f
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 3 deletions.
50 changes: 50 additions & 0 deletions docs/docs/api-docs/list/units.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Units

This method is used to retrieve a list of units based on the selected domain (region).

## Parameters

| Parameter | Type | Description |
| ------------ | -------------- | ----------------------------------------------------- |
| `domain` | `String` | Domain code (region) to retrieve units. |
| `lang` | `DataLanguage` | Language for units data (default: `DataLanguage.id`). |
| `page` | `int` | Page number (default: `1`). |
| `variableID` | `int?` | Variable ID of the units (optional). |

## Examples

Example usage and output:

```dart
// Fetch units data from BPS
final result = await StadataFlutter.instance.list.units(
domain: 'example_domain_code', // Replace with the desired domain code
lang: DataLanguage.id,
page: 1,
variableID: 'example_variable_id', // Replace with the desired variable ID or null
);
final units = result.data;
final pagination = result.pagination;
// Print page information
print('Current page: ${pagination.page}');
print('Total Pages: ${pagination.pages}');
print('Total Data in This Page: ${pagination.count}');
print('PerPage: ${pagination.perPage}');
print('Total: ${pagination.total}');
print('------------------------');
// Print retrieved units data
for (final unit in units) {
print('Unit ID: ${unit.id}');
print('Title: ${unit.title}');
}
```

## Properties (UnitData)

| Property | Type | Description |
| -------- | -------- | ----------------------------------- |
| `id` | `int` | The unique identifier for the Unit. |
| `title` | `String` | The title of the Unit. |
74 changes: 74 additions & 0 deletions docs/docs/api-docs/list/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Variables

This method is used to retrieve a list of variables based on the selected domain (region).

## Parameters

| Parameter | Type | Description |
| ---------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `domain` | `String` | Domain code (region) to retrieve variables. |
| `lang` | `DataLanguage` | Language for variables data (default: `DataLanguage.id`). |
| `page` | `int` | Page number (default: `1`). |
| `subjectID` | `int?` | Variable ID of the variables (optional). |
| `showExistingVariable` | `bool` | A boolean flag to determine whether to only show variables that have values for the specified domain. When set to `true`, the function translates this to the `area` query parameter with a value of 1, filtering the variables to include only those that have existing values in the domain (default: `false`) |
| `year` | `int?` | (Optional) The specific year for which variables are being requested. |

## Examples

Example usage and output:

```dart
// Fetch variables data from BPS
final result = await StadataFlutter.instance.list.variables(
domain: 'example_domain_code', // Replace with the desired domain code
lang: DataLanguage.id,
page: 1,
showExistingVariable: false,
year: 2020,
subjectID: 'example_subject_id', // Replace with the desired subject ID or null
);
final variables = result.data;
final pagination = result.pagination;
// Print page information
print('Current page: ${pagination.page}');
print('Total Pages: ${pagination.pages}');
print('Total Data in This Page: ${pagination.count}');
print('PerPage: ${pagination.perPage}');
print('Total: ${pagination.total}');
print('------------------------');
// Print retrieved variables data
for (final variable in variables) {
print('Variable ID: ${unit.id}');
print('Title: ${unit.title}');
print('Subject ID: ${unit.subjectID}');
print('Subject Name: ${unit.subjectName}');
print('Vertical Variable ID: ${unit.verticalVariableID}');
print('CSA Subject Name: ${unit.csaSubjectName}');
print('Graph Name: ${unit.graphName}');
print('Notes: ${unit.notes}');
print('Unit: ${unit.unit}');
print('Type: ${unit.type}');
print('Derived Period ID: ${unit.derivedPeriodID}');
print('Derived Variable ID: ${unit.derivedVariableID}');
}
```

## Properties (Variable)

| Property | Type | Description |
| -------------------- | --------- | ------------------------------------------------------------------------------- |
| `id` | `int` | The unique identifier for the Variable. |
| `title` | `String` | The official title or label of the variable |
| `subjectID` | `int` | An identifier for the sub-category of the variable. |
| `subjectName` | `String` | The name of the subject to which the variable belongs. |
| `verticalVariableID` | `int` | An identifier for the vertical variable. |
| `csaSubjectName` | `String?` | The name of the cross-sectional subject related to the variable, if applicable. |
| `graphName` | `String` | A descriptive name used for graphing purposes. |
| `notes` | `String` | Additional notes or descriptions about the variable. |
| `unit` | `String` | The measurement unit of the variable. |
| `type` | `int?` | The type of the variable, if applicable. |
| `derivedPeriodID` | `int?` | The identifier for the derived period, if applicable. |
| `derivedVariableID` | `int?` | The identifier for the derived variable, if applicable. |
56 changes: 56 additions & 0 deletions docs/docs/api-docs/list/vertical-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Vertical Variables

This method is used to retrieve a list of vertical variables based on the selected domain (region).

## Parameters

| Parameter | Type | Description |
| ------------ | -------------- | ------------------------------------------------------------------ |
| `domain` | `String` | Domain code (region) to retrieve vertical variables. |
| `lang` | `DataLanguage` | Language for vertical variables data (default: `DataLanguage.id`). |
| `page` | `int` | Page number (default: `1`). |
| `variableID` | `int?` | Variable ID of the vertical variables (optional). |

## Examples

Example usage and output:

```dart
// Fetch vertical variables data from BPS
final result = await StadataFlutter.instance.list.verticalVariables(
domain: 'example_domain_code', // Replace with the desired domain code
lang: DataLanguage.id,
page: 1,
variableID: 'example_variable_id', // Replace with the desired variable ID or null
);
final variables = result.data;
final pagination = result.pagination;
// Print page information
print('Current page: ${pagination.page}');
print('Total Pages: ${pagination.pages}');
print('Total Data in This Page: ${pagination.count}');
print('PerPage: ${pagination.perPage}');
print('Total: ${pagination.total}');
print('------------------------');
// Print retrieved variables data
for (final variable in variables) {
print('Vertical Variable ID: ${unit.id}');
print('Title: ${unit.title}');
print('Item ID: ${unit.itemID}');
print('Group ID: ${unit.groupID}');
print('Group Name: ${unit.groupName}');
}
```

## Properties (VerticalVariable)

| Property | Type | Description |
| ----------- | --------- | ----------------------------------------------------------------------- |
| `id` | `int` | The unique identifier for the Vertical Variable. |
| `title` | `String` | The official title or label of the vertical variable. |
| `itemID` | `int` | It specifies a particular item or element within the vertical variable. |
| `groupID` | `int?` | This identifies the group to which the variable belongs. |
| `groupName` | `String?` | It indicates the name of the group associated with the variable. |
3 changes: 3 additions & 0 deletions docs/docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Here is the roadmap of STADATA Flutter SDK. Feature that marked with this ✅ em
- 🔄 SDGs Data
- ✅ Strategic Indicator
- 🔄 SDDS
- ✅ Unit
- ✅ Variable
- ✅ Vertical Variable

### View API TODO

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/try-the-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 2

# Try the Example

You can explore the capabilities of the Stadata Flutter SDK by checking out the example app provided in the [SDK's GitHub repository](https://github.com/ryanaidilp/stadata_flutter_sdk/tree/main/example).
You can explore the capabilities of the Stadata Flutter SDK by checking out the example app provided in the [SDK's GitHub repository](https://github.com/ryanaidilp/stadata_flutter_sdk/tree/main/app/example).

To run the example app and see the SDK in action, follow these steps:

Expand Down
6 changes: 5 additions & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const config = {
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
"https://github.com/ryanaidilp/stadata_flutter_sdk/tree/main/",
"https://github.com/ryanaidilp/stadata_flutter_sdk/tree/main/docs",
lastVersion: "current",
versions: {
current: {
Expand All @@ -62,6 +62,10 @@ const config = {
label: "0.6.3",
path: "0.6.3",
},
"0.7.0": {
label: "0.7.0",
path: "0.7.0",
},
},
},

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Satuan

Metode ini digunakan untuk mengambil daftar satuan berdasarkan domain yang dipilih (wilayah).

## Parameters

| Parameter | Tipe | Deskripsi |
| ------------ | -------------- | ------------------------------------------------------ |
| `domain` | `String` | Kode domain (wilayah) untuk mengambil satuan. |
| `lang` | `DataLanguage` | Bahasa untuk data satuan (default: `DataLanguage.id`). |
| `page` | `int` | Nomor halaman (default: `1`). |
| `variableID` | `int?` | ID Variable dari satuan (opsional). |

## Contoh

Contoh penggunaan dan keluaran contoh:

```dart
// Fetch units data from BPS
final result = await StadataFlutter.instance.list.units(
domain: 'kode_domain_contoh', // Ganti dengan kode domain yang diinginkan
lang: DataLanguage.id,
page: 1,
variableID: 'contoh_kata_kunci', // Ganti dengan ID variabel yang diinginkan atau null
);
final units = result.data;
final pagination = result.pagination;
// Mencetak informasi halaman
print('Current page: ${pagination.page}');
print('Total Pages: ${pagination.pages}');
print('Total Data in This Page: ${pagination.count}');
print('PerPage: ${pagination.perPage}');
print('Total: ${pagination.total}');
print('------------------------');
// Mencetak data satuan yang diambil
for (final unit in units) {
print('Unit ID: ${unit.id}');
print('Title: ${unit.title}');
}
```

## Properti (UnitData)

| Properti | Tipe | Deskripsi |
| -------- | -------- | ---------------------------- |
| `id` | `int` | Identifier unik dari satuan. |
| `title` | `String` | Nama/Judul satuan. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Variabel

Metode ini digunakan untuk mengambil daftar variabel berdasarkan domain yang dipilih (wilayah).

## Parameters

| Parameter | Tipe | Deskripsi |
| ---------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `domain` | `String` | Kode domain (wilayah) untuk mengambil variabel. |
| `lang` | `DataLanguage` | Bahasa untuk data variabel (bawaan: `DataLanguage.id`). |
| `page` | `int` | Nomor halaman (bawaan: `1`). |
| `subjectID` | `int?` | ID variabel dari variabel yang dipilih (opsional). |
| `showExistingVariable` | `bool` | Digunakan untuk menentukan apakah hanya menampilkan variabel yang memiliki data berdasarkan domain yang ditentukan. Ketika diatur menjadi `true`, fungsi ini menerjemahkan data tersebut ke parameter kueri `area` dengan nilai 1, memfilter variabel untuk hanya menyertakan yang memiliki nilai yang ada di domain (bawaan: `false`) |
| `year` | `int?` | (Opsional) Tahun spesifik untuk permintaan variabel. |

## Contoh

Contoh penggunaan dan keluaran contoh:

```dart
// Fetch variables data from BPS
final result = await StadataFlutter.instance.list.variables(
domain: 'example_domain_code', // Replace with the desired domain code
lang: DataLanguage.id,
page: 1,
showExistingVariable: false,
year: 2020,
subjectID: 'example_subject_id', // Replace with the desired subject ID or null
);
final variables = result.data;
final pagination = result.pagination;
// Mencetak informasi halaman
print('Current page: ${pagination.page}');
print('Total Pages: ${pagination.pages}');
print('Total Data in This Page: ${pagination.count}');
print('PerPage: ${pagination.perPage}');
print('Total: ${pagination.total}');
print('------------------------');
// Mencetak data variabel yang diambil
for (final variable in variables) {
print('Variable ID: ${unit.id}');
print('Title: ${unit.title}');
print('Subject ID: ${unit.subjectID}');
print('Subject Name: ${unit.subjectName}');
print('Vertical Variable ID: ${unit.verticalVariableID}');
print('CSA Subject Name: ${unit.csaSubjectName}');
print('Graph Name: ${unit.graphName}');
print('Notes: ${unit.notes}');
print('Unit: ${unit.unit}');
print('Type: ${unit.type}');
print('Derived Period ID: ${unit.derivedPeriodID}');
print('Derived Variable ID: ${unit.derivedVariableID}');
}
```

## Properti (Variable)

| Properti | Tipe | Deskripsi |
| -------------------- | --------- | ------------------------------------------------------------------------ |
| `id` | `int` | Pengenal unik untuk Variabel. |
| `title` | `String` | Judul resmi atau label dari variabel |
| `subjectID` | `int` | Pengenal untuk sub-kategori dari variabel. |
| `subjectName` | `String` | Nama subjek di mana variabel tersebut berada. |
| `verticalVariableID` | `int` | Pengenal untuk variabel vertikal. |
| `csaSubjectName` | `String?` | Nama subjek lintas seksional yang terkait dengan variabel, jika berlaku. |
| `graphName` | `String` | Nama deskriptif yang digunakan untuk keperluan grafis. |
| `notes` | `String` | Catatan atau deskripsi tambahan tentang variabel. |
| `unit` | `String` | Satuan pengukuran dari variabel. |
| `type` | `int?` | Tipe dari variabel, jika berlaku. |
| `derivedPeriodID` | `int?` | Pengenal untuk periode turunan, jika berlaku. |
| `derivedVariableID` | `int?` | Pengenal untuk variabel turunan, jika berlaku. |
Loading

0 comments on commit b4ceb9f

Please sign in to comment.