Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Jan 17, 2024
1 parent 7ff0dd9 commit e792bc6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
166460bf
11886b27
27 changes: 14 additions & 13 deletions book/developer_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,17 @@ <h2 data-number="5.1" class="anchored" data-anchor-id="api-specification"><span
<p>The calculation of indicators for custom scenarios in the web app relies on an API. Right now, the web app uses an API which is hosted as an <a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview?pivots=programming-language-python">Azure Function</a>.</p>
<p>In particular, the function must accept a POST body that looks like this. Only output areas which are changed relative to the baseline need to be included in the inner JSON object:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode json code-with-copy"><code class="sourceCode json"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="dt">"scenario_json"</span><span class="fu">:</span> <span class="fu">{</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="er">output_area_name</span><span class="fu">:</span> <span class="fu">{</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> <span class="dt">"signature_type"</span><span class="fu">:</span> <span class="er">int</span> <span class="er">|</span> <span class="kw">null</span><span class="fu">,</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="dt">"job"</span><span class="fu">:</span> <span class="er">float</span> <span class="er">|</span> <span class="kw">null</span><span class="fu">,</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">"use"</span><span class="fu">:</span> <span class="er">float</span> <span class="er">|</span> <span class="kw">null</span><span class="fu">,</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">"greenspace"</span><span class="fu">:</span> <span class="er">float</span> <span class="er">|</span> <span class="kw">null</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">},</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="er">...</span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">}</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="fu">}</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="dt">"model_identifier"</span><span class="fu">:</span> <span class="er">string</span><span class="fu">,</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="dt">"scenario_json"</span><span class="fu">:</span> <span class="fu">{</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> <span class="er">output_area_name</span><span class="fu">:</span> <span class="fu">{</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="dt">"signature_type"</span><span class="fu">:</span> <span class="er">int</span> <span class="er">|</span> <span class="kw">null</span><span class="fu">,</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">"job"</span><span class="fu">:</span> <span class="er">float</span> <span class="er">|</span> <span class="kw">null</span><span class="fu">,</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="dt">"use"</span><span class="fu">:</span> <span class="er">float</span> <span class="er">|</span> <span class="kw">null</span><span class="fu">,</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> <span class="dt">"greenspace"</span><span class="fu">:</span> <span class="er">float</span> <span class="er">|</span> <span class="kw">null</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">},</span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="er">...</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">}</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="fu">}</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>Upon success, this must return a JSON response with the following format (all output areas must be included):</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode json code-with-copy"><code class="sourceCode json"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="er">output_area_name</span><span class="fu">:</span> <span class="fu">{</span></span>
Expand Down Expand Up @@ -376,11 +377,11 @@ <h2 data-number="5.2" class="anchored" data-anchor-id="azure-functions"><span cl
<li><p>To test the function locally, run:</p>
<pre><code>func start</code></pre>
<p>You should then be able to access the API at <code>http://localhost:7071/api/scenario</code>. For example, you can test it using the following command, which asks it to calculate the baseline indicators (an empty scenario means no changes relative to the baseline):</p>
<pre><code>curl http://localhost:7071/api/scenario -X POST -d "{\"scenario_json\": {}}" -v</code></pre></li>
<pre><code>curl http://localhost:7071/api/scenario -X POST -d "{\"scenario_json\": {}, \"model_identifier\": \"tyne_and_wear\"}" -v</code></pre></li>
<li><p>To deploy it to Azure, run the following, which will take a few minutes:</p>
<pre><code>func azure functionapp publish demolandapi --python</code></pre>
<pre><code>func azure functionapp publish demolandapi</code></pre>
<p>Test it with:</p>
<pre><code>curl https://demolandapi.azurewebsites.net/api/scenario -X POST -d "{\"scenario_json\": {}}" -v</code></pre></li>
<pre><code>curl https://demolandapi.azurewebsites.net/api/scenario -X POST -d "{\"scenario_json\": {}, \"model_identifier\": \"tyne_and_wear\"}" -v</code></pre></li>
</ol>


