Skip to content

Commit

Permalink
Include json in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Meems committed Feb 8, 2019
1 parent 33009a8 commit 7053166
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 31 deletions.
116 changes: 87 additions & 29 deletions docs/source/explanation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ This schema displays the initial basic Indicators for farm-level coffee sustaina
^^^^^^^^^^^^^^^^^^^^^^^^^
The unique identifier for this dataset.

.. todo:: Show sample JSON of ./global-unique-id.json
.. literalinclude:: ../../schema//global-unique-id.json
:language: json
:linenos:

1.2 schemaVersion
^^^^^^^^^^^^^^^^^
Expand All @@ -34,7 +36,9 @@ Globally Unique ID of the farmer

Globally Unique ID of the recording of the farmer at a specific time and by a specific organization.

.. todo:: Show sample JSON of ./global-unique-id.json
.. literalinclude:: ../../schema//global-unique-id.json
:language: json
:linenos:

2.1.2 name
----------
Expand All @@ -60,7 +64,9 @@ The location of the farm

Generally, data should include Country and then State/Department and Municipality/District, unless the address is collected for the sake of auditing. This should be the location of the farm itself (main plot), not the home of the farmer, if different.

.. todo:: Show sample JSON of ./address.json
.. literalinclude:: ../../schema//address.json
:language: json
:linenos:

2.1.4 dateOfBirth
-----------------
Expand Down Expand Up @@ -148,15 +154,19 @@ Farm Id

Globally Unique ID of the recording of the farm at a specific time and by a specific organization.

.. todo:: Show sample JSON of ./global-unique-id.json
.. literalinclude:: ../../schema//global-unique-id.json
:language: json
:linenos:

3.1.2 farmerId
--------------
Farmer Id

Globally Unique ID of the farmer of this farm

.. todo:: Show sample JSON of ./global-unique-id.json
.. literalinclude:: ../../schema//global-unique-id.json
:language: json
:linenos:

3.1.3 location
--------------
Expand All @@ -167,7 +177,9 @@ GPS should be captured for each farm plot if possible. GPS readings should be ta
Front door geolocation


.. todo:: Show sample JSON of ./Point.json
.. literalinclude:: ../../schema//Point.json
:language: json
:linenos:

3.1.3.2 positionTakenAt
***********************
Expand All @@ -180,7 +192,9 @@ Farm address

This should be the location of the farm itself (main plot), not the home of the farmer, if different.

.. todo:: Show sample JSON of ./address.json
.. literalinclude:: ../../schema//address.json
:language: json
:linenos:

3.1.5 totalFarmSize
-------------------
Expand Down Expand Up @@ -325,140 +339,180 @@ Costs incurred to produce the coffee during the last production year (calculated
Fertilizers costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.2 pesticides
******************
Pesticides costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.3 hiredLabor
******************
Costs of hired labor


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.4 plantingMaterial
************************
Costs of planting material


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.5 renovation
******************
Costs of renovation


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.6 deductionsByBuyers
**************************
Deductions by buyers


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.7 rentOfLand
******************
Rent of land


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.8 energy
**************
Energy costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.9 irrigation
******************
Irrigation costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.10 capitalAssets
**********************
Capital assets


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.11 cultivationPractices
*****************************
Cultivation practices


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.12 traceabilityAndRecordKeeping
*************************************
Traceability and record keeping


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.13 standardsCertification
*******************************
Costs of standards or certifications


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.14 plantingReforestation
******************************
Planting and reforestation costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.15 training
*****************
Training costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.16 interest
*****************
Interest on credit


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.17 cropInsurance
**********************
Crop insurance


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.18 cooperativeFees
************************
Cooperative fees


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.19 unpaidFamilyLabor
**************************
Unpaid family labor


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.3.20 other
**************
Other costs


.. todo:: Show sample JSON of ./productionCosts.json
.. literalinclude:: ../../schema//productionCosts.json
:language: json
:linenos:

3.3.4 price
-----------
Expand Down Expand Up @@ -720,15 +774,19 @@ The unique ID of the plot

Globally Unique ID of the recording of the plot at a specific time and by a specific organization.

.. todo:: Show sample JSON of ./global-unique-id.json
.. literalinclude:: ../../schema//global-unique-id.json
:language: json
:linenos:

4.1.2 farmId
------------
To which farm belongs this plot

Globally Unique ID farmId

.. todo:: Show sample JSON of ./global-unique-id.json
.. literalinclude:: ../../schema//global-unique-id.json
:language: json
:linenos:

4.1.3 boundary
--------------
Expand Down
12 changes: 10 additions & 2 deletions generator/GenerateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,16 @@ private void WriteProperties(string propertyName, JObject objectProperties, int
if (objectProperties.ContainsKey("$ref"))
{
var reference = objectProperties.GetValue("$ref").ToString();
if (reference.StartsWith("./"))
Debug.WriteLine("\n.. todo:: Show sample JSON of " + reference);
if (reference.StartsWith("./"))
{
var file = reference.Replace("./", "/");
//Debug.WriteLine($".. literalinclude:: ../../schema{file}");
//Debug.WriteLine( " :linenos:");
// Debug.WriteLine("\n.. todo:: Show sample JSON of " + reference);
Debug.WriteLine($"\n.. literalinclude:: ../../schema/{file}");
Debug.WriteLine(" :language: json");
Debug.WriteLine(" :linenos:");
}
else if (reference.StartsWith("#/definitions/"))
{
var definition = reference.Replace("#/definitions/", "");
Expand Down

0 comments on commit 7053166

Please sign in to comment.