Expand Down
4 changes: 2 additions & 2 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@
"href": "book/developer_notes.html#api-specification",
"title": "5  Developer notes",
"section": "5.1 API specification",
"text": "5.1 API specification\nThe calculation of indicators for custom scenarios in the web app relies on an API. Right now, the web app uses an API which is hosted as an Azure Function.\nIn particular, the function must accept a POST body that looks like this. Only output areas which are changed relative to the baseline need to be included in the inner JSON object:\n{\n \"scenario_json\": {\n output_area_name: {\n \"signature_type\": int | null,\n \"job\": float | null,\n \"use\": float | null,\n \"greenspace\": float | null\n },\n ...\n }\n}\nUpon success, this must return a JSON response with the following format (all output areas must be included):\n{\n output_area_name: {\n \"air_quality\": float,\n \"house_price\": float,\n \"job_accessibility\": float,\n \"greenspace_accessibility\": float,\n \"signature_type\": int\n },\n ...\n}"
"text": "5.1 API specification\nThe calculation of indicators for custom scenarios in the web app relies on an API. Right now, the web app uses an API which is hosted as an Azure Function.\nIn particular, the function must accept a POST body that looks like this. Only output areas which are changed relative to the baseline need to be included in the inner JSON object:\n{\n \"model_identifier\": string,\n \"scenario_json\": {\n output_area_name: {\n \"signature_type\": int | null,\n \"job\": float | null,\n \"use\": float | null,\n \"greenspace\": float | null\n },\n ...\n }\n}\nUpon success, this must return a JSON response with the following format (all output areas must be included):\n{\n output_area_name: {\n \"air_quality\": float,\n \"house_price\": float,\n \"job_accessibility\": float,\n \"greenspace_accessibility\": float,\n \"signature_type\": int\n },\n ...\n}"
},
{
"objectID": "book/developer_notes.html#azure-functions",
"href": "book/developer_notes.html#azure-functions",
"title": "5  Developer notes",
"section": "5.2 Azure Functions",
"text": "5.2 Azure Functions\nThe code required to deploy this can be found on the azure-functions branch of the engine repository, specifically the function_app.py file.\nTo deploy a new version of the Azure function, make sure you are a member of the “Land Use Indicator” Azure subscription (the subscription ID is 86307bb0-6d16-4077-b1f7-939370d5289a). If you are not, get Dani to add you.\nThen, follow these instructions:\n\nLog in to Azure. This will open a browser window where you can log in with your Microsoft account.\n az login\nSet your active subscription to the one above:\naz account set -s 86307bb0-6d16-4077-b1f7-939370d5289a\nInstall the Azure Functions Core Tools. The following Homebrew command works on macOS; for other operating systems, refer to the Azure docs\nbrew tap azure/functions\nbrew install azure-functions-core-tools@4\nClone the demoland-engine repository (if you don’t already have it), and cd to the top level of the demoland-engine repository.\nTo test the function locally, run:\nfunc start\nYou should then be able to access the API at http://localhost:7071/api/scenario. For example, you can test it using the following command, which asks it to calculate the baseline indicators (an empty scenario means no changes relative to the baseline):\ncurl http://localhost:7071/api/scenario -X POST -d \"{\\\"scenario_json\\\": {}}\" -v\nTo deploy it to Azure, run the following, which will take a few minutes:\nfunc azure functionapp publish demolandapi --python\nTest it with:\ncurl https://demolandapi.azurewebsites.net/api/scenario -X POST -d \"{\\\"scenario_json\\\": {}}\" -v"
"text": "5.2 Azure Functions\nThe code required to deploy this can be found on the azure-functions branch of the engine repository, specifically the function_app.py file.\nTo deploy a new version of the Azure function, make sure you are a member of the “Land Use Indicator” Azure subscription (the subscription ID is 86307bb0-6d16-4077-b1f7-939370d5289a). If you are not, get Dani to add you.\nThen, follow these instructions:\n\nLog in to Azure. This will open a browser window where you can log in with your Microsoft account.\n az login\nSet your active subscription to the one above:\naz account set -s 86307bb0-6d16-4077-b1f7-939370d5289a\nInstall the Azure Functions Core Tools. The following Homebrew command works on macOS; for other operating systems, refer to the Azure docs\nbrew tap azure/functions\nbrew install azure-functions-core-tools@4\nClone the demoland-engine repository (if you don’t already have it), and cd to the top level of the demoland-engine repository.\nTo test the function locally, run:\nfunc start\nYou should then be able to access the API at http://localhost:7071/api/scenario. For example, you can test it using the following command, which asks it to calculate the baseline indicators (an empty scenario means no changes relative to the baseline):\ncurl http://localhost:7071/api/scenario -X POST -d \"{\\\"scenario_json\\\": {}, \\\"model_identifier\\\": \\\"tyne_and_wear\\\"}\" -v\nTo deploy it to Azure, run the following, which will take a few minutes:\nfunc azure functionapp publish demolandapi\nTest it with:\ncurl https://demolandapi.azurewebsites.net/api/scenario -X POST -d \"{\\\"scenario_json\\\": {}, \\\"model_identifier\\\": \\\"tyne_and_wear\\\"}\" -v"
},
{
"objectID": "code/01_baseline/01_accessibility.html#variables-definition-and-data-import",
Expand Down

0 comments on commit e792bc6

Please sign in to comment.